@@ -47,36 +47,35 @@ jobs:
4747 ")
4848 echo "COVERAGE_PERCENT=$percentage" >> "$GITHUB_OUTPUT"
4949
50- - name : Parse JUnit Results for Summary
50+ - name : Parse Merged JUnit Results for Summary (only merged-results.xml)
5151 id : junit-summary
5252 run : |
5353 summary=$(poetry run python -c "
5454 import xml.etree.ElementTree as ET
55- import glob
55+
56+ tree = ET.parse('test-results/merged-results.xml')
57+ root = tree.getroot()
58+
59+ # 'testsuites' 또는 'testsuite'에 따라 동작 다름 (방어코드)
60+ if root.tag == 'testsuites':
61+ suites = root.findall('testsuite')
62+ elif root.tag == 'testsuite':
63+ suites = [root]
64+ else:
65+ raise ValueError(f'Unexpected root tag: {root.tag}')
5666
5767 total_tests = 0
5868 total_failures = 0
5969 total_skipped = 0
6070 total_errors = 0
6171 total_time = 0.0
6272
63- for file in glob.glob('test-results/*.xml'):
64- tree = ET.parse(file)
65- root = tree.getroot()
66-
67- if root.tag == 'testsuites':
68- suites = root.findall('testsuite')
69- elif root.tag == 'testsuite':
70- suites = [root]
71- else:
72- raise ValueError(f'Unexpected root tag: {root.tag}')
73-
74- for suite in suites:
75- total_tests += int(suite.attrib.get('tests', 0))
76- total_failures += int(suite.attrib.get('failures', 0))
77- total_skipped += int(suite.attrib.get('skipped', 0))
78- total_errors += int(suite.attrib.get('errors', 0))
79- total_time += float(suite.attrib.get('time', 0))
73+ for suite in suites:
74+ total_tests += int(suite.attrib.get('tests', 0))
75+ total_failures += int(suite.attrib.get('failures', 0))
76+ total_skipped += int(suite.attrib.get('skipped', 0))
77+ total_errors += int(suite.attrib.get('errors', 0))
78+ total_time += float(suite.attrib.get('time', 0))
8079
8180 passed = total_tests - total_failures - total_skipped
8281 print(f'PASSED={passed}')
@@ -87,10 +86,10 @@ jobs:
8786
8887 echo "$summary" >> "$GITHUB_OUTPUT"
8988
90- - name : Publish Test Results Summary (optional)
89+ - name : Publish Merged Test Results Summary
9190 uses : test-summary/action@v2
9291 with :
93- paths : " test-results/* .xml"
92+ paths : " test-results/merged-results .xml"
9493 if : always()
9594
9695 - name : Upload Coverage HTML Report
9998 name : coverage-html
10099 path : htmlcov/
101100
102- - name : Upload JUnit XML (for archive)
101+ - name : Upload All JUnit XML Files (for archive)
103102 uses : actions/upload-artifact@v4
104103 with :
105104 name : junit-xml-reports
0 commit comments