-
Notifications
You must be signed in to change notification settings - Fork 75
/
.gitlab-ci.yml
58 lines (51 loc) · 1.19 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
include:
- project: cloud/integrations/ci
file:
- default.yml
variables:
COVERAGE_FILE: .testCoverage.txt
workflow:
rules:
- # Do not execute on main branch
if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
- # Do not execute on tag
if: $CI_COMMIT_TAG != null
when: never
- # Avoid duplicate pipelines in MRs
if: $CI_PIPELINE_SOURCE == 'merge_request_event'
when: never
- when: always
test:golangci-lint:
stage: test
image: golangci/golangci-lint:v1.59.0
script:
- golangci-lint run -v
test:go-mod-tidy:
stage: test
image: golang:1.21
script:
- go mod tidy -v
- git diff --exit-code
test:go-generate:
stage: test
image: golang:1.21
script:
- go generate ./...
- git diff --exit-code
test:tests:
stage: test
image: golang:1.21
script:
- |
go test -v \
-race \
-coverprofile=$COVERAGE_FILE \
./...
- go tool cover -func=$COVERAGE_FILE | tail -n1
- go run github.com/boumenot/gocover-cobertura < $COVERAGE_FILE > coverage.xml
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml