Skip to content

Commit 87c1f56

Browse files
committed
use some junit methods to report errors more verbosely
publish test results
1 parent a71bb24 commit 87c1f56

4 files changed

Lines changed: 196 additions & 60 deletions

File tree

.github/workflows/java-all-versions.yml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Java 8, 11, 17, 21 CI
22

3-
on: [push,pull_request]
3+
on: [ push,pull_request ]
44

55
jobs:
66
build:
@@ -17,13 +17,51 @@ jobs:
1717
11
1818
17
1919
21
20+
2021
- name: Build with Gradle
2122
run: ./gradlew assemble
23+
2224
- name: Test with Java 8
25+
id: test_java8
2326
run: ./gradlew test -PtestOnJava=8 --stacktrace
27+
28+
- uses: actions/upload-artifact@v4 # upload test results if the test was not skipped
29+
if: ${{ !cancelled() && steps.test_java8.outcome != 'skipped'}}
30+
with:
31+
name: test-results-j8
32+
path: '*/build/test-results/**/*.xml'
33+
overwrite: 'true'
34+
2435
- name: Test with Java 11
36+
id: test_java11
2537
run: ./gradlew test -PtestOnJava=11 --stacktrace
38+
39+
- uses: actions/upload-artifact@v4 # upload test results if the test was not skipped
40+
if: ${{ !cancelled() && steps.test_java11.outcome != 'skipped'}}
41+
with:
42+
name: test-results-j11
43+
path: '*/build/test-results/**/*.xml'
44+
overwrite: 'true'
45+
2646
- name: Test with Java 17
47+
id: test_java17
2748
run: ./gradlew test -PtestOnJava=17 --stacktrace
49+
50+
- uses: actions/upload-artifact@v4 # upload test results if the test was not skipped
51+
if: ${{ !cancelled() && steps.test_java17.outcome != 'skipped'}}
52+
with:
53+
name: test-results-j17
54+
path: '*/build/test-results/**/*.xml'
55+
overwrite: 'true'
56+
2857
- name: Test with Java 21
58+
id: test_java21
2959
run: ./gradlew test -PtestOnJava=21 --stacktrace
60+
61+
- uses: actions/upload-artifact@v4 # upload test results if the test was not skipped
62+
if: ${{ !cancelled() && steps.test_java21.outcome != 'skipped'}}
63+
with:
64+
name: test-results-j21
65+
path: '*/build/test-results/**/*.xml'
66+
overwrite: 'true'
67+

.github/workflows/macos.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,18 @@ jobs:
1313
with:
1414
distribution: 'temurin'
1515
java-version: 11
16+
1617
- name: Build with Gradle
1718
run: ./gradlew assemble
19+
1820
- name: Test with Gradle
19-
run: ./gradlew test
21+
id: test_macos_java11
22+
run: ./gradlew test
23+
24+
- uses: actions/upload-artifact@v4 # upload test results if the test was not skipped
25+
if: ${{ !cancelled() && steps.test_macos_java11.outcome != 'skipped'}}
26+
with:
27+
name: test-results-macos-j11
28+
path: '*/build/test-results/**/*.xml'
29+
overwrite: 'true'
30+
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: 'Test Report'
2+
on:
3+
workflow_run:
4+
workflows: ['Java 8, 11, 17, 21 CI', 'Java 11 CI macOS (Apple)'] # runs after CI workflow
5+
types:
6+
- completed
7+
permissions:
8+
contents: read
9+
actions: read
10+
checks: write
11+
jobs:
12+
report:
13+
runs-on: ubuntu-latest
14+
if: always()
15+
steps:
16+
- name: Check for test-results-j8 artifact
17+
id: check_j8
18+
uses: actions/download-artifact@v4
19+
with:
20+
name: test-results-j8
21+
path: temp-j8
22+
continue-on-error: true
23+
24+
- name: Check for test-results-j11 artifact
25+
id: check_j11
26+
uses: actions/download-artifact@v4
27+
with:
28+
name: test-results-j11
29+
path: temp-j11
30+
continue-on-error: true
31+
32+
- name: Check for test-results-j8 artifact
33+
id: check_j17
34+
uses: actions/download-artifact@v4
35+
with:
36+
name: test-results-j17
37+
path: temp-j17
38+
continue-on-error: true
39+
40+
- name: Check for test-results-j21 artifact
41+
id: check_j21
42+
uses: actions/download-artifact@v4
43+
with:
44+
name: test-results-j21
45+
path: temp-j21
46+
continue-on-error: true
47+
48+
- name: Check for test-results-j21 artifact
49+
id: check__macos_j11
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: test-results-macos-j11
53+
path: temp-macos-j11
54+
continue-on-error: true
55+
56+
- uses: dorny/test-reporter@v1
57+
if: ${{ steps.check_j8.outcome == 'success' }}
58+
with:
59+
artifact: test-results-j8 # artifact name
60+
name: Java 8 Tests # Name of the check run which will be created
61+
path: '*.xml' # Path to test results (inside artifact .zip)
62+
reporter: java-junit # Format of test results
63+
64+
- uses: dorny/test-reporter@v1
65+
if: ${{ steps.check_j11.outcome == 'success' }}
66+
with:
67+
artifact: test-results-j11 # artifact name
68+
name: Java 11 tests # Name of the check run which will be created
69+
path: '*.xml' # Path to test results (inside artifact .zip)
70+
reporter: java-junit # Format of test results
71+
72+
- uses: dorny/test-reporter@v1
73+
if: ${{ steps.check_j17.outcome == 'success' }}
74+
with:
75+
artifact: test-results-j17 # artifact name
76+
name: Java 17 tests # Name of the check run which will be created
77+
path: '*.xml' # Path to test results (inside artifact .zip)
78+
reporter: java-junit # Format of test results
79+
80+
- uses: dorny/test-reporter@v1
81+
if: ${{ steps.check_j21.outcome == 'success' }}
82+
with:
83+
artifact: test-results-j21 # artifact name
84+
name: Java 21 tests # Name of the check run which will be created
85+
path: '*.xml' # Path to test results (inside artifact .zip)
86+
reporter: java-junit # Format of test results
87+
88+
- uses: dorny/test-reporter@v1
89+
if: ${{ steps.check__macos_j11.outcome == 'success' }}
90+
with:
91+
artifact: test-results-macos-j11 # artifact name
92+
name: Java 11 macos tests # Name of the check run which will be created
93+
path: '*.xml' # Path to test results (inside artifact .zip)
94+
reporter: java-junit # Format of test results

0 commit comments

Comments
 (0)