blob: f9af55c28d8f2cddec062b8fb3e7c5199b31c2f3 [file] [log] [blame]
Davide Pesavento87d4e202020-08-09 01:18:52 -04001#!/usr/bin/env bash
Davide Pesavento187e0652025-03-25 02:02:14 -04002set -eo pipefail
Davide Pesavento87d4e202020-08-09 01:18:52 -04003
Davide Pesavento187e0652025-03-25 02:02:14 -04004[[ $JOB_NAME == *code-coverage ]] || exit 0
Davide Pesaventof078fb52021-11-05 16:08:44 -04005
Davide Pesavento187e0652025-03-25 02:02:14 -04006export FORCE_COLOR=1
7export UV_NO_MANAGED_PYTHON=1
Davide Pesavento87d4e202020-08-09 01:18:52 -04008
Davide Pesavento187e0652025-03-25 02:02:14 -04009set -x
10
Davide Pesavento93da5fc2025-04-04 18:00:21 -040011# Generate a detailed HTML report and an XML report in Cobertura format using gcovr
Davide Pesavento187e0652025-03-25 02:02:14 -040012# Note: trailing slashes are important in the paths below. Do not remove them!
Davide Pesavento93da5fc2025-04-04 18:00:21 -040013uvx --from 'git+https://github.com/gcovr/gcovr@99b82e7' gcovr \
14 --decisions \
Davide Pesavento187e0652025-03-25 02:02:14 -040015 --filter PSync/ \
16 --exclude-throw-branches \
17 --exclude-unreachable-branches \
18 --cobertura build/coverage.xml \
19 --html-details build/gcovr/ \
Davide Pesavento93da5fc2025-04-04 18:00:21 -040020 --txt-summary \
21 build
Davide Pesavento187e0652025-03-25 02:02:14 -040022
23# Generate a detailed HTML report using lcov
Davide Pesavento93da5fc2025-04-04 18:00:21 -040024lcov \
25 --quiet \
26 --capture \
27 --directory . \
28 --include "$PWD/PSync/*" \
Davide Pesavento93da5fc2025-04-04 18:00:21 -040029 --branch-coverage \
30 --rc no_exception_branch=1 \
Davide Pesavento410520d2025-05-05 15:24:24 -040031 --ignore-errors inconsistent,mismatch,mismatch \
Davide Pesavento93da5fc2025-04-04 18:00:21 -040032 --output-file build/coverage.info
Davide Pesavento187e0652025-03-25 02:02:14 -040033
Davide Pesavento93da5fc2025-04-04 18:00:21 -040034genhtml \
35 --quiet \
36 --branch-coverage \
37 --demangle-cpp \
38 --flat \
39 --legend \
40 --missed \
41 --show-proportion \
42 --title "PSync $(cat VERSION.info)" \
Davide Pesavento410520d2025-05-05 15:24:24 -040043 --ignore-errors inconsistent,inconsistent \
Davide Pesavento93da5fc2025-04-04 18:00:21 -040044 --output-directory build/lcov \
45 build/coverage.info