diff --git a/.bazelrc b/.bazelrc index 481079770c2..86182129958 100644 --- a/.bazelrc +++ b/.bazelrc @@ -20,6 +20,7 @@ build --remote_download_minimal test --remote_download_minimal run --remote_download_outputs=all coverage --build_runfile_links +coverage --nocache_test_results # Needed by rules_meta. # Follow https://github.com/fmeum/rules_meta/issues/1#issuecomment-1255828109 @@ -269,3 +270,4 @@ build:remote --build_metadata=VISIBILITY=PUBLIC coverage:remote --strategy=CoverageReport=local,remote coverage:remote --experimental_fetch_all_coverage_outputs coverage:remote --experimental_split_coverage_postprocessing +coverage:remote --experimental_remote_download_regex=.*/(coverage.dat$|_coverage/_coverage_report.dat$) diff --git a/ci/collect_coverage.sh b/ci/collect_coverage.sh index ff9fead1f6c..59661a0c96e 100755 --- a/ci/collect_coverage.sh +++ b/ci/collect_coverage.sh @@ -138,12 +138,13 @@ check_config # Print config parameters. print_config -lcov_opts=(--rc lcov_branch_coverage=1) +# TODO: Try to track down the negative coverage issue. +lcov_opts=(--rc branch_coverage=1 --ignore-errors negative) cd $(bazel info workspace) # Get coverage from bazel targets. -bazel coverage --remote_download_outputs=all --combined_report=lcov //src/... +bazel coverage --combined_report=lcov //src/... # Copy the output file cp --no-preserve=mode "$(bazel info output_path)/_coverage/_coverage_report.dat" ${COVERAGE_FILE} @@ -153,13 +154,11 @@ lcov "${lcov_opts[@]}" --summary ${COVERAGE_FILE} # Remove test files from the coverage files. lcov "${lcov_opts[@]}" -r ${COVERAGE_FILE} '**/*_test.cc' -o ${COVERAGE_FILE} -lcov "${lcov_opts[@]}" -r ${COVERAGE_FILE} '**/*_mock.cc' -o ${COVERAGE_FILE} lcov "${lcov_opts[@]}" -r ${COVERAGE_FILE} '**/*_mock.h' -o ${COVERAGE_FILE} lcov "${lcov_opts[@]}" -r ${COVERAGE_FILE} '**/*_test.go' -o ${COVERAGE_FILE} lcov "${lcov_opts[@]}" -r ${COVERAGE_FILE} '**/*.gen.go' -o ${COVERAGE_FILE} lcov "${lcov_opts[@]}" -r ${COVERAGE_FILE} '**/*-mock.tsx' -o ${COVERAGE_FILE} lcov "${lcov_opts[@]}" -r ${COVERAGE_FILE} '**/*-mock.ts' -o ${COVERAGE_FILE} -lcov "${lcov_opts[@]}" -r ${COVERAGE_FILE} 'src/ui/src/types/generated/**' -o ${COVERAGE_FILE} # Print out the final summary. lcov "${lcov_opts[@]}" --summary ${COVERAGE_FILE}