@@ -44,10 +44,42 @@ jobs:
44
44
run_id : ${{ github.event.workflow_run.id }}
45
45
path : artifacts
46
46
47
- - name : Publish Test Results
48
- uses : EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0
49
- with :
50
- commit : ${{ github.event.workflow_run.head_sha }}
51
- event_file : artifacts/Event File/event.json
52
- event_name : ${{ github.event.workflow_run.event }}
53
- files : " artifacts/**/*.xml"
47
+ - name : Summarize Test Results as Markdown Table
48
+ run : |
49
+ sudo apt-get update -y
50
+ sudo apt-get install -y libxml2-utils
51
+ echo "## Unit Test Results Summary" >> $GITHUB_STEP_SUMMARY
52
+ echo "# This test report is a summary of the test run in workflow run: [${{ steps.set_test_run_url.outputs.test_run_url }}](${{ steps.set_test_run_url.outputs.test_run_url }})" >> $GITHUB_STEP_SUMMARY
53
+ echo "| Test Suite | Tests | Passed | Failed | Skipped | Duration |" >> $GITHUB_STEP_SUMMARY
54
+ echo "|------------|-------|--------|--------|---------|----------|" >> $GITHUB_STEP_SUMMARY
55
+ total_tests=0
56
+ total_passed=0
57
+ total_failed=0
58
+ total_skipped=0
59
+ total_duration=0
60
+ for file in artifacts/**/*.xml; do
61
+ if [ -f "$file" ]; then
62
+ suite_name=$(basename "$(dirname "$file")")
63
+ tests=$(xmllint --xpath "count(//testcase)" "$file")
64
+ passed=$(xmllint --xpath "count(//testcase[not(failure) and not(error) and not(skipped)])" "$file")
65
+ failed=$(xmllint --xpath "count(//testcase[failure or error])" "$file")
66
+ skipped=$(xmllint --xpath "count(//testcase[skipped])" "$file")
67
+ duration=$(xmllint --xpath "sum(//testcase/@time)" "$file")
68
+ # Debugging: Output values for each file
69
+ echo "Processing file: $file"
70
+ echo "Suite: $suite_name, Tests: $tests, Passed: $passed, Failed: $failed, Skipped: $skipped, Duration: $duration"
71
+ echo "| $suite_name | $tests | $passed | $failed | $skipped | ${duration}s |" >> $GITHUB_STEP_SUMMARY
72
+ total_tests=$((total_tests + tests))
73
+ total_passed=$((total_passed + passed))
74
+ total_failed=$((total_failed + failed))
75
+ total_skipped=$((total_skipped + skipped))
76
+ total_duration=$(echo "$total_duration + $duration" | bc)
77
+ fi
78
+ done
79
+ echo "Total tests: $total_tests"
80
+ echo "Total passed: $total_passed"
81
+ echo "Total failed: $total_failed"
82
+ echo "Total skipped: $total_skipped"
83
+ echo "Total duration: $total_duration"
84
+ echo "|------------|-------|--------|--------|---------|----------|" >> $GITHUB_STEP_SUMMARY
85
+ echo "| **Total** | $total_tests | $total_passed | $total_failed | $total_skipped | ${total_duration}s |" >> $GITHUB_STEP_SUMMARY
0 commit comments