Skip to content

Commit a0aa8f3

Browse files
committed
[SPARK-33069][INFRA] Skip test result report if no JUnit XML files are found
### What changes were proposed in this pull request? This PR proposes to skip test reporting ("Report test results") if there are no JUnit XML files are found. Currently, we're running and skipping the tests dynamically. For example, - if there are only changes in SparkR at the underlying commit, it only runs the SparkR tests, and skip the other tests and generate JUnit XML files for SparkR test cases. - if there are only changes in `docs` at the underlying commit, the build skips all tests except linters and do not generate any JUnit XML files. When test reporting ("Report test results") job is triggered after the main build ("Build and test ") is finished, and there are no JUnit XML files found, it reports the case as a failure. See https://github.com/apache/spark/runs/1196184007 as an example. This PR works around it by simply skipping the testing report when there are no JUnit XML files are found. Please see #29906 (comment) for more details. ### Why are the changes needed? To avoid false alarm for test results. ### Does this PR introduce _any_ user-facing change? No, dev-only. ### How was this patch tested? Manually tested in my fork. Positive case: https://github.com/HyukjinKwon/spark/runs/1208624679?check_suite_focus=true https://github.com/HyukjinKwon/spark/actions/runs/288996327 Negative case: https://github.com/HyukjinKwon/spark/runs/1208229838?check_suite_focus=true https://github.com/HyukjinKwon/spark/actions/runs/289000058 Closes #29946 from HyukjinKwon/test-junit-files. Authored-by: HyukjinKwon <[email protected]> Signed-off-by: HyukjinKwon <[email protected]>
1 parent 008a2ad commit a0aa8f3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

.github/workflows/test_report.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ jobs:
1515
github_token: ${{ secrets.GITHUB_TOKEN }}
1616
workflow: ${{ github.event.workflow_run.workflow_id }}
1717
commit: ${{ github.event.workflow_run.head_commit.id }}
18+
- name: Check if JUnit report XML files exist
19+
run: |
20+
if ls **/target/test-reports/*.xml > /dev/null 2>&1; then
21+
echo '::set-output name=FILE_EXISTS::true'
22+
else
23+
echo '::set-output name=FILE_EXISTS::false'
24+
fi
25+
id: check-junit-file
1826
- name: Publish test report
27+
if: steps.check-junit-file.outputs.FILE_EXISTS == 'true'
1928
uses: scacap/action-surefire-report@v1
2029
with:
2130
check_name: Report test results

0 commit comments

Comments
 (0)