summaryrefslogtreecommitdiff
path: root/.gitlab-ci/coverage-docker.sh
blob: 2a51d0361a4b48f27d421b05aa0cdf2b3611f26b (plain)
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
#!/bin/bash

set -e

python -m pip install coverage

# Make the Windows paths match our current layout
python ./.gitlab-ci/fixup-cov-paths.py coverage/.coverage* coverage/*.lcov

# Remove external headers (except gi tests)
for path in coverage/*.lcov; do
    lcov --rc lcov_branch_coverage=1 -r "${path}" '/usr/include/*' -o "${path}"
    lcov --rc lcov_branch_coverage=1 -r "${path}" '/home/*' -o "${path}"
done

python -m coverage combine coverage
python -m coverage html --ignore-errors -d coverage/report-python
genhtml --ignore-errors=source --rc lcov_branch_coverage=1 \
    coverage/*.lcov -o coverage/report-c

cd coverage
rm -f .coverage*
rm -f *.lcov

ln -s report-python/index.html index-python.html
ln -s report-c/index.html index-c.html

cat >index.html <<EOL
<html>
<body>
<ul>
<li><a href="report-c/index.html">C Coverage</a></li>
<li><a href="report-python/index.html">Python Coverage</a></li>
</ul>
</body>
</html>
EOL