Imported Upstream version 2.73.3
[platform/upstream/glib.git] / .gitlab-ci / coverage-docker.sh
1 #!/bin/bash
2
3 set -e
4
5 # Fixup Windows paths
6 python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov
7
8 for path in _coverage/*.lcov; do
9     # Remove coverage from generated code in the build directory
10     lcov --config-file .lcovrc -r "${path}" '*/_build/*' -o "$(pwd)/${path}"
11     # Remove any coverage from system files
12     lcov --config-file .lcovrc -e "${path}" "$(pwd)/*" -o "$(pwd)/${path}"
13 done
14
15 genhtml \
16     --ignore-errors=source \
17     --config-file .lcovrc \
18     _coverage/*.lcov \
19     -o _coverage/coverage
20
21 cd _coverage
22 rm -f ./*.lcov
23
24 cat >index.html <<EOL
25 <html>
26 <body>
27 <ul>
28 <li><a href="coverage/index.html">Coverage</a></li>
29 </ul>
30 </body>
31 </html>
32 EOL
33
34 # Print a handy link to the coverage report
35 echo "Coverage report at: https://${CI_PROJECT_NAMESPACE}.pages.gitlab.gnome.org/-/${CI_PROJECT_NAME}/-/jobs/${CI_BUILD_ID}/artifacts/_coverage/coverage/index.html"