| name: CI |
| |
| on: |
| push: |
| branches: |
| - '*' |
| pull_request: |
| branches: |
| - '*' |
| |
| # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners |
| |
| concurrency: |
| # On master/release, we don't want any jobs cancelled so the sha is used to name the group |
| # On PR branches, we cancel the job if new commits are pushed |
| # More info: https://stackoverflow.com/a/68422069/253468 |
| group: ${{ (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release' ) && format('ci-main-{0}', github.sha) || format('ci-main-{0}', github.ref) }} |
| cancel-in-progress: true |
| |
| jobs: |
| matrix_prep: |
| name: Matrix Preparation |
| runs-on: ubuntu-latest |
| outputs: |
| matrix: ${{ steps.set-matrix.outputs.matrix }} |
| env: |
| # Number of jobs to generate in matrix.js |
| MATRIX_JOBS: 4 |
| steps: |
| - uses: actions/checkout@v4 |
| - id: set-matrix |
| run: | |
| node .github/workflows/matrix.js |
| |
| test: |
| needs: matrix_prep |
| name: '${{ matrix.name }}' |
| runs-on: ${{ matrix.os }} |
| env: |
| TZ: ${{ matrix.tz }} |
| strategy: |
| matrix: ${{fromJson(needs.matrix_prep.outputs.matrix)}} |
| fail-fast: false |
| # max-parallel: 4 |
| steps: |
| - uses: actions/checkout@v4 |
| with: |
| fetch-depth: 50 |
| - name: Set up Java ${{ matrix.java_version }}, oracle |
| if: ${{ matrix.oracle_java_website != '' }} |
| uses: oracle-actions/setup-java@7a0114d66dbd02646abd345c3395b34c148e6126 # v1.3.2 |
| with: |
| website: ${{ matrix.oracle_java_website }} |
| release: ${{ matrix.java_version }} |
| - name: Set up Java 17 and ${{ matrix.non_ea_java_version }}, ${{ matrix.java_distribution }} |
| uses: actions/setup-java@v3 |
| with: |
| # The latest one will be the default, so we use Java 17 for launching Gradle |
| java-version: | |
| ${{ matrix.non_ea_java_version }} |
| 17 |
| distribution: ${{ matrix.java_distribution }} |
| architecture: x64 |
| - name: Steps to reproduce |
| uses: actions/github-script@v7 |
| with: |
| script: | |
| console.log('The following command might help reproducing CI results, use Java ${{ matrix.java_version }}') |
| console.log('TZ="${{ matrix.tz }}" _JAVA_OPTIONS="${{ matrix.extraJvmArgs }}" ./gradlew build -x distTar -x distTarSource -x distTarSha512 -x distTarSourceSha512 ${{ matrix.extraGradleArgs }} -PtestExtraJvmArgs="${{ matrix.testExtraJvmArgs }}" -PtestDisableCaching="${{ matrix.testDisableCaching }}"') |
| - uses: burrunan/gradle-cache-action@v1 |
| name: Test |
| with: |
| job-id: jdk${{ matrix.java_version }} |
| multi-cache-enabled: false |
| # An explicit skip for Sha512 tasks is required due to https://github.com/gradle/gradle/issues/16789 |
| arguments: --scan --no-parallel build -x distTar -x distTarSource -x distTarSha512 -x distTarSourceSha512 ${{ matrix.extraGradleArgs }} |
| properties: | |
| testExtraJvmArgs=${{ matrix.testExtraJvmArgs }} |
| testDisableCaching=${{ matrix.testDisableCaching }} |
| jdkBuildVersion=17 |
| jdkTestVersion=${{ matrix.java_version }} |
| jdkTestVendor=${{ matrix.java_vendor }} |
| # We provision JDKs with GitHub Actions for caching purposes, so Gradle should rather fail in case JDK is not found |
| org.gradle.java.installations.auto-download=false |
| env: |
| _JAVA_OPTIONS: ${{ matrix.extraJvmArgs }} |
| GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }} |
| |
| errorprone: |
| name: 'Error Prone (JDK 17)' |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v4 |
| - name: 'Set up JDK 17' |
| uses: actions/setup-java@v3 |
| with: |
| java-version: 17 |
| distribution: 'zulu' |
| - uses: burrunan/gradle-cache-action@v1 |
| name: Test |
| with: |
| job-id: errprone |
| multi-cache-enabled: false |
| arguments: --scan --no-parallel --no-daemon -PenableErrorprone classes |
| env: |
| GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }} |