Skip to content

Commit 77bf110

Browse files
committed
Generate test reports on the CI
1 parent 694877c commit 77bf110

File tree

2 files changed

+190
-0
lines changed

2 files changed

+190
-0
lines changed

.github/workflows/ci.yml

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ jobs:
4141
run: ./mill -i __.compile
4242
- name: Unit tests
4343
run: ./mill -i unitTests
44+
- name: Convert Mill test reports to JUnit XML format
45+
run: .github/scripts/generate-junit-reports.sc unit-tests 'Scala CLI Unit Tests' test-report.xml out/
46+
- name: Upload test report
47+
uses: actions/upload-artifact@v3
48+
if: success() || failure()
49+
with:
50+
name: test-results-unit-tests
51+
path: test-report.xml
4452

4553
jvm-tests-1:
4654
timeout-minutes: 120
@@ -59,6 +67,14 @@ jobs:
5967
SCALA_CLI_IT_GROUP: 1
6068
- name: Fat jar integration test
6169
run: ./mill integration.test.jvmBootstrapped 'scala.cli.integration.StandaloneLauncherTests.*'
70+
- name: Convert Mill test reports to JUnit XML format
71+
run: .github/scripts/generate-junit-reports.sc jvm-tests-1 'Scala CLI JVM Tests (1)' test-report.xml out/
72+
- name: Upload test report
73+
uses: actions/upload-artifact@v3
74+
if: success() || failure()
75+
with:
76+
name: test-results-jvm-tests-1
77+
path: test-report.xml
6278

6379
jvm-tests-2:
6480
timeout-minutes: 120
@@ -75,6 +91,14 @@ jobs:
7591
run: ./mill -i integration.test.jvm
7692
env:
7793
SCALA_CLI_IT_GROUP: 2
94+
- name: Convert Mill test reports to JUnit XML format
95+
run: .github/scripts/generate-junit-reports.sc jvm-tests-2 'Scala CLI JVM Tests (2)' test-report.xml out/
96+
- name: Upload test report
97+
uses: actions/upload-artifact@v3
98+
if: success() || failure()
99+
with:
100+
name: test-results-jvm-tests-2
101+
path: test-report.xml
78102

79103
jvm-tests-3:
80104
timeout-minutes: 120
@@ -91,6 +115,14 @@ jobs:
91115
run: ./mill -i integration.test.jvm
92116
env:
93117
SCALA_CLI_IT_GROUP: 3
118+
- name: Convert Mill test reports to JUnit XML format
119+
run: .github/scripts/generate-junit-reports.sc jvm-tests-3 'Scala CLI JVM Tests (3)' test-report.xml out/
120+
- name: Upload test report
121+
uses: actions/upload-artifact@v3
122+
if: success() || failure()
123+
with:
124+
name: test-results-jvm-tests-3
125+
path: test-report.xml
94126

95127
generate-linux-launcher:
96128
timeout-minutes: 120
@@ -141,6 +173,14 @@ jobs:
141173
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
142174
SCALA_CLI_IT_GROUP: 1
143175
SCALA_CLI_SODIUM_JNI_ALLOW: false
176+
- name: Convert Mill test reports to JUnit XML format
177+
run: .github/scripts/generate-junit-reports.sc linux-tests-1 'Scala CLI Linux Tests (1)' test-report.xml out/
178+
- name: Upload test report
179+
uses: actions/upload-artifact@v3
180+
if: success() || failure()
181+
with:
182+
name: test-results-linux-tests-1
183+
path: test-report.xml
144184

145185
native-linux-tests-2:
146186
needs: generate-linux-launcher
@@ -165,6 +205,14 @@ jobs:
165205
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
166206
SCALA_CLI_IT_GROUP: 2
167207
SCALA_CLI_SODIUM_JNI_ALLOW: false
208+
- name: Convert Mill test reports to JUnit XML format
209+
run: .github/scripts/generate-junit-reports.sc linux-tests-2 'Scala CLI Linux Tests (2)' test-report.xml out/
210+
- name: Upload test report
211+
uses: actions/upload-artifact@v3
212+
if: success() || failure()
213+
with:
214+
name: test-results-linux-tests-2
215+
path: test-report.xml
168216

169217
native-linux-tests-3:
170218
needs: generate-linux-launcher
@@ -189,6 +237,14 @@ jobs:
189237
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
190238
SCALA_CLI_IT_GROUP: 3
191239
SCALA_CLI_SODIUM_JNI_ALLOW: false
240+
- name: Convert Mill test reports to JUnit XML format
241+
run: .github/scripts/generate-junit-reports.sc linux-tests-3 'Scala CLI Linux Tests (3)' test-report.xml out/
242+
- name: Upload test report
243+
uses: actions/upload-artifact@v3
244+
if: success() || failure()
245+
with:
246+
name: test-results-linux-tests-3
247+
path: test-report.xml
192248

193249
generate-linux-arm64-native-launcher:
194250
runs-on: "macOS-m1"
@@ -262,6 +318,14 @@ jobs:
262318
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
263319
SCALA_CLI_IT_GROUP: 1
264320
SCALA_CLI_SODIUM_JNI_ALLOW: false
321+
- name: Convert Mill test reports to JUnit XML format
322+
run: .github/scripts/generate-junit-reports.sc macos-tests-1 'Scala CLI MacOS Tests (1)' test-report.xml out/
323+
- name: Upload test report
324+
uses: actions/upload-artifact@v3
325+
if: success() || failure()
326+
with:
327+
name: test-results-macos-tests-1
328+
path: test-report.xml
265329

266330
native-macos-tests-2:
267331
needs: generate-macos-launcher
@@ -286,6 +350,14 @@ jobs:
286350
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
287351
SCALA_CLI_IT_GROUP: 2
288352
SCALA_CLI_SODIUM_JNI_ALLOW: false
353+
- name: Convert Mill test reports to JUnit XML format
354+
run: .github/scripts/generate-junit-reports.sc macos-tests-2 'Scala CLI MacOS Tests (2)' test-report.xml out/
355+
- name: Upload test report
356+
uses: actions/upload-artifact@v3
357+
if: success() || failure()
358+
with:
359+
name: test-results-macos-tests-2
360+
path: test-report.xml
289361

290362
native-macos-tests-3:
291363
needs: generate-macos-launcher
@@ -310,6 +382,14 @@ jobs:
310382
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
311383
SCALA_CLI_IT_GROUP: 3
312384
SCALA_CLI_SODIUM_JNI_ALLOW: false
385+
- name: Convert Mill test reports to JUnit XML format
386+
run: .github/scripts/generate-junit-reports.sc macos-tests-3 'Scala CLI MacOS Tests (3)' test-report.xml out/
387+
- name: Upload test report
388+
uses: actions/upload-artifact@v3
389+
if: success() || failure()
390+
with:
391+
name: test-results-macos-tests-3
392+
path: test-report.xml
313393

314394
generate-macos-m1-launcher:
315395
timeout-minutes: 120
@@ -363,6 +443,14 @@ jobs:
363443
UPDATE_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
364444
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
365445
SCALA_CLI_SODIUM_JNI_ALLOW: false
446+
- name: Convert Mill test reports to JUnit XML format
447+
run: .github/scripts/generate-junit-reports.sc macos-m1-tests 'Scala CLI MacOS M1 Tests' test-report.xml out/
448+
- name: Upload test report
449+
uses: actions/upload-artifact@v3
450+
if: success() || failure()
451+
with:
452+
name: test-results-macos-m1-tests
453+
path: test-report.xml
366454

367455
generate-windows-launcher:
368456
timeout-minutes: 120
@@ -426,6 +514,14 @@ jobs:
426514
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
427515
SCALA_CLI_IT_GROUP: 1
428516
SCALA_CLI_SODIUM_JNI_ALLOW: false
517+
- name: Convert Mill test reports to JUnit XML format
518+
run: scala-cli shebang .github/scripts/generate-junit-reports.sc windows-tests-1 'Scala CLI Windows Tests (1)' test-report.xml out/
519+
- name: Upload test report
520+
uses: actions/upload-artifact@v3
521+
if: success() || failure()
522+
with:
523+
name: test-results-windows-tests-1
524+
path: test-report.xml
429525

430526
native-windows-tests-2:
431527
needs: generate-windows-launcher
@@ -458,6 +554,14 @@ jobs:
458554
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
459555
SCALA_CLI_IT_GROUP: 2
460556
SCALA_CLI_SODIUM_JNI_ALLOW: false
557+
- name: Convert Mill test reports to JUnit XML format
558+
run: scala-cli shebang .github/scripts/generate-junit-reports.sc windows-tests-2 'Scala CLI Windows Tests (2)' test-report.xml out/
559+
- name: Upload test report
560+
uses: actions/upload-artifact@v3
561+
if: success() || failure()
562+
with:
563+
name: test-results-windows-tests-2
564+
path: test-report.xml
461565

462566
native-windows-tests-3:
463567
needs: generate-windows-launcher
@@ -490,6 +594,14 @@ jobs:
490594
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
491595
SCALA_CLI_IT_GROUP: 3
492596
SCALA_CLI_SODIUM_JNI_ALLOW: false
597+
- name: Convert Mill test reports to JUnit XML format
598+
run: scala-cli shebang .github/scripts/generate-junit-reports.sc windows-tests-3 'Scala CLI Windows Tests (3)' test-report.xml out/
599+
- name: Upload test report
600+
uses: actions/upload-artifact@v3
601+
if: success() || failure()
602+
with:
603+
name: test-results-windows-tests-3
604+
path: test-report.xml
493605

494606
generate-mostly-static-launcher:
495607
timeout-minutes: 120
@@ -541,6 +653,14 @@ jobs:
541653
SCALA_CLI_SODIUM_JNI_ALLOW: false
542654
- name: Docker integration tests
543655
run: ./mill integration.docker-slim.test
656+
- name: Convert Mill test reports to JUnit XML format
657+
run: .github/scripts/generate-junit-reports.sc native-mostly-static-tests-1 'Scala CLI Native Mostly Static Tests (1)' test-report.xml out/
658+
- name: Upload test report
659+
uses: actions/upload-artifact@v3
660+
if: success() || failure()
661+
with:
662+
name: test-results-native-mostly-static-tests-1
663+
path: test-report.xml
544664
- name: Login to GitHub Container Registry
545665
if: startsWith(github.ref, 'refs/tags/v')
546666
uses: docker/login-action@v3
@@ -574,6 +694,14 @@ jobs:
574694
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
575695
SCALA_CLI_IT_GROUP: 2
576696
SCALA_CLI_SODIUM_JNI_ALLOW: false
697+
- name: Convert Mill test reports to JUnit XML format
698+
run: .github/scripts/generate-junit-reports.sc native-mostly-static-tests-2 'Scala CLI Native Mostly Static Tests (2)' test-report.xml out/
699+
- name: Upload test report
700+
uses: actions/upload-artifact@v3
701+
if: success() || failure()
702+
with:
703+
name: test-results-native-mostly-static-tests-2
704+
path: test-report.xml
577705

578706
native-mostly-static-tests-3:
579707
needs: generate-mostly-static-launcher
@@ -598,6 +726,14 @@ jobs:
598726
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
599727
SCALA_CLI_IT_GROUP: 3
600728
SCALA_CLI_SODIUM_JNI_ALLOW: false
729+
- name: Convert Mill test reports to JUnit XML format
730+
run: .github/scripts/generate-junit-reports.sc native-mostly-static-tests-3 'Scala CLI Native Mostly Static Tests (3)' test-report.xml out/
731+
- name: Upload test report
732+
uses: actions/upload-artifact@v3
733+
if: success() || failure()
734+
with:
735+
name: test-results-native-mostly-static-tests-3
736+
path: test-report.xml
601737

602738
generate-static-launcher:
603739
timeout-minutes: 120
@@ -649,6 +785,14 @@ jobs:
649785
SCALA_CLI_SODIUM_JNI_ALLOW: false
650786
- name: Docker integration tests
651787
run: ./mill integration.docker.test
788+
- name: Convert Mill test reports to JUnit XML format
789+
run: .github/scripts/generate-junit-reports.sc native-static-tests-1 'Scala CLI Native Static Tests (1)' test-report.xml out/
790+
- name: Upload test report
791+
uses: actions/upload-artifact@v3
792+
if: success() || failure()
793+
with:
794+
name: test-results-native-static-tests-1
795+
path: test-report.xml
652796
- name: Login to GitHub Container Registry
653797
if: startsWith(github.ref, 'refs/tags/v')
654798
uses: docker/login-action@v3
@@ -684,6 +828,14 @@ jobs:
684828
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
685829
SCALA_CLI_IT_GROUP: 2
686830
SCALA_CLI_SODIUM_JNI_ALLOW: false
831+
- name: Convert Mill test reports to JUnit XML format
832+
run: .github/scripts/generate-junit-reports.sc native-static-tests-2 'Scala CLI Native Static Tests (2)' test-report.xml out/
833+
- name: Upload test report
834+
uses: actions/upload-artifact@v3
835+
if: success() || failure()
836+
with:
837+
name: test-results-native-static-tests-2
838+
path: test-report.xml
687839

688840
native-static-tests-3:
689841
needs: generate-static-launcher
@@ -710,6 +862,14 @@ jobs:
710862
SCALA_CLI_IT_FORCED_LAUNCHER_DIRECTORY: artifacts/
711863
SCALA_CLI_IT_GROUP: 3
712864
SCALA_CLI_SODIUM_JNI_ALLOW: false
865+
- name: Convert Mill test reports to JUnit XML format
866+
run: .github/scripts/generate-junit-reports.sc native-static-tests-3 'Scala CLI Native Static Tests (3)' test-report.xml out/
867+
- name: Upload test report
868+
uses: actions/upload-artifact@v3
869+
if: success() || failure()
870+
with:
871+
name: test-results-native-static-tests-3
872+
path: test-report.xml
713873

714874
docs-tests:
715875
# for now, let's run those tests only on ubuntu
@@ -729,6 +889,14 @@ jobs:
729889
run: .github/scripts/build-website.sh
730890
- name: Test documentation
731891
run: ./mill -i docs-tests.test
892+
- name: Convert Mill test reports to JUnit XML format
893+
run: .github/scripts/generate-junit-reports.sc docs-tests 'Scala CLI Docs Tests' test-report.xml out/
894+
- name: Upload test report
895+
uses: actions/upload-artifact@v3
896+
if: success() || failure()
897+
with:
898+
name: test-results-docs-tests
899+
path: test-report.xml
732900

733901
checks:
734902
timeout-minutes: 15

.github/workflows/test-report.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: 'Test Report'
2+
on:
3+
workflow_run:
4+
workflows: ['CI']
5+
types:
6+
- completed
7+
permissions:
8+
statuses: write
9+
checks: write
10+
contents: write
11+
pull-requests: write
12+
actions: write
13+
jobs:
14+
report:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: dorny/test-reporter@v1
18+
with:
19+
artifact: /test-results-(.*)/
20+
name: 'Test report $1'
21+
path: '*.xml'
22+
reporter: java-junit

0 commit comments

Comments
 (0)