-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
404 lines (375 loc) · 9.93 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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# makes git submodules work
variables:
GIT_SUBMODULE_STRATEGY: recursive
# by default, retry failed jobs up to three times. sometimes jobs can fail due to
# temporary blips like network connectivity issues.
default:
retry: 1
# stages
# image stage builds prerequisite docker containers.
# pre stage is run before build, contains tests and dependencies.
# build stage builds the code in release mode.
# post stage runs integration tests
# deploy deploys the resulting artifacts and builds docs.
stages:
- images
- pre
- build
- post
- deploy
# rebuild alpine docker container.
docker:alpine:
image: docker
stage: images
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build . -f scripts/alpine.dockerfile -t "$CI_REGISTRY_IMAGE/alpine"
- docker push "$CI_REGISTRY_IMAGE/alpine"
only:
refs:
- master
changes:
- scripts/alpine.dockerfile
# rebuild deploy docker container.
docker:deploy:
image: docker
stage: images
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build . -f scripts/deploy.dockerfile -t "$CI_REGISTRY_IMAGE/deploy"
- docker push "$CI_REGISTRY_IMAGE/deploy"
only:
refs:
- master
changes:
- scripts/deploy.dockerfile
docker:mingw64:
image: docker
stage: images
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build . -f scripts/mingw64.dockerfile -t "$CI_REGISTRY_IMAGE/mingw64"
- docker push "$CI_REGISTRY_IMAGE/mingw64"
only:
refs:
- master
changes:
- scripts/mingw64.dockerfile
docker:riscv64:
image: docker
stage: images
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build . -f scripts/riscv64.dockerfile -t "$CI_REGISTRY_IMAGE/riscv64"
- docker push "$CI_REGISTRY_IMAGE/riscv64"
only:
refs:
- master
changes:
- scripts/riscv64.dockerfile
docker:macos:
image: docker
stage: images
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build . -f scripts/macos.dockerfile -t "$CI_REGISTRY_IMAGE/macos"
- docker push "$CI_REGISTRY_IMAGE/macos"
only:
refs:
- master
changes:
- scripts/macos.dockerfile
docker:amd64:
image: docker
stage: images
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build . -f scripts/amd64.dockerfile -t "$CI_REGISTRY_IMAGE/amd64"
- docker push "$CI_REGISTRY_IMAGE/amd64"
only:
refs:
- master
changes:
- scripts/amd64.dockerfile
docker:aarch64:
image: docker
stage: images
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build . -f scripts/aarch64.dockerfile -t "$CI_REGISTRY_IMAGE/aarch64"
- docker push "$CI_REGISTRY_IMAGE/aarch64"
only:
refs:
- master
changes:
- scripts/aarch64.dockerfile
docker:wasi:
image: docker
stage: images
services:
- docker:dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker build . -f scripts/wasi.dockerfile -t "$CI_REGISTRY_IMAGE/wasi"
- docker push "$CI_REGISTRY_IMAGE/wasi"
only:
refs:
- master
changes:
- scripts/wasi.dockerfile
sanitize:
image: "$CI_REGISTRY_IMAGE/amd64"
stage: pre
script:
- CC=clang scripts/sanitizer.sh Address
- CC=clang scripts/sanitizer.sh Memory
- CC=clang scripts/sanitizer.sh Undefined
- CC=clang scripts/sanitizer.sh Leak
test:aarch64:
image: "$CI_REGISTRY_IMAGE/aarch64"
stage: pre
script:
- cmake -S . -B build-aarch64 -GNinja -DCMAKE_TOOLCHAIN_FILE=cmake/aarch64-gcc.cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_GIT_INFO=No
- cmake --build build-aarch64
- qemu-aarch64-static -L /usr/aarch64-linux-gnu/ ./build-aarch64/src/tests/passgen-test
test:amd64:
image: "$CI_REGISTRY_IMAGE/amd64"
stage: pre
script:
- CC=clang ./scripts/coverage.sh build-clang
- CC=gcc ./scripts/coverage.sh build-gcc
artifacts:
paths:
- build-clang/ccov/passgen-test
- build-gcc/ccov/passgen-test
- make symbols-check
expire_in: 1 week
test:alpine:
image: "$CI_REGISTRY_IMAGE/alpine"
stage: pre
script:
- cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DUSE_BACKTRACE=NO -GNinja
- cmake --build build
- ./build/src/tests/passgen-test -v
- valgrind ./build/src/tests/passgen-test -v
- valgrind ./build/src/bench/passgen-bench -i1 -t0s
- ninja -C build symbols-check
test:riscv64:
image: "$CI_REGISTRY_IMAGE/riscv64"
stage: pre
script:
- cmake -S . -B build-riscv64 -GNinja -DCMAKE_TOOLCHAIN_FILE=cmake/riscv64-gcc.cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_GIT_INFO=No
- cmake --build build-riscv64
- qemu-riscv64-static -L /usr/riscv64-linux-gnu/ ./build-riscv64/src/tests/passgen-test
test:nix:
image: nixos/nix
stage: pre
script:
- nix --extra-experimental-features nix-command --extra-experimental-features flakes run
# fetch wordlists
wordlists:
image: alpine
stage: pre
before_script:
- apk add curl
script:
- ./scripts/fetch-wordlists.sh
artifacts:
paths:
- data/
expire_in: 1 week
build:mingw64:
image: "$CI_REGISTRY_IMAGE/mingw64"
stage: build
dependencies:
- wordlists
before_script:
- git config --global --add safe.directory '*'
script:
- cmake -S . -B build-mingw64 -DCMAKE_TOOLCHAIN_FILE=cmake/mingw64-gcc.cmake -DCMAKE_BUILD_TYPE=Release -DPASSGEN_STATIC=y -DPASSGEN_MLOCK=OFF
- cd build-mingw64
- make -j
- cpack -G ZIP
artifacts:
paths:
- build-mingw64
expire_in: 1 week
build:macos:
image: "$CI_REGISTRY_IMAGE/macos"
stage: build
dependencies:
- wordlists
script:
- cmake -S . -B build-macos -DLIBPASSGEN_SHARED=NO -DCMAKE_BUILD_TYPE=Release -DBUILD_BENCH=NO -DCMAKE_TOOLCHAIN_FILE=cmake/macos-toolchain.cmake
- cmake --build build-macos
- cd build-macos && cpack -G TXZ
artifacts:
paths:
- build-macos
expire_in: 1 week
build:aarch64:
image: "$CI_REGISTRY_IMAGE/aarch64"
stage: build
dependencies:
- wordlists
before_script:
- git config --global --add safe.directory '*'
script:
- cmake -S . -B build-aarch64 -GNinja -DCMAKE_TOOLCHAIN_FILE=cmake/aarch64-gcc.cmake -DCMAKE_BUILD_TYPE=Release
- cd build-aarch64
- ninja
- qemu-aarch64-static -L /usr/aarch64-linux-gnu/ ./src/tests/passgen-test
- ../scripts/test-passgen-cli.sh qemu-aarch64-static -L /usr/aarch64-linux-gnu/ ./src/cli/passgen
- cpack -G TXZ
- cpack -G DEB
artifacts:
paths:
- build-aarch64
expire_in: 1 week
build:riscv64:
image: "$CI_REGISTRY_IMAGE/riscv64"
stage: build
dependencies:
- wordlists
before_script:
- git config --global --add safe.directory '*'
script:
- cmake -S . -B build-riscv64 -GNinja -DCMAKE_TOOLCHAIN_FILE=cmake/riscv64-gcc.cmake -DCMAKE_BUILD_TYPE=Release
- cd build-riscv64
- ninja
- qemu-riscv64-static -L /usr/riscv64-linux-gnu/ ./src/tests/passgen-test
- ../scripts/test-passgen-cli.sh qemu-riscv64-static -L /usr/riscv64-linux-gnu/ ./src/cli/passgen
- cpack -G TXZ
- cpack -G DEB
artifacts:
paths:
- build-riscv64
expire_in: 1 week
# build stuff on ubuntu.
build:amd64:
image: "$CI_REGISTRY_IMAGE/amd64"
stage: build
dependencies:
- wordlists
before_script:
- git config --global --add safe.directory '*'
script:
- mkdir build-amd64 && cd build-amd64
- cmake -GNinja -DCMAKE_UNITY_BUILD=YES -DCMAKE_BUILD_TYPE=Release -DPASSGEN_SECCOMP=YES ..
- ninja
- ./src/tests/passgen-test
- ../scripts/test-passgen-cli.sh ./src/cli/passgen
- cpack -G TXZ
- cpack -G DEB
artifacts:
paths:
- build-amd64
expire_in: 1 week
# build stuff on alpine.
build:alpine:
image: "$CI_REGISTRY_IMAGE/alpine"
stage: build
dependencies:
- wordlists
script:
- mkdir -p build-alpine-release && cd build-alpine-release
- cmake -GNinja -DCMAKE_UNITY_BUILD=YES -DCMAKE_BUILD_TYPE=Release -DPASSGEN_STATIC=Yes -DPASSGEN_SECCOMP=Yes ..
- ninja
- ./src/tests/passgen-test
- ../scripts/test-passgen-cli.sh ./src/cli/passgen
- cpack -G TXZ
artifacts:
paths:
- build-alpine-release
expire_in: 1 week
build:wasi:
image: "$CI_REGISTRY_IMAGE/wasi"
stage: build
dependencies:
- wordlists
script:
- mkdir build-wasi && cd build-wasi
- cmake -DLIBPASSGEN_SHARED=OFF -DPASSGEN_MLOCK=OFF ..
- make -j passgen-cli
artifacts:
paths:
- build-wasi
expire_in: 1 week
website:mkdocs:
image: "$CI_REGISTRY_IMAGE/deploy"
stage: post
script:
- bash scripts/ci-publish-website.sh
artifacts:
paths:
- public
expire_in: 30 days
website:builds:
image: "$CI_REGISTRY_IMAGE/deploy"
stage: post
dependencies:
- build:alpine
- build:amd64
- build:aarch64
- build:macos
- build:riscv64
- build:mingw64
- build:wasi
script:
- bash scripts/ci-publish-builds.sh
artifacts:
paths:
- public
expire_in: 30 days
only:
- master
website:doxygen:
image: "$CI_REGISTRY_IMAGE/deploy"
stage: post
script:
- bash scripts/ci-publish-doxygen.sh
artifacts:
paths:
- public
expire_in: 30 days
website:coverage:
image: "$CI_REGISTRY_IMAGE/deploy"
stage: post
dependencies:
- test:amd64
script:
- bash scripts/ci-publish-coverage.sh
artifacts:
paths:
- public
expire_in: 30 days
pages:
image: alpine
stage: deploy
dependencies:
- website:mkdocs
- website:builds
- website:doxygen
- website:coverage
script:
- "true"
artifacts:
paths:
- public
expire_in: 30 days
only:
- master