[libgweather/ebassi/ci-coverage] ci: Generate a coverage HTML report
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgweather/ebassi/ci-coverage] ci: Generate a coverage HTML report
- Date: Tue, 23 Nov 2021 01:31:43 +0000 (UTC)
commit 0d4280a3d26b68104f46db64c8f4539bf8614a41
Author: Emmanuele Bassi <ebassi gnome org>
Date: Tue Nov 23 01:30:43 2021 +0000
ci: Generate a coverage HTML report
Using the lcov report and its genhtml tool.
.gitlab-ci.yml | 2 ++
.gitlab-ci/gen-coverage.sh | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 892ee2e1..20c50dd7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -289,6 +289,8 @@ coverage:
- lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file
"_coverage/${CI_JOB_NAME}-baseline.lcov"
- meson test -C _build
- lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file
"_coverage/${CI_JOB_NAME}.lcov"
+ - bash -x .gitlab-ci/gen-coverage.sh
+ coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
artifacts:
name: "gweather-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
when: always
diff --git a/.gitlab-ci/gen-coverage.sh b/.gitlab-ci/gen-coverage.sh
new file mode 100644
index 00000000..c15fe29f
--- /dev/null
+++ b/.gitlab-ci/gen-coverage.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -e
+
+for path in _coverage/*.lcov; do
+ lcov --config-file .gitlab-ci/lcovrc -r "${path}" '*/_build/*' -o "$(pwd)/${path}"
+ lcov --config-file .gitlab-ci/lcovrc -e "${path}" "$(pwd)/*" -o "$(pwd)/${path}"
+done
+
+genhtml \
+ --ignore-errors=source \
+ --config-file .gitlab-ci/lcovrc \
+ _coverage/*.lcov \
+ -o _coverage/coverage
+
+cd _coverage
+rm -f ./*.lcov
+
+cat >index.html <<EOL
+<html>
+<head><title>GWeather Coverage</title></head>
+<body>
+<div>
+<ul>
+<li><a href="coverage/index.html">Coverage report</a></li>
+</ul>
+</div>
+</body>
+</html>
+EOL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]