Skip to content

Commit 961eda2

Browse files
committed
ci: Upload cobertura coverage report
1 parent 5bc5ec5 commit 961eda2

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

.gitlab/gitlab-ci.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,40 @@ test:
7070
- <<: *cache-defaults
7171
variables:
7272
GOTESTSUM_VERSION: v1.12.0
73+
GOCOVER_COBERTURA_VERSION: v1.3.0
7374
before_script:
75+
- echo -e "\e[0Ksection_start:$(date +%s):script_step_before\r\e[0KRunning script_step_before"
7476
- | # Download gotestsum binary
75-
echo -e "\e[0Ksection_start:$(date +%s):script_step_before\r\e[0KRunning script_step_before"
7677
curl -sSfL https://github.com/gotestyourself/gotestsum/releases/download/${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION#v}_linux_amd64.tar.gz -o /tmp/gotestsum.tar.gz
7778
mkdir -p ${GOPATH}/bin
7879
tar -C ${GOPATH}/bin/ -zxof /tmp/gotestsum.tar.gz gotestsum
79-
echo -e "\e[0Ksection_end:$(date +%s):script_step_before\r\e[0K"
80+
- | # Install gocover-cobertura
81+
go install github.com/boumenot/gocover-cobertura@${GOCOVER_COBERTURA_VERSION}
82+
- echo -e "\e[0Ksection_end:$(date +%s):script_step_before\r\e[0K"
8083
script:
8184
- |
8285
# Run tests
8386
echo -e "\e[0Ksection_start:$(date +%s):script_step_run\r\e[0KRunning script_step_run"
8487
${GOPATH}/bin/gotestsum \
85-
--junitfile report.xml --format testname \
88+
--junitfile=junit.xml --format=testname \
8689
-- \
87-
-coverprofile coverage.txt -covermode=atomic \
90+
-coverprofile=cover.out -covermode=atomic \
8891
./...
8992
echo -e "\e[0Ksection_end:$(date +%s):script_step_run\r\e[0K"
93+
after_script:
94+
- echo -e "\e[0Ksection_start:$(date +%s):script_step_after\r\e[0KRunning script_step_after"
95+
- ${GOPATH}/bin/gocover-cobertura < cover.out > cobertura-coverage.xml
96+
- echo -e "\e[0Ksection_end:$(date +%s):script_step_after\r\e[0K"
9097
artifacts:
9198
when: always
9299
paths:
93-
- report.xml
100+
- junit.xml
101+
- cobertura-coverage.xml
94102
reports:
95-
junit: report.xml
103+
junit: junit.xml
104+
coverage_report:
105+
coverage_format: cobertura
106+
path: cobertura-coverage.xml
96107

97108
release:
98109
stage: release

0 commit comments

Comments
 (0)