-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
94 lines (87 loc) · 2.44 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
image: golang:1.22-alpine
include:
- template: Security/SAST.gitlab-ci.yml
stages:
- lint
- security
- test
golangci-lint:
stage: lint
needs: []
image: golangci/golangci-lint:v1.62.2
script:
- golangci-lint run -v
sast:
stage: security
needs: []
test:current:
stage: test
needs: []
before_script:
- go get github.com/boumenot/gocover-cobertura
- go install gotest.tools/gotestsum@latest
script:
- CGO_ENABLED=0 go test -coverprofile=coverage.txt -covermode count
after_script:
- go tool cover -html=coverage.txt -o=coverage-report.html
- go tool cover -func=coverage.txt
- go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
- gotestsum --junitfile junit.xml --format testname
coverage: "/\\(statements\\)\\s+\\d+.?\\d+%/"
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: junit.xml
paths:
- coverage-report.html
expire_in: 7 days
test:v5:
stage: test
needs: []
before_script:
- cd v5
- go get github.com/boumenot/gocover-cobertura
- go install gotest.tools/gotestsum@latest
script:
- CGO_ENABLED=0 go test -coverprofile=coverage.txt -covermode count
after_script:
- go tool cover -html=coverage.txt -o=coverage-report.html
- go tool cover -func=coverage.txt
- go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
- gotestsum --junitfile junit.xml --format testname
coverage: "/\\(statements\\)\\s+\\d+.?\\d+%/"
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: junit.xml
paths:
- coverage-report.html
expire_in: 7 days
test:v4:
stage: test
needs: []
before_script:
- cd v4
script:
- CGO_ENABLED=0 go test -coverprofile=coverage.txt -covermode count
- go get github.com/boumenot/gocover-cobertura
- go install gotest.tools/gotestsum@latest
after_script:
- go tool cover -html=coverage.txt -o=coverage-report.html
- go tool cover -func=coverage.txt
- go run github.com/boumenot/gocover-cobertura < coverage.txt > coverage.xml
- gotestsum --junitfile junit.xml --format testname
coverage: "/\\(statements\\)\\s+\\d+.?\\d+%/"
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
junit: junit.xml
paths:
- coverage-report.html
expire_in: 7 days