From c7e087014859491302f75e1cdbcb5ab0225751c0 Mon Sep 17 00:00:00 2001 From: Prajwal S N Date: Tue, 9 May 2023 23:06:55 +0530 Subject: [PATCH] fix(cov): exclude generated files 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 --- test/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Makefile b/test/Makefile index 71cac0069..1f548261f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -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