fix failed tests #535
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
release: | |
types: [published] | |
jobs: | |
build: | |
name: Build with JDK ${{ matrix.java }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
java: [8, 11, 17, 20] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: ${{ matrix.java }} | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Assemble the Project | |
run: ./gradlew assemble | |
- name: Run Tests | |
run: ./gradlew check | |
- name: Generate JaCoCo Report | |
run: ./gradlew jacocoTestReport | |
- name: Generate JaCoCo Badges | |
uses: cicirello/jacoco-badge-generator@v2 | |
with: | |
generate-branches-badge: true | |
jacoco-csv-file: > | |
ktorm-core/build/reports/jacoco/test/jacocoTestReport.csv | |
ktorm-global/build/reports/jacoco/test/jacocoTestReport.csv | |
ktorm-jackson/build/reports/jacoco/test/jacocoTestReport.csv | |
ktorm-support-mysql/build/reports/jacoco/test/jacocoTestReport.csv | |
ktorm-support-oracle/build/reports/jacoco/test/jacocoTestReport.csv | |
ktorm-support-postgresql/build/reports/jacoco/test/jacocoTestReport.csv | |
ktorm-support-sqlite/build/reports/jacoco/test/jacocoTestReport.csv | |
ktorm-support-sqlserver/build/reports/jacoco/test/jacocoTestReport.csv | |
- name: Upload Jacoco Badges | |
if: matrix.java == '8' | |
continue-on-error: true | |
run: | | |
REPO_DIR=~/.ktorm/temp/repo/ktorm-docs | |
git clone --depth=1 --branch=master https://github.com/kotlin-orm/ktorm-docs.git "$REPO_DIR" | |
cp .github/badges/jacoco.svg "$REPO_DIR/source/images" | |
cp .github/badges/branches.svg "$REPO_DIR/source/images" | |
cd "$REPO_DIR" | |
if [[ `git status --porcelain` ]]; then | |
git config user.name 'vince' | |
git config user.email 'me@liuwj.me' | |
git add . | |
git commit -m "[github actions] update jacoco badges" | |
git push "https://$GIT_PUSH_TOKEN@github.com/kotlin-orm/ktorm-docs.git" master | |
fi | |
env: | |
GIT_PUSH_TOKEN: ${{secrets.GIT_PUSH_TOKEN}} | |
publish: | |
name: Publish Artifacts | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup Java | |
uses: actions/setup-java@v3 | |
with: | |
distribution: zulu | |
java-version: 8 | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Assemble the Project | |
run: ./gradlew assemble | |
- name: Publish Artifacts | |
run: | | |
if [[ $(cat "ktorm.version") =~ "SNAPSHOT" ]] ; then | |
./gradlew publishDistPublicationToSnapshotRepository | |
else | |
if [[ $GITHUB_EVENT_NAME == "release" ]] ; then | |
./gradlew publishDistPublicationToCentralRepository | |
else | |
echo "Skip release publication because this is not a release event" | |
fi | |
fi | |
env: | |
OSSRH_USER: ${{secrets.OSSRH_USER}} | |
OSSRH_PASSWORD: ${{secrets.OSSRH_PASSWORD}} | |
GPG_KEY_ID: ${{secrets.GPG_KEY_ID}} | |
GPG_PASSWORD: ${{secrets.GPG_PASSWORD}} | |
GPG_SECRET_KEY: ${{secrets.GPG_SECRET_KEY}} |