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
This commit is contained in:
Christoph Reiter
2018-04-27 17:04:52 +02:00
committed by Philip Withnall
parent e8798a4c22
commit 961be2b0bf
5 changed files with 104 additions and 1 deletions

View File

@@ -2,6 +2,8 @@ image: registry.gitlab.gnome.org/gnome/glib/master:v1
stages:
- build
- coverage
- deploy
cache:
paths:
@@ -9,18 +11,23 @@ cache:
fedora-meson-x86_64:
stage: build
variables:
CFLAGS: "-coverage -ftest-coverage -fprofile-arcs"
script:
- meson --prefix /usr --libdir /usr/lib64 --buildtype debug --werror -Dsystemtap=true -Ddtrace=true _build .
- cd _build
- ninja
- meson test
- cd ..
- mkdir -p _coverage
- lcov --rc lcov_branch_coverage=1 --directory . --capture --no-external --output-file "_coverage/${CI_JOB_NAME}.lcov"
except:
- tags
artifacts:
when: on_failure
name: "glib-_${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
- "${CI_PROJECT_DIR}/_coverage"
msys2-mingw32:
stage: build
@@ -32,6 +39,27 @@ msys2-mingw32:
script:
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu --ask 20
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
artifacts:
paths:
- _coverage/
coverage:
stage: coverage
artifacts:
paths:
- _coverage/
script:
- bash -x ./.gitlab-ci/coverage-docker.sh
pages:
stage: deploy
script:
- mv _coverage/ public/
artifacts:
paths:
- public
only:
- master
dist-job:
stage: build