forked from diafygi/acme-tiny
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.gitlab-ci.yml
274 lines (230 loc) · 5.67 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
---
###
### Pipeline(s) definition (stages and "only" keys)
###
stages:
- build
- check
- unit_test
- pebble_strict
- pebble_breaking
- lets_encrypt_staging
.build:
stage: build
only:
- merge_requests
- main
.check:
stage: check
only:
- merge_requests
- main
.unit_test:
stage: unit_test
only:
- merge_requests
- main
.pebble_strict:
stage: pebble_strict
only:
- merge_requests
- main
.pebble_breaking:
stage: pebble_breaking
only:
- merge_requests
- main
.lets_encrypt_staging:
stage: lets_encrypt_staging
only:
- merge_requests
- main
###
### Stage: build
###
.build-common:
extends: .build
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
DOCKER_BUILDKIT: 1
bullseye-slim:
extends: .build-common
script:
- docker build
--progress plain
-t "acme-dns-tiny:bullseye-slim"
-f "docker/bullseye/Dockerfile" .
bookworm-slim:
extends: .build-common
script:
- docker build
--progress plain
-t "acme-dns-tiny:bookworm-slim"
-f "docker/bookworm/Dockerfile" .
trixie-slim:
extends: .build-common
script:
- docker build
--progress plain
-t "acme-dns-tiny:trixie-slim"
-f "docker/trixie/Dockerfile" .
###
### Stage: check
###
.check-common:
extends: .check
image: acme-dns-tiny:bookworm-slim
compile:
extends: .check-common
script:
- python3 -m py_compile acme_dns_tiny.py tools/*.py tests/*.py
lint:
extends: .check-common
script: |
#!/usr/bin/env bash
set -euxo pipefail
IFS=$'\n\t'
pylint acme_dns_tiny.py
pylint tools/acme_account_deactivate.py
pylint tools/acme_account_rollover.py
pylint tests/config_factory.py
pylint tests/staging_test_acme_dns_tiny.py
pylint --disable=W0702 tests/unit_test_acme_dns_tiny.py
pylint tests/staging_test_acme_account_deactivate.py
pylint tests/staging_test_acme_account_rollover.py
pep8:
extends: .check-common
script: |
#!/usr/bin/env bash
set -euxo pipefail
IFS=$'\n\t'
pycodestyle --max-line-length=99 --ignore=E401,W503 --exclude=tests .
pycodestyle --max-line-length=99 --ignore=E722 tests
yamllint:
extends: .check
image:
name: cytopia/yamllint
entrypoint: ["/bin/ash", "-c"]
script:
- yamllint -f colored .
###
### Stage: unit_test
###
.unit_test-common:
extends: .unit_test
variables:
RUN_WITH_COVERAGE: "false"
script: |
#!/usr/bin/env bash
set -euxo pipefail
IFS=$'\n\t'
if [ "${RUN_WITH_COVERAGE:-}" = "true" ] ; then
python3-coverage run --append --source ./ -m unittest -v \
tests.unit_test_acme_dns_tiny
else
python3 -m unittest -v tests.unit_test_acme_dns_tiny
fi
bullseye-ut:
extends: .unit_test-common
image: acme-dns-tiny:bullseye-slim
bookworm-ut:
extends: .unit_test-common
image: acme-dns-tiny:bookworm-slim
variables:
RUN_WITH_COVERAGE: "true"
artifacts:
paths:
- .coverage
trixie-ut:
extends: .unit_test-common
image: acme-dns-tiny:trixie-slim
###
### Stage: pebble strict
###
.pebble_strict_common:
extends: .pebble_strict
variables:
GITLABCI_ACMEDIRECTORY_V2: https://pebble:14000/dir
REQUESTS_CA_BUNDLE: "./tests/pebble.pem"
# Never reject valid nonce, because, as script is tiny it doesn't manage it
# (user can run it again)
PEBBLE_WFE_NONCEREJECT: 0
# Never reuse already validated authorizations, so tests always have to
# validate challenges
PEBBLE_AUTHZREUSE: 0
RUN_WITH_COVERAGE: "false"
services:
- name: letsencrypt/pebble:latest
command: ["pebble", "-strict", "false"]
alias: pebble
script: |
#!/usr/bin/env bash
set -euxo pipefail
IFS=$'\n\t'
if [ "${RUN_WITH_COVERAGE:-}" = "true" ] ; then
python3-coverage run --append --source ./ -m unittest -v \
tests.staging_test_acme_dns_tiny \
tests.staging_test_acme_account_rollover \
tests.staging_test_acme_account_deactivate
else
python3 -m unittest -v \
tests.staging_test_acme_dns_tiny \
tests.staging_test_acme_account_rollover \
tests.staging_test_acme_account_deactivate
fi
bullseye-pebble:
extends: .pebble_strict_common
image: acme-dns-tiny:bullseye-slim
bookworm-pebble:
extends: .pebble_strict_common
image: acme-dns-tiny:bookworm-slim
variables:
RUN_WITH_COVERAGE: "true"
after_script: |
#!/usr/bin/env bash
set -euxo pipefail
IFS=$'\n\t'
python3-coverage report \
--include=acme_dns_tiny.py,tools/acme_account_rollover.py,tools/acme_account_deactivate.py
python3-coverage html
python3-coverage xml
coverage: '/^TOTAL.+\s+(\d+(?:\.\d+)?)%$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- htmlcov
trixie-pebble:
extends: .pebble_strict_common
image: acme-dns-tiny:trixie-slim
###
### Stage: pebble breaking changes allow to detect future change breaks
###
.pebble_breaking_common:
extends:
- .pebble_strict_common
- .pebble_breaking
services:
- name: letsencrypt/pebble:latest
command: ["pebble", "-strict", "true"]
alias: pebble
allow_failure: true
bookworm_pebble_breaking:
extends: .pebble_breaking_common
image: acme-dns-tiny:bookworm-slim
###
### Stage: Let's Encrypt staging
###
.lets_encrypt_staging_common:
extends: .lets_encrypt_staging
script:
- python3-coverage run --append --source ./ -m unittest -v
tests.staging_test_acme_dns_tiny
tests.staging_test_acme_account_rollover
tests.staging_test_acme_account_deactivate
bookworm-le-staging:
extends: .lets_encrypt_staging_common
image: acme-dns-tiny:bookworm-slim