Skip to content

Commit 9cd6195

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

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ jobs:
227227
FOREVER_PAUSE: 100
228228
ITERATION_COUNT: 2
229229
TOMCAT_CYCLE_COUNT: 2
230+
CODE_COVERAGE: 1
230231
steps:
231232
- name: Checkout
232233
uses: actions/checkout@v4
@@ -253,9 +254,16 @@ jobs:
253254
if: always()
254255
with:
255256
name: Test logs
256-
path: |
257-
test/logs/*
257+
path: test/logs/*
258258
retention-days: 7
259+
# Preserve coverage data if defined
260+
- name: Preserve coverage files
261+
if: env.CODE_COVERAGE
262+
uses: actions/upload-artifact@v4
263+
with:
264+
name: Coverage
265+
path: test/coverage/*
266+
retention-days: 7
259267

260268
perl-tests:
261269
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)