build #1329
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
# This name is shown in the status badge in the README | |
name: build | |
on: | |
push: | |
branches-ignore: | |
- 'tmp**' | |
pull_request: | |
branches-ignore: | |
- 'tmp**' | |
schedule: | |
# Run once a week to check compatibility with new versions of dependencies | |
- cron: '0 0 * * 1' | |
jobs: | |
test: | |
name: JDK ${{ matrix.java }} ${{ matrix.distribution }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [8, 11, 17, 18] | |
distribution: [temurin] | |
include: | |
- java: 17 | |
distribution: zulu | |
- java: 17 | |
distribution: microsoft | |
outputs: | |
report-java: 17 | |
report-dist: temurin | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: ${{ matrix.distribution }} | |
- name: Compile libraries and tests | |
run: ./gradlew clean testClasses | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: ${{ matrix.distribution }} | |
- name: Run tests against JDK17-compiled code | |
run: ./gradlew test --exclude-task compileJava | |
- name: Archive HTML test report on failure | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports-java17-java${{ matrix.java }}-${{ matrix.distribution }}-html | |
path: "*/build/reports/**" | |
- name: Build and test with JDK ${{ matrix.java }} | |
run: ./gradlew clean test | |
- name: Build archives | |
run: ./gradlew assemble | |
- name: Archive HTML test report | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports-java${{ matrix.java }}-${{ matrix.distribution }}-html | |
path: "*/build/reports/**" | |
- name: Archive JUnit test report | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports-java${{ matrix.java }}-${{ matrix.distribution }}-xml | |
path: "*/build/test-results/**/*.xml" | |
- name: Check binary reproducibility | |
if: ${{ matrix.java != 8 }} # JDK 8 does not produce reproducible binaries | |
run: | | |
./gradlew clean primaryPublishJar | |
find . -name '*.jar' | xargs sha256sum | tee checksums.sha256sum | |
./gradlew clean primaryPublishJar && sha256sum -c checksums.sha256sum | |
./gradlew clean primaryPublishJar && sha256sum -c checksums.sha256sum | |
publish-test-results: | |
name: Publish test results | |
needs: test | |
runs-on: ubuntu-latest | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: test-reports-java${{ needs.test.outputs.report-java }}-${{ needs.test.outputs.report-dist }}-xml | |
- name: Publish test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: "**/*.xml" |