create and upload individual and combined junit reports (#16149)

* create and upload individual and combined junit reports

* sudo

* debug

* fixup

* fixup

* data vs. results

* debug

* pretty format xml

* try again on formatting

* Update test.yml

* blah

* yq

* again

* swap

* Revert "debug"

This reverts commit ea6f7447c3.

* Revert "debug"

This reverts commit e0d1f64d33.

* tidy
This commit is contained in:
Kyle Altendorf 2023-08-25 14:12:50 -04:00 committed by GitHub
parent 0dde80b89a
commit 0c525f6169
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 1 deletions

View File

@ -221,12 +221,19 @@ jobs:
env:
ENABLE_PYTEST_MONITOR: ${{ matrix.os.matrix == 'ubuntu' && matrix.configuration.enable_pytest_monitor || '' }}
run: |
pytest --cov=chia --cov=tests --cov-config=.coveragerc --cov-report= --durations=10 ${{ matrix.configuration.pytest_parallel_args[matrix.os.matrix] }} -m "not benchmark" ${{ env.ENABLE_PYTEST_MONITOR }} ${{ matrix.configuration.test_files }}
pytest --cov=chia --cov=tests --cov-config=.coveragerc --cov-report= -o 'junit_suite_name=${{ env.JOB_FILE_NAME }}' --junitxml=junit-data/junit.${{ env.JOB_FILE_NAME }}.xml --durations=10 ${{ matrix.configuration.pytest_parallel_args[matrix.os.matrix] }} -m "not benchmark" ${{ env.ENABLE_PYTEST_MONITOR }} ${{ matrix.configuration.test_files }}
- name: Move back to chia/ for coverage
run: |
mv notchia/ chia/
- name: Publish JUnit results
uses: actions/upload-artifact@v3
with:
name: junit-data
path: junit-data/*
if-no-files-found: error
- name: Process coverage data
run: |
coverage xml --rcfile=.coveragerc -o coverage.xml

View File

@ -116,6 +116,37 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download Results
uses: actions/download-artifact@v3
with:
name: junit-data
path: junit-data
- name: Format JUnit data and prepare results
run: |
sudo snap install yq
ls junit-data/*.xml | xargs --max-procs=10 --replace={} yq eval '.testsuites.testsuite.testcase |= sort_by(.+@classname, .+@name)' --inplace {}
sudo apt-get install junitparser
mkdir junit-results
junitparser merge junit-data/*.xml junit-results/junit.xml
ls junit-results/*.xml | xargs --max-procs=10 --replace={} yq eval '.testsuites.testsuite |= sort_by(.+@name) | .testsuites.testsuite[].testcase |= sort_by(.+@classname, .+@name)' --inplace {}
- name: Publish formatted JUnit data
uses: actions/upload-artifact@v3
with:
name: junit-data
path: junit-data/*
if-no-files-found: error
- name: Publish JUnit results
if: always()
uses: actions/upload-artifact@v3
with:
name: junit-results
path: junit-results/*
if-no-files-found: error
- name: Download Coverage
uses: actions/download-artifact@v3
with: