diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5b97246..8039ef8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,14 +11,32 @@ stages: .image-focal: image: '${CONTAINER_REGISTRY_NAME}/exim-encrypt-dlfunc-build-focal' +.code-coverage: + stage: build + script: + - meson build -Db_coverage=true + - cd build + - ninja + - ninja test + - ninja coverage-xml + - grep -Eo 'line-rate="[^"]+"' meson-logs/coverage.xml | head -n 1 | + grep -Eo '[0-9.]+' | awk '{ printf "coverage\x3a %.2f%% of statements\n", $1 * 100 }' + - ninja coverage-html + - mv meson-logs/coveragereport ../coverage + artifacts: + paths: + - coverage/ + reports: + cobertura: build/meson-logs/coverage.xml + .build: stage: build script: + - which meson - meson build - cd build - ninja - ninja test - - cd .. artifacts: paths: - build/src/libexim-encrypt-dlfunc.so @@ -39,10 +57,17 @@ stages: - ./*.changes - ./*.buildinfo +code-coverage: + extends: + - .image-bullseye + - .code-coverage + needs: [ ] + build:bullseye: extends: - .image-bullseye - .build + - .code-coverage needs: [ ] build:focal: diff --git a/ci_container/build.sh b/ci_container/build.sh index 10ce816..8667a08 100755 --- a/ci_container/build.sh +++ b/ci_container/build.sh @@ -52,13 +52,15 @@ for i in "${images[@]}"; do buildah run "$ctr" /bin/sh -c 'apt-get update; \ DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install -y \ build-essential \ - git \ + exim4-daemon-heavy \ exim4-dev \ + gcovr \ + git \ libsodium-dev \ + openssl \ pkg-config \ python3-pip \ - exim4-daemon-heavy \ - openssl; \ + libxml2-utils; \ DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt-get install -y \ debhelper \ debsigs \