Skip to content

Commit 4151bfa

Browse files
authored
4.x: Report back test failures in a readable manner for PRs/Snaps (#8066)
* 4.x: Report back test failures in a readable manner for PRs/Snaps * gradle_pr.yml `test_failures` -> `test failures`
1 parent 192f71c commit 4151bfa

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.github/workflows/gradle_pr.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@ jobs:
3333
run: ./gradlew test --tests "io.reactivex.rxjava4.validators.*" --stacktrace --no-daemon
3434
- name: Build RxJava
3535
run: ./gradlew build --stacktrace
36+
37+
- name: Publish Test Results
38+
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2.23.0
39+
if: always() # important: run even if tests failed
40+
with:
41+
files: |
42+
**/build/test-results/**/TEST-*.xml
43+
**/build/test-results/**/*.xml
44+
**/build/test-results/testNG/TEST-*.xml
45+
comment_mode: failures
46+
fail_on: test failures
47+
check_name: "🧪 RxJava Test Results"
48+
report_individual_runs: false
49+
3650
- name: Upload to Codecov
3751
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
3852
- name: Generate Javadoc

.github/workflows/gradle_snapshot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ jobs:
3636
run: ./gradlew test --tests "io.reactivex.rxjava4.validators.*" --stacktrace --no-daemon
3737
- name: Build RxJava
3838
run: ./gradlew build --stacktrace --no-daemon
39+
40+
- name: Publish Test Results
41+
uses: EnricoMi/publish-unit-test-result-action@c950f6fb443cb5af20a377fd0dfaa78838901040 # v2.23.0
42+
if: always() # important: run even if tests failed
43+
with:
44+
files: |
45+
**/build/test-results/**/TEST-*.xml
46+
**/build/test-results/**/*.xml
47+
**/build/test-results/testNG/TEST-*.xml
48+
comment_mode: failures
49+
fail_on: test_failures
50+
check_name: "🧪 RxJava Test Results"
51+
report_individual_runs: false
52+
3953
prerelease:
4054
needs: build
4155
runs-on: ubuntu-latest

build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ tasks.register('testNG', Test) {
194194

195195
maxParallelForks = 1
196196

197+
// Ensure JUnit-compatible XML output in the standard location
198+
reports {
199+
html.required = true
200+
junitXml.required = true
201+
junitXml.outputLocation = file("${buildDir}/test-results/test") // ← important
202+
}
203+
197204
// Optional: fine-tune includes/excludes
198205
// include '**/*NgTest.class', '**/*TestNG.class'
199206
// exclude '**/*JUnitTest.class'
@@ -212,8 +219,6 @@ tasks.register('testNG', Test) {
212219
warn.events = testLoggingConfig
213220
warn.exceptionFormat = "full"
214221
}
215-
reports.html.required = true
216-
reports.junitXml.required = true // if you want JUnit-compatible XML too
217222
}
218223

219224
check.dependsOn testNG

0 commit comments

Comments
 (0)