Skip to content

Commit dee2e39

Browse files
committed
build:ci: remove external test report
1 parent 0a18045 commit dee2e39

1 file changed

Lines changed: 64 additions & 5 deletions

File tree

.github/workflows/full-build.yml

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,68 @@ jobs:
3333
run: mvn -B install -P gradlePlugin --no-transfer-progress
3434
env:
3535
BUILD_LOG_LEVEL: 'ERROR'
36-
- name: Tests
37-
uses: mikepenz/action-junit-report@v5
36+
- name: 📊 Test Report
3837
if: always()
39-
with:
40-
check_name: Test ${{ matrix.os }} ${{ matrix.java-version }}
41-
report_paths: '*/target/*/TEST-*.xml'
38+
run: |
39+
echo "## 🧪 Test Summary (${{ matrix.os }} - Java ${{ matrix.java-version }})" >> $GITHUB_STEP_SUMMARY
40+
41+
# Use Python to safely parse the JUnit XML files and write to the summary
42+
python3 -c '
43+
import xml.etree.ElementTree as ET
44+
import glob, os
45+
46+
# Find all JUnit XML reports
47+
files = glob.glob("**/target/**/TEST-*.xml", recursive=True)
48+
49+
tests, failures, errors, skipped = 0, 0, 0, 0
50+
failed_tests = set()
51+
52+
for f in files:
53+
try:
54+
tree = ET.parse(f)
55+
root = tree.getroot()
56+
57+
# Handle both <testsuite> and <testsuites> root elements
58+
suites = [root] if root.tag == "testsuite" else root.findall(".//testsuite")
59+
60+
for suite in suites:
61+
tests += int(suite.attrib.get("tests", 0))
62+
failures += int(suite.attrib.get("failures", 0))
63+
errors += int(suite.attrib.get("errors", 0))
64+
skipped += int(suite.attrib.get("skipped", 0))
65+
66+
# Collect names of failing tests
67+
for case in suite.findall("testcase"):
68+
if case.find("failure") is not None or case.find("error") is not None:
69+
# Strip the package path from the classname for a cleaner display
70+
cls = case.attrib.get("classname", "UnknownClass").split(".")[-1]
71+
name = case.attrib.get("name", "UnknownMethod")
72+
failed_tests.add(f"- `{cls}.{name}`")
73+
except Exception as e:
74+
print(f"Error parsing {f}: {e}")
75+
76+
passed = tests - failures - errors - skipped
77+
summary_file = os.environ.get("GITHUB_STEP_SUMMARY")
78+
79+
with open(summary_file, "a") as f:
80+
if not files:
81+
f.write("⚠️ **Could not find any `TEST-*.xml` files.**\n")
82+
else:
83+
# Draw the Markdown Table
84+
f.write("| Result | Count |\n")
85+
f.write("|--------|-------|\n")
86+
f.write(f"| ✅ **Passed** | **{passed}** |\n")
87+
f.write(f"| ❌ **Failed/Errors** | **{failures + errors}** |\n")
88+
f.write(f"| ⚠️ **Skipped** | **{skipped}** |\n")
89+
f.write(f"| 📊 **Total Tests** | **{tests}** |\n\n")
90+
91+
# Provide specific feedback for failures
92+
if failures > 0 or errors > 0:
93+
f.write("### 🚨 Test Failures Detected!\n")
94+
f.write("The following tests did not pass:\n")
95+
for test in sorted(failed_tests):
96+
f.write(f"{test}\n")
97+
else:
98+
f.write("### 🎉 100% Pass Rate!\n")
99+
f.write(f"The build is green across all {tests} tests.\n")
100+
'

0 commit comments

Comments
 (0)