Make sure Codecov reports line coverage (#2698)

This commit is contained in:
Bart Louwers
2024-08-07 16:43:15 +02:00
committed by GitHub
parent 8fcfd81381
commit 1c471d9b43
2 changed files with 18 additions and 0 deletions

17
.github/scripts/gcov_wrapper vendored Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
# This script is used in linux-ci.yml.
# Bazel 7 started including branch coverage in the coverage report.
# Now codecov is reporting branch coverage instead of line coverage.
# This script makes sure branch coverage is not included so codecov reports line coveage.
filtered_args=()
for arg in "$@"; do
# Skip the argument if it's "-b"
if [ "$arg" != "-b" ]; then
filtered_args+=("$arg")
fi
done
gcov "${filtered_args[@]}"

View File

@@ -216,6 +216,7 @@ jobs:
xvfb-run -a \
bazel coverage --combined_report=lcov --instrumentation_filter="//:mbgl-core" \
--test_output=errors --local_test_jobs=1 \
--repo_env=GCOV="$PWD/.github/scripts/gcov_wrapper" \
--test_env=DISPLAY --test_env=XAUTHORITY --copt="-DCI_BUILD" \
//test:core //render-test:render-test //expression-test:test
echo coverage_report="$(bazel info output_path)"/_coverage/_coverage_report.dat >> "$GITHUB_ENV"