use gradle/actions v5 #281
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| tags-ignore: | |
| # The release versions will be verified by 'publish-release.yml' | |
| - centraldogma-* | |
| pull_request: | |
| concurrency: | |
| # Cancel the previous builds in the same PR. | |
| # Allow running concurrently for all non-PR commits. | |
| group: ci-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| env: | |
| LC_ALL: "en_US.UTF-8" | |
| BUILD_JDK_VERSION: "21" | |
| jobs: | |
| build: | |
| if: github.repository == 'line/centraldogma' | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 60 | |
| env: | |
| GRADLE_OPTS: -Xmx1280m | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| java: [21] | |
| include: | |
| - java: 8 | |
| os: ubuntu-latest | |
| - java: 11 | |
| os: ubuntu-latest | |
| - java: 17 | |
| os: ubuntu-latest | |
| coverage: true | |
| - java: 17 | |
| os: ubuntu-latest | |
| min-java: 11 | |
| - java: 21 | |
| snapshot: true | |
| os: ubuntu-latest | |
| name: build-${{ matrix.os }}-jdk-${{ matrix.java }}${{ matrix.min-java && format('-min-java-{0}', matrix.min-java) || '' }}${{ matrix.coverage && '-coverage' || ''}}${{ matrix.snapshot && '-snapshot' || ''}} | |
| steps: | |
| - name: Set job name | |
| run: | | |
| JOB_NAME="build-${{ matrix.os }}-jdk-${{ matrix.java }}${{ matrix.min-java && format('-min-java-{0}', matrix.min-java) || '' }}${{ matrix.coverage && '-coverage' || ''}}${{ matrix.snapshot && '-snapshot' || ''}}" | |
| echo "JOB_NAME=$JOB_NAME" >> $GITHUB_ENV | |
| shell: bash | |
| - uses: actions/checkout@v4 | |
| - id: setup-build-jdk | |
| name: Set up build JDK ${{ env.BUILD_JDK_VERSION }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{ env.BUILD_JDK_VERSION }} | |
| - id: setup-test-jdk | |
| if: ${{ matrix.java != env.BUILD_JDK_VERSION }} | |
| name: Set up test JDK ${{ matrix.java }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{ matrix.java }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Build with Gradle | |
| run: | | |
| ./gradlew --no-daemon --stacktrace -Pleak -PnoLint build \ | |
| ${{ matrix.coverage && '-Pcoverage' || '' }} \ | |
| -PflakyTests=false \ | |
| -PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \ | |
| -PtestJavaVersion=${{ matrix.java }} \ | |
| ${{ matrix.min-java && format('-PminimumJavaVersion={0}', matrix.min-java) || '' }} \ | |
| -Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-test-jdk.outputs.path }} | |
| shell: bash | |
| - if: ${{ matrix.snapshot && github.ref_name == 'main' }} | |
| name: Publish snapshots | |
| run: | | |
| ./gradlew --no-daemon --stacktrace --max-workers=1 publish | |
| env: | |
| # Should not use '-P' option with 'secrets' that can cause unexpected results | |
| # if secret values contains white spaces or new lines. | |
| ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USER_NAME }} | |
| ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }} | |
| shell: bash | |
| - name: Summarize the failed tests | |
| if: failure() | |
| run: | | |
| ./gradlew --no-daemon --stacktrace --max-workers=1 reportFailedTests \ | |
| -PnoLint \ | |
| -PflakyTests=false \ | |
| -PbuildJdkVersion=${{ env.BUILD_JDK_VERSION }} \ | |
| -PtestJavaVersion=${{ matrix.java }} \ | |
| ${{ matrix.min-java && format('-PminimumJavaVersion={0}', matrix.min-java) || '' }} \ | |
| -Porg.gradle.java.installations.paths=${{ steps.setup-build-jdk.outputs.path }},${{ steps.setup-jdk.outputs.path }} | |
| SUMMARY_FILE="build/failed-tests-result.txt" | |
| if test -f "$SUMMARY_FILE"; then | |
| echo '### 🔴 Failed tests' >> $GITHUB_STEP_SUMMARY | |
| cat $SUMMARY_FILE >> $GITHUB_STEP_SUMMARY | |
| fi | |
| shell: bash | |
| - name: Dump stuck threads | |
| if: always() | |
| run: jps | grep -iv "jps" | grep -v 'Daemon' | awk '{ print $1 }' | xargs -I'{}' jstack -l {} || true | |
| shell: bash | |
| - name: Upload coverage to Codecov | |
| if: ${{ matrix.coverage }} | |
| uses: codecov/codecov-action@v3 | |
| - name: Collect the test reports | |
| if: failure() | |
| run: | | |
| find . '(' \ | |
| -name 'java_pid*.hprof' -or \ | |
| -name 'hs_err_*.log' -or \ | |
| -path '*/build/reports/tests' -or \ | |
| -path '*/build/test-results' -or \ | |
| -path '*/javadoc.options' ')' \ | |
| -exec tar rf "reports-${{ env.JOB_NAME }}.tar" {} ';' | |
| shell: bash | |
| - name: Upload Artifact | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: reports-${{ env.JOB_NAME }} | |
| path: reports-${{ env.JOB_NAME }}.tar | |
| retention-days: 3 | |
| lint: | |
| if: github.repository == 'line/centraldogma' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| env: | |
| GRADLE_OPTS: -Xmx1280m | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: setup-jdk | |
| name: Set up JDK ${{ env.BUILD_JDK_VERSION }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{ env.BUILD_JDK_VERSION }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Build with Gradle | |
| run: | | |
| ./gradlew --no-daemon --stacktrace lint | |
| shell: bash | |
| flaky-tests: | |
| if: github.repository == 'line/centraldogma' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| env: | |
| GRADLE_OPTS: -Xmx1280m | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: setup-jdk | |
| name: Set up JDK ${{ env.BUILD_JDK_VERSION }} | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: ${{ env.BUILD_JDK_VERSION }} | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v5 | |
| - name: Run flaky tests | |
| run: | | |
| ./gradlew --no-daemon --stacktrace check -PnoLint -PflakyTests=true | |
| shell: bash |