2018-04-27 17:04:52 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-10-20 03:07:52 +02:00
|
|
|
set -ex
|
2018-04-27 17:04:52 +02:00
|
|
|
|
|
|
|
# Fixup Windows paths
|
|
|
|
python3 ./.gitlab-ci/fixup-cov-paths.py _coverage/*.lcov
|
|
|
|
|
|
|
|
for path in _coverage/*.lcov; do
|
2018-07-06 09:33:22 +02:00
|
|
|
# Remove coverage from generated code in the build directory
|
2022-04-28 12:57:45 +02:00
|
|
|
lcov --config-file .lcovrc -r "${path}" '*/_build/*' -o "$(pwd)/${path}"
|
2018-07-06 09:33:22 +02:00
|
|
|
# Remove any coverage from system files
|
2022-04-28 12:57:45 +02:00
|
|
|
lcov --config-file .lcovrc -e "${path}" "$(pwd)/*" -o "$(pwd)/${path}"
|
2022-07-21 01:05:42 +02:00
|
|
|
|
|
|
|
# Convert to cobertura format for gitlab integration
|
|
|
|
cobertura_base="${path/.lcov}-cobertura"
|
|
|
|
cobertura_xml="${cobertura_base}.xml"
|
|
|
|
lcov_cobertura "${path}" --output "${cobertura_xml}"
|
|
|
|
mkdir -p "${cobertura_base}"
|
|
|
|
cobertura-split-by-package.py "${cobertura_xml}" "${cobertura_base}"
|
|
|
|
rm -f "${cobertura_xml}"
|
2018-04-27 17:04:52 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
genhtml \
|
|
|
|
--ignore-errors=source \
|
2022-04-28 12:57:45 +02:00
|
|
|
--config-file .lcovrc \
|
2018-04-27 17:04:52 +02:00
|
|
|
_coverage/*.lcov \
|
|
|
|
-o _coverage/coverage
|
|
|
|
|
|
|
|
cd _coverage
|
2020-02-25 12:46:11 +01:00
|
|
|
rm -f ./*.lcov
|
2018-04-27 17:04:52 +02:00
|
|
|
|
|
|
|
cat >index.html <<EOL
|
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<ul>
|
|
|
|
<li><a href="coverage/index.html">Coverage</a></li>
|
|
|
|
</ul>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
EOL
|
2022-02-01 12:08:22 +01:00
|
|
|
|
|
|
|
# Print a handy link to the coverage report
|
|
|
|
echo "Coverage report at: https://${CI_PROJECT_NAMESPACE}.pages.gitlab.gnome.org/-/${CI_PROJECT_NAME}/-/jobs/${CI_BUILD_ID}/artifacts/_coverage/coverage/index.html"
|