-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
141 lines (102 loc) · 2.86 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
variables:
GIT_SUBMODULE_STRATEGY: recursive
# We want full history so that "git describe" always works correctly.
GIT_DEPTH: 0
FF_ENABLE_BASH_EXIT_CODE_CHECK: "true"
# We always want to run with the Go version installed in a Docker image.
GOTOOLCHAIN: local
test:
stage: test
image: golang:$IMAGE_TAG
before_script:
- apk --update add make bash gcc musl-dev
- (cd /go; go install gotest.tools/[email protected])
- (cd /go; go install github.com/boumenot/[email protected])
- go version
script:
- make test-ci
artifacts:
when: always
reports:
junit: tests.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- tests.xml
- coverage.html
- coverage.xml
expire_in: never
coverage: '/coverage: \d+\.\d+% of statements/'
parallel:
matrix:
- IMAGE_TAG: ['1.23-alpine3.19']
lint:
stage: test
image: golang:1.23-alpine3.19
before_script:
- apk --update add make bash gcc musl-dev
- wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.3
script:
- make lint-ci
artifacts:
when: always
reports:
codequality: codeclimate.json
expire_in: never
fmt:
stage: test
image: golang:1.23-alpine3.19
before_script:
- apk --update add make bash git gcc musl-dev grep
- go install mvdan.cc/[email protected]
- go install golang.org/x/tools/cmd/[email protected]
script:
- make fmt-ci
lint_docs:
stage: test
image: node:20.17-alpine3.19
before_script:
- apk --update add make bash git
script:
- make lint-docs-ci
audit:
stage: test
image: golang:1.23-alpine3.19
before_script:
- apk --update add make bash git gcc musl-dev
- go install github.com/sonatype-nexus-community/[email protected]
script:
- make audit
commits:
stage: test
image: golang:1.23-alpine3.19
variables:
GIT_DEPTH: "0"
before_script:
- apk --update add git
script:
- '! git log --oneline "-G^(<<<<<<<|=======|>>>>>>>)" | grep "^"'
publish:
stage: deploy
image: golang:1.23-alpine3.19
script:
- GOPROXY=proxy.golang.org go list -m "gitlab.com/tozd/go/x@$CI_COMMIT_REF_NAME"
rules:
# We do not make releases in this repository, so we publish on every change of the main branch.
- if: '$CI_COMMIT_BRANCH == "main" && $CI_PROJECT_PATH == "tozd/go/x"'
# We do not need build artifacts in this job.
dependencies: []
sync_config:
stage: deploy
image:
name: registry.gitlab.com/tozd/gitlab/config/tag/v0-5-0:latest-debug
entrypoint: [""]
script:
- /gitlab-config set
rules:
- if: '$GITLAB_API_TOKEN && $SOPS_AGE_KEY_FILE && $CI_COMMIT_BRANCH == "main"'
changes:
- .gitlab-conf.yml
# We do not need build artifacts in this job.
dependencies: []