-
Notifications
You must be signed in to change notification settings - Fork 145
110 lines (91 loc) · 3.02 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# 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"