-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
217 lines (157 loc) · 4.31 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
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_go:
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']
test_node:
stage: test
image: node:20.17-alpine3.19
script:
- npm ci --audit=false
- npm run test-ci
artifacts:
when: always
reports:
junit: tests.xml
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
paths:
- coverage/
exclude:
- coverage/tmp/
expire_in: never
coverage: '/^All files\s+\|\s+\S+\s+\|\s+\S+\s+\|\s+\S+\s+\|\s+\S+\s+\|/'
lint_go:
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
lint_node:
stage: test
image: node:20.17-alpine3.19
before_script:
- apk --update add git
script:
- npm ci --audit=false
- npm run lint
- git diff --exit-code --color=always
fmt_go:
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
fmt_node:
stage: test
image: node:20.17-alpine3.19
before_script:
- apk --update add git
script:
- npm ci --audit=false
- npm run fmt
- git diff --exit-code --color=always
lint_docs:
stage: test
image: node:20.17-alpine3.19
before_script:
- apk --update add make bash git
script:
- make lint-docs-ci
audit_go:
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
audit_node:
stage: test
image: node:20.17-alpine3.19
script:
- npm 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/identifier@$CI_COMMIT_REF_NAME"
rules:
# Only on protected tags on main repository. Protected tags start with "v".
- if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_NAME =~ /^v/ && $CI_PROJECT_PATH == "tozd/identifier"'
# We do not need build artifacts in this job.
dependencies: []
sync_releases:
stage: deploy
image:
name: registry.gitlab.com/tozd/gitlab/release/tag/v0-6-0:latest-debug
entrypoint: [""]
script:
# On branch jobs, just update or remove releases, thus releases are created only on tag jobs.
- /gitlab-release ${CI_COMMIT_BRANCH:+--no-create}
rules:
# Protected tags start with "v".
- if: '$GITLAB_API_TOKEN && ($CI_COMMIT_BRANCH == "main" || ($CI_COMMIT_TAG && $CI_COMMIT_REF_NAME =~ /^v/))'
# 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: []