Skip to content

Commit

Permalink
[SPARK-33069][INFRA] Skip test result report if no JUnit XML files ar…
Browse files Browse the repository at this point in the history
…e 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 apache#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 apache#29946 from HyukjinKwon/test-junit-files.

Authored-by: HyukjinKwon <gurwls223@apache.org>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
(cherry picked from commit a0aa8f3)
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
  • Loading branch information
HyukjinKwon authored and dbtsai committed Oct 9, 2020
1 parent f8b3df5 commit 8ac0a94
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/test_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: ${{ github.event.workflow_run.workflow_id }}
commit: ${{ github.event.workflow_run.head_commit.id }}
- name: Check if JUnit report XML files exist
run: |
if ls **/target/test-reports/*.xml > /dev/null 2>&1; then
echo '::set-output name=FILE_EXISTS::true'
else
echo '::set-output name=FILE_EXISTS::false'
fi
id: check-junit-file
- name: Publish test report
if: steps.check-junit-file.outputs.FILE_EXISTS == 'true'
uses: scacap/action-surefire-report@v1
with:
check_name: Report test results
Expand Down

0 comments on commit 8ac0a94

Please sign in to comment.