diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6a90ca0ae4f3eac66b9325c40cf52f6d1e4d93ac..63c769528ff16c6eb1ca01a5dc36b97cac65c914 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,15 +17,20 @@ build_pkg:bullseye:amd64: test: stage: test image: golang:1.15 + before_script: + # Install tooling dependencies. + - (cd /tmp && go get github.com/boumenot/gocover-cobertura) + - (cd /tmp && go get github.com/jstemmer/go-junit-report) script: # 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 ./... + - go test -v -cover -coverpkg=$(go list ./... | grep -v /cmd/) -coverprofile=cover.out ./... 2>&1 | go-junit-report -set-exit-code > report.xml # Convert coverage output to XML for Gitlab integration. - - (cd /tmp && go get github.com/boumenot/gocover-cobertura) - gocover-cobertura < cover.out > cover.xml artifacts: + when: always reports: cobertura: cover.xml + junit: report.xml