ci: enable code coverage
Change-Id: I1fb68bc05b1a4a75c249a11c87fd6139c1700e75
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index c020871..cd3eb76 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -27,4 +27,8 @@
sudo apt-get -qq update
sudo apt-get -qy install build-essential pkg-config python3-minimal \
libboost-all-dev libssl-dev libsqlite3-dev
+
+ if [[ $JOB_NAME == *"code-coverage" ]]; then
+ sudo apt-get -qy install gcovr lcov
+ fi
fi
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
new file mode 100755
index 0000000..6048b1c
--- /dev/null
+++ b/.jenkins.d/30-coverage.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+set -ex
+
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+ lcov --quiet \
+ --capture \
+ --directory . \
+ --no-external \
+ --rc lcov_branch_coverage=1 \
+ --output-file build/coverage-with-tests.info
+
+ lcov --quiet \
+ --remove build/coverage-with-tests.info "$PWD/tests/*" \
+ --rc lcov_branch_coverage=1 \
+ --output-file build/coverage.info
+
+ genhtml --branch-coverage \
+ --demangle-cpp \
+ --legend \
+ --output-directory build/coverage \
+ --title "PSync unit tests" \
+ build/coverage.info
+fi
diff --git a/.travis.yml b/.travis.yml
index aae985f..37330c3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -24,6 +24,7 @@
- env: COMPILER=clang++-8
- env: COMPILER=clang++-10
- env: COMPILER=clang++-11
+ - env: COMPILER=clang++-12
# macOS
- os: osx
@@ -47,7 +48,7 @@
allow_failures:
- arch: s390x # bug 4818
- - env: COMPILER=clang++-11
+ - env: COMPILER=clang++-12
fast_finish: true
@@ -64,7 +65,7 @@
# https://apt.llvm.org/
LLVM_REPO=${COMPILER/clang++/llvm-toolchain-${TRAVIS_DIST}}
travis_retry wget -nv -O - "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
- travis_retry sudo add-apt-repository -y "deb http://apt.llvm.org/${TRAVIS_DIST}/ ${LLVM_REPO%-11} main"
+ travis_retry sudo add-apt-repository -y "deb http://apt.llvm.org/${TRAVIS_DIST}/ ${LLVM_REPO%-12} main"
travis_retry sudo apt-get -qq update
;;
esac