moth/.gitlab-ci.yml

33 lines
777 B
YAML

stages:
- test
- push
test:
stage: test
image: golang:1.18
only:
refs:
- main
- merge_requests
script:
- 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 -func coverage.txt
coverage: \(statements\)(?:\s+)?(\d+(?:\.\d+)?%)
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
push:
stage: push
rules:
- if: $CI_COMMIT_TAG
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
script:
- mkdir ~/.docker
- echo "$DOCKER_AUTH_CONFIG" | tee ~/.docker/config.json | md5sum
- sh build/ci/ci.sh publish