diff --git a/.github/scripts/gcov_wrapper b/.github/scripts/gcov_wrapper new file mode 100755 index 000000000..ef384674e --- /dev/null +++ b/.github/scripts/gcov_wrapper @@ -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[@]}" diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml index 2bc2053a5..2ddbe30ab 100644 --- a/.github/workflows/linux-ci.yml +++ b/.github/workflows/linux-ci.yml @@ -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"