-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
52 lines (48 loc) · 1.1 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
stages:
- deps
- test
- release
image: golang:1.17.1-alpine3.14
variables:
GOPATH: $CI_PROJECT_DIR/.go
deps:
stage: deps
cache:
key: '$CI_COMMIT_REF_SLUG'
paths:
- ./vendor
- ./.go
artifacts:
expire_in: 1 week
paths:
- ./vendor
script:
- go mod vendor
- go mod tidy
unit:
stage: test
dependencies: [deps]
artifacts:
reports:
cobertura: reports/coverage.xml
before_script:
- apk add g++
- go get github.com/boumenot/gocover-cobertura
- go mod vendor
- mkdir -p ./reports
script:
- go test -v -mod=readonly -covermode=atomic -coverpkg=. -coverprofile=./reports/coverage.out .
- .go/bin/gocover-cobertura < ./reports/coverage.out > ./reports/coverage.xml
security:
stage: test
dependencies: [deps]
artifacts:
reports:
sast: reports/sast.json
before_script:
- apk add curl
- curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $GOPATH/bin latest
- mkdir -p ./reports
script:
- go mod vendor
- .go/bin/gosec -fmt json -out reports/sast.json .