glib/.gitlab-ci/coverage-docker.sh
Christoph Reiter 961be2b0bf ci: collect test coverage and deploy a html report through gitlab pages
Use lcov for both Fedora and MSYS2 to create coverage reports and add a second
ci stage which merges the coverage and creates a html report using genhtml.

In the final stage, which is only run on master, the result is published on
gitlab pages.

https://bugzilla.gnome.org/show_bug.cgi?id=795636
2018-05-02 11:14:45 +01:00

31 lines
553 B
Bash
Executable File

#!/bin/bash
set -e
# Fixup Windows paths
python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov
# Remove coverage from generated code in the build directory
for path in _coverage/*.lcov; do
lcov --rc lcov_branch_coverage=1 -r "${path}" '*/_build/*' -o "$(pwd)/${path}"
done
genhtml \
--ignore-errors=source \
--rc lcov_branch_coverage=1 \
_coverage/*.lcov \
-o _coverage/coverage
cd _coverage
rm -f *.lcov
cat >index.html <<EOL
<html>
<body>
<ul>
<li><a href="coverage/index.html">Coverage</a></li>
</ul>
</body>
</html>
EOL