Skip to content

Commit

Permalink
fix(cov): exclude generated files
Browse files Browse the repository at this point in the history
Generated files like protobuf bindings are not required to be checked
for test coverage. This commit removes the coverage statistics for these
files from `coverage.out` after merging coverage results.

Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
  • Loading branch information
snprajwal committed May 9, 2023
1 parent e6dc2d5 commit c7e0870
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ coverage: check-go-version $(COVERAGE_BINARIES) $(TEST_PAYLOAD)
# combine the coverage results to show up in GitHub.
cat .coverage/coverprofile* | \
grep -v mode: | sort -r | awk '{if($$1 != last) {print $$0;last=$$1}}' >> ${COVERAGE_PATH}/coverage.out
# We do not want to upload coverage for autogenerated files (*.pb.go)
sed -i '/\.pb\.go/d' ${COVERAGE_PATH}/coverage.out

codecov:
curl -Os https://uploader.codecov.io/latest/linux/codecov
Expand Down

0 comments on commit c7e0870

Please sign in to comment.