-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path__test-action-parse-ci-reports.yml
More file actions
110 lines (97 loc) · 3.42 KB
/
__test-action-parse-ci-reports.yml
File metadata and controls
110 lines (97 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Internal - Tests for parse-ci-reports action
on:
workflow_call:
permissions:
contents: read
jobs:
continuous-integration:
uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@775ce0902c528062cc94141dd7d13261083b752a # 0.22.0
permissions:
contents: read
id-token: write
packages: read
pull-requests: write
security-events: write
with:
working-directory: ./actions/parse-ci-reports
build: null
lint: null
test: '{ "coverage": null }'
integration-tests:
name: Tests for parse-ci-reports action
runs-on: ubuntu-latest
steps:
- name: Arrange - Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Arrange - Create test report files
run: |
mkdir -p test-reports
# Create JUnit XML test report
cat > test-reports/junit.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<testsuite name="Test Suite" tests="3" failures="0" errors="0" skipped="0" time="1.234">
<testcase name="test_example_1" classname="TestClass" time="0.123"/>
<testcase name="test_example_2" classname="TestClass" time="0.456"/>
<testcase name="test_example_3" classname="TestClass" time="0.655"/>
</testsuite>
EOF
# Create LCOV coverage report
cat > test-reports/lcov.info << 'EOF'
TN:
SF:src/example.js
FN:1,exampleFunction
FNDA:5,exampleFunction
FNF:1
FNH:1
DA:1,5
DA:2,5
DA:3,5
LF:3
LH:3
end_of_record
EOF
# Create ESLint JSON report
cat > test-reports/eslint.json << 'EOF'
[
{
"filePath": "src/example.js",
"messages": [],
"errorCount": 0,
"warningCount": 0
}
]
EOF
- name: Act - Run parse-ci-reports action
id: parse-ci-reports
uses: ./actions/parse-ci-reports
with:
report-paths: |
test-reports/junit.xml
test-reports/lcov.info
test-reports/eslint.json
report-name: "Test Reports"
output-format: "summary,markdown"
- name: Assert - Check parse-ci-reports outputs
run: |
# Check that markdown output exists
if [ -z "${STEPS_PARSE_CI_REPORTS_OUTPUTS_MARKDOWN}" ]; then
echo "parse-ci-reports markdown output is empty"
exit 1
fi
# Check that summary output exists
if [ -z "${STEPS_PARSE_CI_REPORTS_OUTPUTS_SUMMARY}" ]; then
echo "parse-ci-reports summary output is empty"
exit 1
fi
# Check that parsed-files output exists and is valid JSON
if [ -z "${STEPS_PARSE_CI_REPORTS_OUTPUTS_PARSED_FILES}" ]; then
echo "parse-ci-reports parsed-files output is empty"
exit 1
fi
echo "All outputs are valid"
env:
STEPS_PARSE_CI_REPORTS_OUTPUTS_MARKDOWN: ${{ steps.parse-ci-reports.outputs.markdown }}
STEPS_PARSE_CI_REPORTS_OUTPUTS_SUMMARY: ${{ steps.parse-ci-reports.outputs.summary }}
STEPS_PARSE_CI_REPORTS_OUTPUTS_PARSED_FILES: ${{ steps.parse-ci-reports.outputs.parsed-files }}