-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[chore][codecov] Fix coverage file naming #39356
Conversation
Makefile.Common
Outdated
@@ -18,7 +21,7 @@ GOTEST_TIMEOUT?= 600s | |||
GOTEST_OPT?= -race -timeout $(GOTEST_TIMEOUT) -parallel 4 --tags=$(GO_BUILD_TAGS) | |||
GOTEST_INTEGRATION_OPT?= -race -timeout 360s -parallel 4 -skip Sudo | |||
GOTEST_INTEGRATION_OPT_SUDO?= -race -timeout 360s -parallel 4 -exec sudo -run Sudo | |||
GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -coverprofile=coverage.txt -covermode=atomic | |||
GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -covermode=atomic -test.gocoverdir="$(COVER_DIR_ABS)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two changes going on here:
- Do not set
-coverprofile
: This sets the output filename of the code coverage results. We want a random name so they are not clobbered when moving them into the same location. - Add the
-test.gocoverdir
option: This means all code coverage files will be in the same directory, making it simpler to generate the final merged report.
Makefile
Outdated
@@ -186,6 +186,7 @@ gotest-with-junit: | |||
.PHONY: gotest-with-junit-and-cover | |||
gotest-with-junit-and-cover: | |||
@$(MAKE) $(FOR_GROUP_TARGET) TARGET="test-with-junit-and-cover" | |||
@go tool covdata textfmt -i=$(COVER_DIR_ABS) -o coverage.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change means all coverage files located in the coverage directory will be merged into a single file, which can then be uploaded by the workflow.
Successful codecov run from this PR here: https://app.codecov.io/github/open-telemetry/opentelemetry-collector-contrib/commit/3b688e20240d1b881bae21ba13423989613e2245/tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add back codecov running restrictions since the testing showed the upload is working.
Description
Uploads to codecov have been broken since #37875 was merged. Efforts have been made to address the reasoning behind why it's not working (eg #38236), but it's still failing.
Example recent failure:
This failure is hit here.
This PR aims to correct the naming and location of code coverage files to enable the successful upload to codecov.