Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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$)
7 changes: 3 additions & 4 deletions ci/collect_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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}
Expand Down
Loading