Skip to content

Commit d6e9e39

Browse files
committed
ci: Generate coverage report for the testsuite
Install gcc package that provides gcovr
1 parent a9781d4 commit d6e9e39

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ jobs:
223223
FOREVER_PAUSE: 100
224224
ITERATION_COUNT: 2
225225
TOMCAT_CYCLE_COUNT: 2
226+
CODE_COVERAGE: 1
226227
steps:
227228
- name: Checkout
228229
uses: actions/checkout@v4
@@ -249,9 +250,16 @@ jobs:
249250
if: always()
250251
with:
251252
name: Test logs
252-
path: |
253-
test/logs/*
253+
path: test/logs/*
254254
retention-days: 7
255+
# Preserve coverage data if defined
256+
- name: Preserve coverage files
257+
if: env.CODE_COVERAGE
258+
uses: actions/upload-artifact@v4
259+
with:
260+
name: Coverage
261+
path: test/coverage/*
262+
retention-days: 7
255263

256264
perl-tests:
257265
runs-on: ubuntu-latest

test/testsuite.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,14 @@ if [ $CODE_COVERAGE ]; then
128128
echo "Generating test coverage..."
129129
httpd_start > /dev/null 2>&1
130130
docker exec $MPC_NAME /usr/local/apache2/bin/apachectl stop
131+
131132
for f in $(ls coverage/*.json); do
132133
docker cp -q $f $MPC_NAME:/coverage/
133134
done
135+
134136
docker exec $MPC_NAME sh -c 'cd /native; gcovr --add-tracefile "/coverage/coverage-*.json" --html-details /coverage/test-coverage.html'
135137
docker cp $MPC_NAME:/coverage/ .
138+
136139
httpd_remove
137140
fi
138141

0 commit comments

Comments
 (0)