summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Griffis <pgriffis@igalia.com>2020-11-13 15:38:49 -0600
committerPatrick Griffis <pgriffis@igalia.com>2020-11-25 14:54:51 -0600
commit51ccd33d005549188f667cbfa2963b8257cc11a2 (patch)
treea20f54e218ff3ac251478e4e57c183a12ba4ecf2
parent0bd6a9f5cbcefec39a71f0f845391ebfd0a99880 (diff)
downloadlibsoup-pgriffis/coverage.tar.gz
ci: Simplify coverage reportspgriffis/coverage
-rw-r--r--.gitlab-ci.yml28
-rw-r--r--.gitlab-ci/coverage-docker.sh33
-rw-r--r--.gitlab-ci/fixup-cov-paths.py29
3 files changed, 6 insertions, 84 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 67e975d0..eaed4e22 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -15,15 +15,12 @@ stages:
fedora-test:
extends: .build
- variables:
- CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
script:
- - meson _build -Dauto_features=enabled
+ - cp .gitlab-ci/lcovrc ~/.lcovrc
+ - meson _build -Db_coverage=true -Dauto_features=enabled
- ninja -C _build
- - mkdir -p _coverage
- - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --initial --output-file "_coverage/${CI_JOB_NAME}-baseline.lcov"
- ninja -C _build test
- - lcov --config-file .gitlab-ci/lcovrc --directory _build --capture --output-file "_coverage/${CI_JOB_NAME}.lcov"
+ - ninja -C _build coverage-html
artifacts:
reports:
junit: "_build/${CI_JOB_NAME}-report.xml"
@@ -31,9 +28,9 @@ fedora-test:
when: always
paths:
- "_build/config.h"
- - "_build/meson-logs"
- - "_build/${CI_JOB_NAME}-report.xml"
- - "_coverage"
+ - "_build/meson-logs/testlog.txt"
+ - "_build/meson-logs/coveragereport"
+ coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
fedora-scan:
extends: .build
@@ -46,19 +43,6 @@ fedora-scan:
paths:
- _build/meson-logs/scanbuild
-coverage:
- stage: coverage
- needs: [fedora-test]
- except:
- - tags
- artifacts:
- name: "libsoup-${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}"
- paths:
- - _coverage/
- script:
- - bash -x ./.gitlab-ci/coverage-docker.sh
- coverage: '/^\s+lines\.+:\s+([\d.]+\%)\s+/'
-
reference:
stage: docs
variables:
diff --git a/.gitlab-ci/coverage-docker.sh b/.gitlab-ci/coverage-docker.sh
deleted file mode 100644
index 9e9487d7..00000000
--- a/.gitlab-ci/coverage-docker.sh
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/bash
-
-set -e
-
-# Fixup Windows paths
-lcov_paths=$(find _coverage -name "*.lcov" -print)
-python3 ./.gitlab-ci/fixup-cov-paths.py ${lcov_paths}
-
-for path in _coverage/*.lcov; do
- # Remove coverage from generated code in the build directory
- lcov --config-file .gitlab-ci/lcovrc -r "${path}" '*/_build/*' -o "$(pwd)/${path}"
- # Remove any coverage from system files
- 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>
-<body>
-<ul>
-<li><a href="coverage/index.html">Coverage</a></li>
-</ul>
-</body>
-</html>
-EOL
diff --git a/.gitlab-ci/fixup-cov-paths.py b/.gitlab-ci/fixup-cov-paths.py
deleted file mode 100644
index 83190058..00000000
--- a/.gitlab-ci/fixup-cov-paths.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import sys
-import os
-import io
-
-
-def main(argv):
- # Fix paths in lcov files generated on a Windows host so they match our
- # current source layout.
- paths = argv[1:]
-
- for path in paths:
- print("cov-fixup:", path)
- text = io.open(path, "r", encoding="utf-8").read()
- text = text.replace("\\\\", "/")
- libsoup_dir = "/libsoup/"
- end = text.index(libsoup_dir)
- start = text[:end].rindex(":") + 1
- old_root = text[start:end]
- assert os.path.basename(os.getcwd()) == "libsoup"
- new_root = os.path.dirname(os.getcwd())
- if old_root != new_root:
- print("replacing %r with %r" % (old_root, new_root))
- text = text.replace(old_root, new_root)
- with io.open(path, "w", encoding="utf-8") as h:
- h.write(text)
-
-
-if __name__ == "__main__":
- sys.exit(main(sys.argv))