Commit 64d98707 authored by Claudio André's avatar Claudio André

CI: add code coverage test

Publish to GitLab pages (and save the result in artifacts).
parent 229b36ed
......@@ -4,6 +4,7 @@ services:
stages:
- build
- failure
- deploy
before_script:
- rm -rf /cwd
......@@ -12,6 +13,7 @@ before_script:
.build: &build
stage: build
artifacts:
name: log
when: always
paths:
- $(pwd)/.cache/jhbuild/build/gjs/test-suite.log
......@@ -30,6 +32,11 @@ before_script:
$(pwd)/test/test-ci.sh GJS_EXTRA;
fi'
# Run code coverage tests
- 'if [[ $BUILD_OPTS == *"--enable-code-coverage"* ]]; then
$(pwd)/test/test-ci.sh GJS_COVERAGE;
fi'
ubuntu_gcc:
<<: *build
image: claudioandre/spidermonkey:ubuntu.1710.gcc
......@@ -68,6 +75,13 @@ fedora_clang:
BASE: fedora
OS: fedora.26.gcc
CC: clang
BUILD_OPTS: "--enable-code-coverage"
coverage: '/Lines:\n\d+\n\d+\n([\d]+\.[\d]+)/'
artifacts:
name: coverage
paths:
- $(pwd)/coverage/
- $(pwd)/.cache/jhbuild/build/gjs/test-suite.log
fedora_cppcheck:
<<: *build
......@@ -88,3 +102,16 @@ on_failure:
echo "-- NO LOG FILE FOUND --";
fi'
when: on_failure
# Publish Code Coverage Report
pages:
stage: deploy
dependencies:
- fedora_clang
script:
- mv $(pwd)/coverage/ public/
artifacts:
paths:
- public
only:
- master@GNOME/gjs
......@@ -118,6 +118,22 @@ elif [[ $1 == "GJS_EXTRA" ]]; then
xvfb-run jhbuild run dbus-run-session -- gnome-desktop-testing-runner gjs
elif [[ $1 == "GJS_COVERAGE" ]]; then
# Code coverage test. It doesn't (re)build, just run the 'Coverage Tests'
echo
echo '-- Code Coverage Report --'
do_Set_Env
PATH=$PATH:~/.local/bin
jhbuild run --in-builddir=gjs make check-code-coverage
mkdir -p /cwd/coverage
cp /cwd/.cache/jhbuild/build/gjs/gjs-?.*.*-coverage.info /cwd/coverage/
cp -r /cwd/.cache/jhbuild/build/gjs/gjs-?.*.*-coverage/* /cwd/coverage/
echo '-----------------------------------------------------------------'
sed -e 's/<[^>]*>//g' /cwd/coverage/index.html | tr -d ' \t' | sed '/^\s*$/d'
echo '-----------------------------------------------------------------'
elif [[ $1 == "CPPCHECK" ]]; then
echo
echo '-- Code analyzer --'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment