ci: use gcovr 5.0 to generate code coverage reports
Add badges to README.md
Change-Id: I7c5b2c6fc39654e4552c3ccfc11f2a2c0cdc4d34
diff --git a/.jenkins b/.jenkins
index 1a12b6c..21cce49 100755
--- a/.jenkins
+++ b/.jenkins
@@ -2,6 +2,9 @@
set -e
source .jenkins.d/util.sh
+if has Linux $NODE_LABELS; then
+ export PATH="~/.local/bin${PATH:+:}${PATH}"
+fi
export CACHE_DIR=${CACHE_DIR:-/tmp}
export WAF_JOBS=${WAF_JOBS:-1}
[[ $JOB_NAME == *"code-coverage" ]] && export DISABLE_ASAN=yes
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index c021e54..90f7bb4 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -37,7 +37,8 @@
case $JOB_NAME in
*code-coverage)
- sudo apt-get -qy install gcovr lcov
+ sudo apt-get -qy install lcov python3-pip
+ pip3 install --user --upgrade --upgrade-strategy=eager 'gcovr~=5.0'
;;
*Docs)
sudo apt-get -qy install doxygen graphviz python3-pip
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
index 2ff210e..9c946b8 100755
--- a/.jenkins.d/30-coverage.sh
+++ b/.jenkins.d/30-coverage.sh
@@ -2,29 +2,32 @@
set -ex
if [[ $JOB_NAME == *"code-coverage" ]]; then
- gcovr --object-directory=build \
- --output=build/coverage.xml \
- --exclude="$PWD/(examples|tests)" \
- --root=. \
- --xml
+ # Generate an XML report (Cobertura format) and a detailed HTML report using gcovr
+ # Note: trailing slashes are important in the paths below. Do not remove them!
+ gcovr -j$WAF_JOBS \
+ --object-directory build \
+ --filter ndn-cxx/ \
+ --exclude ndn-cxx/detail/nonstd/ \
+ --exclude-throw-branches \
+ --exclude-unreachable-branches \
+ --print-summary \
+ --html-details build/gcovr/ \
+ --xml build/coverage.xml
- # Generate also a detailed HTML output, but using lcov (better results)
+ # Generate a detailed HTML report using lcov
lcov --quiet \
--capture \
--directory . \
+ --exclude "$PWD/ndn-cxx/detail/nonstd/*" \
+ --exclude "$PWD/tests/*" \
--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 \
+ --output-directory build/lcov \
--title "ndn-cxx unit tests" \
build/coverage.info
fi
diff --git a/README.md b/README.md
index d26feab..1a06ea7 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,9 @@
# ndn-cxx: NDN C++ library with eXperimental eXtensions
-![Language](https://img.shields.io/badge/C%2B%2B-14-blue.svg)
-[![Build Status](https://travis-ci.org/named-data/ndn-cxx.svg?branch=master)](https://travis-ci.org/named-data/ndn-cxx)
-![Latest Version](https://img.shields.io/github/tag/named-data/ndn-cxx.svg?color=darkkhaki&label=latest%20version)
+[![CI](https://github.com/named-data/ndn-cxx/actions/workflows/ci.yml/badge.svg)](https://github.com/named-data/ndn-cxx/actions/workflows/ci.yml)
+[![Docs](https://github.com/named-data/ndn-cxx/actions/workflows/docs.yml/badge.svg)](https://github.com/named-data/ndn-cxx/actions/workflows/docs.yml)
+![Language](https://img.shields.io/badge/C%2B%2B-14-blue)
+![Latest version](https://img.shields.io/github/v/tag/named-data/ndn-cxx?label=Latest%20version)
**ndn-cxx** is a C++14 library implementing Named Data Networking (NDN) primitives
that can be used to write various NDN applications. The library is currently being