Merge changes from topic "ci-coverage"
* changes:
CI: compare code coverage changes
CI: start building with coverage profiling
CI: only build docs once
diff --git a/.zuul.yaml b/.zuul.yaml
index 6f09b90..07833bf 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -1,10 +1,19 @@
- project:
check:
+ fail-fast: true
jobs:
- clang-format:
voting: false
- - f29-gcc:
+ - f29-gcc-cover:
requires: CzechLight-deps-f29-gcc
+ provides: coverage-f29-gcc
+ - f29-gcc-cover-diff:
+ voting: false
+ requires:
+ - CzechLight-deps-f29-gcc
+ - coverage-f29-gcc
+ dependencies:
+ - f29-gcc-cover
- f29-gcc-asan-ubsan:
requires: CzechLight-deps-f29-gcc-asan-ubsan
- f29-clang-asan:
diff --git a/ci/build.sh b/ci/build.sh
index ba8db7b..8b08c3b 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -1,7 +1,7 @@
#!/bin/bash
set -eux -o pipefail
-shopt -s failglob
+shopt -s failglob extglob
ZUUL_JOB_NAME=$(jq < ~/zuul-env.json -r '.job')
ZUUL_TENANT=$(jq < ~/zuul-env.json -r '.tenant')
@@ -50,6 +50,12 @@
CMAKE_OPTIONS="${CMAKE_OPTIONS} -DWITH_PYTHON_BINDINGS=ON"
fi
+if [[ $ZUUL_JOB_NAME =~ .*-cover.* ]]; then
+ export CFLAGS="${CFLAGS} --coverage"
+ export CXXFLAGS="${CXXFLAGS} --coverage"
+ export LDFLAGS="${LDFLAGS} --coverage"
+fi
+
PREFIX=~/target
mkdir ${PREFIX}
BUILD_DIR=~/build
@@ -69,7 +75,7 @@
if [[ -z "${ARTIFACT_URL}" ]]; then
# fallback to a promoted artifact
- ARTIFACT_URL="https://object-store.cloud.muni.cz/swift/v1/ci-artifacts-${ZUUL_TENANT}/${ZUUL_GERRIT_HOSTNAME}/CzechLight/dependencies/${ZUUL_JOB_NAME}/${DEP_SUBMODULE_COMMIT}.tar.xz"
+ ARTIFACT_URL="https://object-store.cloud.muni.cz/swift/v1/ci-artifacts-${ZUUL_TENANT}/${ZUUL_GERRIT_HOSTNAME}/CzechLight/dependencies/${ZUUL_JOB_NAME%%-cover?(-diff)}/${DEP_SUBMODULE_COMMIT}.tar.xz"
fi
ARTIFACT_FILE=$(basename ${ARTIFACT_URL})
@@ -82,14 +88,18 @@
tar -C ${PREFIX} -xf ${ARTIFACT_FILE}
rm ${ARTIFACT_FILE}
-# TODO: move this to CzechLight/dependencies
-mkdir -p /home/ci/target/var-run
-
cd ${BUILD_DIR}
cmake -GNinja -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Debug} -DCMAKE_INSTALL_PREFIX=${PREFIX} ${CMAKE_OPTIONS} ${ZUUL_PROJECT_SRC_DIR}
ninja-build
ctest -j${CI_PARALLEL_JOBS} --output-on-failure
-ninja-build doc
-pushd html
-zip -r ~/zuul-output/docs/html.zip .
-popd
+
+if [[ $JOB_PERFORM_EXTRA_WORK == 1 ]]; then
+ ninja-build doc
+ pushd html
+ zip -r ~/zuul-output/docs/html.zip .
+ popd
+fi
+
+if [[ $LDFLAGS =~ .*--coverage.* ]]; then
+ gcovr -j ${CI_PARALLEL_JOBS} --object-directory ${BUILD_DIR} --root ${ZUUL_PROJECT_SRC_DIR} --xml --output ${BUILD_DIR}/coverage.xml
+fi