Skip to content

Commit 9058509

Browse files
Copilotneilime
andcommitted
Add arrange step to create test report files in test workflow
Co-authored-by: neilime <314088+neilime@users.noreply.github.com>
1 parent d64a91f commit 9058509

1 file changed

Lines changed: 69 additions & 3 deletions

File tree

.github/workflows/__test-action-parse-ci-reports.yml

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,80 @@ jobs:
1515
with:
1616
persist-credentials: false
1717

18+
- name: Arrange - Create test report files
19+
run: |
20+
mkdir -p test-reports
21+
22+
# Create JUnit XML test report
23+
cat > test-reports/junit.xml << 'EOF'
24+
<?xml version="1.0" encoding="UTF-8"?>
25+
<testsuite name="Test Suite" tests="3" failures="0" errors="0" skipped="0" time="1.234">
26+
<testcase name="test_example_1" classname="TestClass" time="0.123"/>
27+
<testcase name="test_example_2" classname="TestClass" time="0.456"/>
28+
<testcase name="test_example_3" classname="TestClass" time="0.655"/>
29+
</testsuite>
30+
EOF
31+
32+
# Create LCOV coverage report
33+
cat > test-reports/lcov.info << 'EOF'
34+
TN:
35+
SF:src/example.js
36+
FN:1,exampleFunction
37+
FNDA:5,exampleFunction
38+
FNF:1
39+
FNH:1
40+
DA:1,5
41+
DA:2,5
42+
DA:3,5
43+
LF:3
44+
LH:3
45+
end_of_record
46+
EOF
47+
48+
# Create ESLint JSON report
49+
cat > test-reports/eslint.json << 'EOF'
50+
[
51+
{
52+
"filePath": "src/example.js",
53+
"messages": [],
54+
"errorCount": 0,
55+
"warningCount": 0
56+
}
57+
]
58+
EOF
59+
1860
- id: parse-ci-reports
1961
uses: ./actions/parse-ci-reports
62+
with:
63+
report-paths: |
64+
test-reports/junit.xml
65+
test-reports/lcov.info
66+
test-reports/eslint.json
67+
report-name: "Test Reports"
68+
output-format: "summary,markdown"
2069

2170
- name: Check parse-ci-reports outputs
2271
run: |
23-
if [ "${STEPS_PARSE_CI_REPORTS_OUTPUTS_HAS_ERRORS}" != 'false' ]; then
24-
echo "parse-ci-reports outputs result is not valid"
72+
# Check that markdown output exists
73+
if [ -z "${STEPS_PARSE_CI_REPORTS_OUTPUTS_MARKDOWN}" ]; then
74+
echo "parse-ci-reports markdown output is empty"
2575
exit 1
2676
fi
77+
78+
# Check that summary output exists
79+
if [ -z "${STEPS_PARSE_CI_REPORTS_OUTPUTS_SUMMARY}" ]; then
80+
echo "parse-ci-reports summary output is empty"
81+
exit 1
82+
fi
83+
84+
# Check that parsed-files output exists and is valid JSON
85+
if [ -z "${STEPS_PARSE_CI_REPORTS_OUTPUTS_PARSED_FILES}" ]; then
86+
echo "parse-ci-reports parsed-files output is empty"
87+
exit 1
88+
fi
89+
90+
echo "All outputs are valid"
2791
env:
28-
STEPS_PARSE_CI_REPORTS_OUTPUTS_HAS_ERRORS: ${{ steps.parse-ci-reports.outputs.has-errors }}
92+
STEPS_PARSE_CI_REPORTS_OUTPUTS_MARKDOWN: ${{ steps.parse-ci-reports.outputs.markdown }}
93+
STEPS_PARSE_CI_REPORTS_OUTPUTS_SUMMARY: ${{ steps.parse-ci-reports.outputs.summary }}
94+
STEPS_PARSE_CI_REPORTS_OUTPUTS_PARSED_FILES: ${{ steps.parse-ci-reports.outputs.parsed-files }}

0 commit comments

Comments
 (0)