mirror of https://github.com/dirtbags/moth.git
Compare commits
No commits in common. "c3a7ee0d4f1651ca3d9eea849ea528b9c5731450" and "5ba58664b6ef40f19206b1ce8b405d8287581a28" have entirely different histories.
c3a7ee0d4f
...
5ba58664b6
|
@ -2,42 +2,31 @@ stages:
|
||||||
- test
|
- test
|
||||||
- push
|
- push
|
||||||
|
|
||||||
Run unit tests:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
image: &goimage golang:1.18
|
|
||||||
|
image: golang:1.18
|
||||||
only:
|
only:
|
||||||
refs:
|
refs:
|
||||||
- main
|
- main
|
||||||
- merge_requests
|
- merge_requests
|
||||||
script:
|
script:
|
||||||
- go test -coverprofile=coverage.txt -covermode=atomic -race ./...
|
- go test -coverprofile=coverage.txt -covermode=atomic -race ./...
|
||||||
|
- go get github.com/boumenot/gocover-cobertura
|
||||||
|
- go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
|
||||||
- go tool cover -html=coverage.txt -o coverage.html
|
- go tool cover -html=coverage.txt -o coverage.html
|
||||||
- go tool cover -func coverage.txt
|
- go tool cover -func coverage.txt
|
||||||
coverage: /\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/
|
coverage: /\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- coverage.html
|
|
||||||
- coverage.txt
|
|
||||||
Generage coverage XML:
|
|
||||||
stage: test
|
|
||||||
image: *goimage
|
|
||||||
needs: ["Run unit tests"]
|
|
||||||
script:
|
|
||||||
- go get github.com/boumenot/gocover-cobertura
|
|
||||||
- go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
|
|
||||||
only:
|
|
||||||
refs:
|
|
||||||
- main
|
|
||||||
- merge_requests
|
|
||||||
artifacts:
|
artifacts:
|
||||||
reports:
|
reports:
|
||||||
coverage_report:
|
coverage_report:
|
||||||
coverage_format: cobertura
|
coverage_format: cobertura
|
||||||
path: coverage.xml
|
path: coverage.xml
|
||||||
|
paths:
|
||||||
|
- coverage.html
|
||||||
|
- coverage.txt
|
||||||
push:
|
push:
|
||||||
stage: push
|
stage: push
|
||||||
needs: ["Run unit tests"]
|
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
|
|
Loading…
Reference in New Issue