Skip to content
Snippets Groups Projects
Commit b638f521 authored by ale's avatar ale
Browse files

Generate a single 'coverage' output line for tests

The numbers reported by Gitlab should now be accurate.
parent 35668dde
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,12 @@ test:
stage: test
image: golang:1.15
script:
- go test -v -cover -coverprofile=cover.out ./...
# The following monstruosity is required to generate a single coverage
# result statement for the entire package, but without generating build
# errors due to multiple definition of flags in cmd/ tools.
# See also https://github.com/golang/go/issues/27333
- go test -v -cover -coverpkg=$(go list ./... | grep -v /cmd/) -coverprofile=cover.out ./...
# Convert coverage output to XML for Gitlab integration.
- (cd /tmp && go get github.com/boumenot/gocover-cobertura)
- gocover-cobertura < cover.out > cover.xml
artifacts:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment