-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
70 lines (61 loc) · 1.27 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
include:
- template: Security/SAST.gitlab-ci.yml
.go-cache:
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/golang:1.22
variables:
GOPATH: $CI_PROJECT_DIR/.go
before_script:
- mkdir -p .go
cache:
paths:
- .go/pkg/mod/
stages:
- lint
- test
- build
- release
lint:
extends: ".go-cache"
stage: lint
script:
- go vet $(go list ./... | grep -v /vendor/)
test:
extends: ".go-cache"
stage: test
script:
- go install
- go test ./... -coverprofile=coverage.txt -covermode count
- go get github.com/boumenot/gocover-cobertura
- go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
sast:
stage: test
build:
extends: ".go-cache"
stage: build
script:
- mkdir -p bin
- go build -o bin ./...
artifacts:
paths:
- bin
.release:
extends: ".go-cache"
stage: release
image:
name: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/goreleaser/goreleaser:latest
entrypoint: ['']
only:
- tags
variables:
GIT_DEPTH: 0
script:
- GOVERSION=$(go version) goreleaser release --clean
release-gitlab:
extends: ".release"
before_script:
- unset GITHUB_TOKEN