ci: add linting and coverage
This commit is contained in:
parent
344505ea9d
commit
bbfc179269
1 changed files with 21 additions and 11 deletions
|
@ -1,21 +1,31 @@
|
||||||
# This file is a template, and might need editing before it works on your project.
|
|
||||||
image: golang:latest
|
image: golang:latest
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
#- build
|
#- build
|
||||||
- deploy
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
|
before_script:
|
||||||
|
- export PATH=$PATH:$GOPATH/bin
|
||||||
|
- go install gotest.tools/gotestsum@latest
|
||||||
script:
|
script:
|
||||||
- go test -race
|
- gotestsum --junitfile tests.xml -- -coverprofile=coverage.txt -covermode atomic .
|
||||||
|
after_script:
|
||||||
pages:
|
- export PATH=$PATH:$GOPATH/bin
|
||||||
stage: deploy
|
- go install github.com/boumenot/gocover-cobertura@latest
|
||||||
script:
|
- gocover-cobertura < coverage.txt > coverage.xml
|
||||||
- mkdir public
|
- go tool cover -func=coverage.txt | grep "total:"
|
||||||
- echo "<body>go/log page</body>" >public/index.html
|
coverage: '/total:\s+\(statements\)\s+(\d+.\d+\%)/'
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
reports:
|
||||||
- public
|
junit: tests.xml
|
||||||
|
coverage_report:
|
||||||
|
coverage_format: cobertura
|
||||||
|
path: coverage.xml
|
||||||
|
|
||||||
|
lint:
|
||||||
|
stage: test
|
||||||
|
image: golangci/golangci-lint
|
||||||
|
script:
|
||||||
|
- golangci-lint run
|
||||||
|
|
Loading…
Reference in a new issue