Consolidate per-area reports into testreport.xml for downstream consumers
This commit is contained in:
@@ -163,6 +163,26 @@ jobs:
|
|||||||
done
|
done
|
||||||
exit $fail
|
exit $fail
|
||||||
|
|
||||||
|
- name: Merge per-area reports into testreport.xml
|
||||||
|
# Preserve the single-file JUnit contract that downstream consumers rely on
|
||||||
|
# (pr_tests.yml's summary and generate-reports' Test Report both read testreport.xml).
|
||||||
|
# The per-area split is only for readable logs; the report stays consolidated.
|
||||||
|
if: always() # run even when a chunk failed, so the report captures the failures
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
python3 - <<'PY'
|
||||||
|
import glob, xml.etree.ElementTree as ET
|
||||||
|
out = ET.Element('testsuites')
|
||||||
|
for f in sorted(glob.glob('testreport-*.xml')):
|
||||||
|
try:
|
||||||
|
root = ET.parse(f).getroot()
|
||||||
|
except ET.ParseError:
|
||||||
|
continue
|
||||||
|
# PlatformIO writes a <testsuites> root; fold in a bare <testsuite> too, just in case.
|
||||||
|
out.extend(root.findall('testsuite') if root.tag == 'testsuites' else [root])
|
||||||
|
ET.ElementTree(out).write('testreport.xml', encoding='utf-8', xml_declaration=True)
|
||||||
|
PY
|
||||||
|
|
||||||
- name: Capture coverage information
|
- name: Capture coverage information
|
||||||
if: always() # run this step even if previous step failed
|
if: always() # run this step even if previous step failed
|
||||||
run: |
|
run: |
|
||||||
@@ -176,7 +196,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: platformio-test-report-${{ steps.version.outputs.long }}
|
name: platformio-test-report-${{ steps.version.outputs.long }}
|
||||||
overwrite: true
|
overwrite: true
|
||||||
path: ./testreport-*.xml
|
path: ./testreport.xml
|
||||||
|
|
||||||
- name: Save coverage information
|
- name: Save coverage information
|
||||||
uses: actions/upload-artifact@v7
|
uses: actions/upload-artifact@v7
|
||||||
@@ -215,15 +235,14 @@ jobs:
|
|||||||
# crossed with every hardware variant it cannot run on the native host (~4900 rows).
|
# crossed with every hardware variant it cannot run on the native host (~4900 rows).
|
||||||
# They carry no pass/fail/skip status and bury the suites that actually ran. Strip
|
# They carry no pass/fail/skip status and bury the suites that actually ran. Strip
|
||||||
# them so the Test Report lists only suites with a real status. Only the copy the
|
# them so the Test Report lists only suites with a real status. Only the copy the
|
||||||
# reporter renders is trimmed; the uploaded artifact keeps the full XML. One report
|
# reporter renders is trimmed; the uploaded artifact keeps the full XML.
|
||||||
# per chunk now, so trim each.
|
run: sed -i -E 's#<testsuite [^>]*tests="0"[^>]*/>##g' testreport.xml
|
||||||
run: sed -i -E 's#<testsuite [^>]*tests="0"[^>]*/>##g' testreport-*.xml
|
|
||||||
|
|
||||||
- name: Test Report
|
- name: Test Report
|
||||||
uses: dorny/test-reporter@v3.0.0
|
uses: dorny/test-reporter@v3.0.0
|
||||||
with:
|
with:
|
||||||
name: PlatformIO Tests
|
name: PlatformIO Tests
|
||||||
path: testreport-*.xml
|
path: testreport.xml
|
||||||
reporter: java-junit
|
reporter: java-junit
|
||||||
|
|
||||||
- name: Download coverage artifacts
|
- name: Download coverage artifacts
|
||||||
|
|||||||
Reference in New Issue
Block a user