-
Notifications
You must be signed in to change notification settings - Fork 79
/
.gitlab-ci.yml
463 lines (431 loc) · 13.9 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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# we utilize the images generated by the build-images project, to
# speed up CI runs. We also use ccache and store config.cache
# to speed up compilation. We include a version number in cache
# name to allow expiration of old caches.
stages:
- tarball
- stage1-testing
cache:
key: "$CI_JOB_NAME-wget2"
paths:
- cache/
before_script:
# CCache Config
- mkdir -p cache
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/cache
- echo $CCACHE_DIR
- export CC="ccache gcc"
after_script:
# somehow after_script looses environment
- export CCACHE_BASEDIR=${PWD}
- export CCACHE_DIR=${PWD}/cache
- ccache -s 2>/dev/null
variables:
BUILD_IMAGES_PROJECT: gnuwget/build-images
DEBIAN_BUILD: buildenv-wget2-debian-stable
DEBIAN_TESTING_BUILD: buildenv-wget2-debian-testing
DEBIAN_STABLE_BUILD: buildenv-wget2-debian-stable
DEBIAN_STABLEi386_BUILD: buildenv-debian-stable-i386
DEBIAN_UNSTABLE_BUILD: buildenv-wget2-debian-unstable
DEBIAN_HTTP2_BUILD: buildenv-mhd-http2
FEDORA_BUILD: buildenv-wget2-fedora
MINGW_BUILD: buildenv-mingw
MINGW_BUILD_STATIC: buildenv-mingw-static
ALPINE_BUILD: buildenv-wget2-alpine
ARCH_BUILD: buildenv-arch
# BASIC_BUILD: buildenv-wget2-basic
TARBALL_BUILD: buildenv-wget2-tarball
GET_SOURCES_ATTEMPTS: "3"
GIT_DEPTH: "5"
CONFIGURE_BASE_FLAGS: --enable-assert --cache-file ../cache/config.cache --enable-manywarnings
CFLAGS_DEFAULT: -O1 -g -ggdb3
sast:
stage: tarball
# SAST customization: https://docs.gitlab.com/ee/user/application_security/sast/#customizing-the-sast-settings
variables:
SAST_EXCLUDED_PATHS: examples, fuzz, tests, unit-tests
include:
- template: Security/SAST.gitlab-ci.yml
.defaults:
variables:
GIT_STRATEGY: none
except:
- coverity-scan@gnuwget/wget2
artifacts:
expire_in: 2 weeks
when: on_failure
paths:
- ./**/config.h
- ./**/*.log
dependencies:
- Build-Tarball
needs: ["Build-Tarball"]
# We organize the CI runners as thus:
# Stage 'tarball' includes:
# - commit check
# - spell check
# - tarball build including docs (on Debian Testing)
#
# Stage 'stage1-testing' includes:
# 1. Debian Testing Build:
# * ASan and UBSan builds
# * make syntax-check
# * make distcheck
#
# 2. Fedora Build
# * LLVM/Clang Build
# * Valgrind Tests
#
# This way we split most of the different build options across different
# platforms as well. Other builds we would like to have:
#
# 1. Windows
# 2. OSX
# 3. Documentation Generation and Gitlab pages
# 4. Code coverage stats
CommitCheck:
stage: tarball
image: alpine:latest
before_script:
- /bin/true
script:
- apk add git py3-pip
# - apk add py3-codespell --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/
- pip install --break-system-packages codespell
- contrib/commit-check
- contrib/spell-checker
after_script:
- /bin/true
allow_failure: true
cache:
paths:
policy: push
# Create the tarball for further testing.
# Runs syntax-check, so no need to do this later on.
Build-Tarball:
stage: tarball
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TARBALL_BUILD
extends:
- .defaults
variables:
GIT_STRATEGY: clone
script:
- rmdir gnulib && mv /gnulib . && git submodule update gnulib
- ./bootstrap
- mkdir vpath && cd vpath
- export CC=gcc
- export CFLAGS="-O0"
- ../configure $CONFIGURE_BASE_FLAGS --with-ssl=none
- make -j$(nproc) syntax-check
- make -j$(nproc) -C docs
- make -j$(nproc) dist-gzip
- mv wget2-*.gz ..
artifacts:
expire_in: 2 weeks
when: on_success
paths:
- wget2-*.gz
dependencies:
needs: []
# Debian Testing
# - using dash to detect bashims in configure.ac
DebianTesting:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_TESTING_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- CONFIG_SHELL=/bin/dash dash ./configure $CONFIGURE_BASE_FLAGS
--enable-manylibs -q 2>&1 >/dev/null
| grep -v "libhsts was not found" | grep . && exit 1
- make -j$(nproc) -C lib
- make check -j$(nproc) CFLAGS="$CFLAGS_DEFAULT -Werror"
# Debian Unstable
Debian/Unstable:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_UNSTABLE_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- ./configure $CONFIGURE_BASE_FLAGS
- make -j$(nproc) -C lib
- make -j$(nproc) check CFLAGS="$CFLAGS_DEFAULT -Werror"
Debian/WolfSSL:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_TESTING_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- ./configure $CONFIGURE_BASE_FLAGS --with-ssl=wolfssl
- make check -j$(nproc)
Debian/OpenSSL:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_TESTING_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- ./configure $CONFIGURE_BASE_FLAGS --with-ssl=openssl
- make check -j$(nproc)
Fedora:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- ./configure $CONFIGURE_BASE_FLAGS --enable-manywarnings
- make -j$(nproc) -C lib
- make -j$(nproc) check CFLAGS="$CFLAGS_DEFAULT -Werror"
Alpine:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$ALPINE_BUILD
extends:
- .defaults
variables:
GIT_STRATEGY: none
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- ./configure $CONFIGURE_BASE_FLAGS
- make -j$(nproc) -C lib
- make -j$(nproc) check CFLAGS="$CFLAGS_DEFAULT -Werror -Wno-cpp"
# In this build we combine
# * gcc
# * check, syntax-check
Minimal/Debian:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- ./configure $CONFIGURE_BASE_FLAGS --disable-doc
--disable-xattr --with-ssl=none --without-libpsl --without-libnghttp2 --without-bzip2
--without-gpgme --without-zlib --without-lzma --without-brotlidec --without-libidn2
--without-libidn --without-libpcre2 --without-libpcre --without-plugin-support
- make -j$(nproc) -C lib
- make -j$(nproc) check CFLAGS="$CFLAGS_DEFAULT -Werror"
# In this build we combine
# * clang
# * ASan, UBSan
# * check, syntax-check
Sanitizers/Debian:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_TESTING_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- export CC="ccache clang"
- export UBSAN_OPTIONS=print_stacktrace=1:report_error_type=1
- export LSAN_OPTIONS=suppressions="$PWD/tests/clang-asan-suppressions"
- export ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer
- ./configure $CONFIGURE_BASE_FLAGS --enable-fsanitize-asan --enable-fsanitize-ubsan
- make -j$(nproc) -C lib
- make -j$(nproc) check CFLAGS="$CFLAGS_DEFAULT -Werror"
Scan-Build/Debian:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_TESTING_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- export CC=clang
- ./configure $CONFIGURE_BASE_FLAGS
- make -j$(nproc) -C lib
- scan-build -v --use-cc=clang --force-analyze-debug-code --show-description -analyzer-config stable-report-filename=true -enable-checker valist,nullability --status-bugs -o scan-build make -j$(nproc)
- scan-build -v --use-cc=clang --force-analyze-debug-code --show-description -analyzer-config stable-report-filename=true -enable-checker valist,nullability --status-bugs -o scan-build make -j$(nproc) check
tags:
- saas-linux-xlarge-amd64
artifacts:
expire_in: 2 weeks
when: on_failure
paths:
- scan-build/*
.valgrind:
stage: stage1-testing
extends:
- .defaults
variables:
GIT_STRATEGY: clone
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && rm wget2-*.gz
- cd wget2-*
- mv ../fuzz/*.in fuzz/
- ./configure $CONFIGURE_BASE_FLAGS --enable-valgrind-tests --without-gpgme
- make -j$(nproc)
- make -j$(nproc) check
tags:
- saas-linux-xlarge-amd64
Valgrind/Debian:
extends:
- .valgrind
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_STABLE_BUILD
Valgrind/i386:
extends:
- .valgrind
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_STABLEi386_BUILD
pages:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_TESTING_BUILD
script:
- mkdir -p public
- apt-get -y update
- apt-get -y install libcapture-tiny-perl libdatetime-perl pandoc doxygen texinfo
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && mv wget2-*.gz wget2-latest.tar.gz
- cd wget2-*.*.?
- ./configure $CONFIGURE_BASE_FLAGS
- make -j$(nproc) check-coverage
# Tarball
- mv ../wget2-latest.tar.gz ../public/wget2-latest.tar.gz
# Test suite coverage report
- coverage=$(grep -m 1 'headerCovTableEntry[a-zA-Z].*[0-9]*' lcov/index.html|sed 's/^.*>\([0-9]\+\.[0-9]\+\).*/\1/')
- coverage=$(printf %.2f $coverage)
- inum=$(echo $coverage|cut -d'.' -f1)
- if [ -z "$inum" ]; then inum="0"; fi
- ../contrib/make-coverage-badge "coverage" "$coverage%"
- mv badge.svg ../public/coverage.svg
- rm -rf ../public/coverage
- mv lcov ../public/coverage
# Online Documentation
- make -C docs clean
- make -C docs
- rm -rf ../public/reference
- mv docs/html ../public/reference
# Coverage report for all our fuzz corpora
- make -j$(nproc) fuzz-coverage
- coverage=$(grep -m 1 'headerCovTableEntry[a-zA-Z].*[0-9]*' lcov/index.html|sed 's/^.*>\([0-9]\+\.[0-9]\+\).*/\1/')
- coverage=$(printf %.2f $coverage)
- inum=$(echo $coverage|cut -d'.' -f1)
- if [ -z "$inum" ]; then inum="0"; fi
- ../contrib/make-coverage-badge "fuzz-coverage" "$coverage%"
- mv badge.svg ../public/fuzz-coverage.svg
- rm -rf ../public/fuzz-coverage
- mv lcov ../public/fuzz-coverage
artifacts:
when: on_success
paths:
- public
only:
- master
MinGW64:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
extends:
- .defaults
script:
- mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc
- echo ':DOSWin:M::MZ::/usr/bin/wine:' > /proc/sys/fs/binfmt_misc/register
- export CFLAGS="$CFLAGS_DEFAULT"
- export CC="ccache $PREFIX-gcc"
- export GCCLIB=$(dirname $(find /usr/lib/gcc/$PREFIX -name libgcc_s_seh-1.dll|grep posix))
- export WINEPATH="$WINEPATH;/usr/$PREFIX/bin;/usr/$PREFIX/lib;$PWD/libwget/.libs;$GCCLIB"
- echo "WINEPATH=$WINEPATH"
- tar xf wget2-*.gz && mv wget2-*.gz wget2-latest.tar.gz
- cd wget2-*.*.?
- ./configure $CONFIGURE_BASE_FLAGS --cache-file cache/config.cache
--build=x86_64-pc-linux-gnu --host=$PREFIX --enable-shared
- make -j$(nproc)
- make check -j$(nproc) LOG_COMPILER=wine
tags:
- saas-linux-xlarge-amd64
allow_failure: true
MinGW64-static:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD_STATIC
script:
- unset CC
- tar xf wget2-*.gz && mv wget2-*.gz wget2-latest.tar.gz
- cd wget2-*.*.?
- LDFLAGS="-Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive"
CFLAGS="$CFLAGS_DEFAULT -DNGHTTP2_STATICLIB"
./configure $CONFIGURE_BASE_FLAGS --build=x86_64-pc-linux-gnu --host=$PREFIX
--disable-shared --enable-static --without-gpgme --enable-threads=windows
- make -j$(nproc)
- mv src/wget2.exe .
tags:
- saas-linux-xlarge-amd64
allow_failure: true
artifacts:
when: on_success
paths:
- wget2.exe
only:
- master
Arch:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$ARCH_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && mv wget2-*.gz wget2-latest.tar.gz
- cd wget2-*.*.?
- ./configure $CONFIGURE_BASE_FLAGS --cache-file cache/config.cache
- make -j$(nproc)
- make check -j$(nproc)
Debian/HTTP2:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_HTTP2_BUILD
extends:
- .defaults
script:
- export CFLAGS="$CFLAGS_DEFAULT"
- tar xf wget2-*.gz && mv wget2-*.gz wget2-latest.tar.gz
- cd wget2-*.*.?
- ./configure $CONFIGURE_BASE_FLAGS --enable-code-coverage --cache-file cache/config.cache
- make -j$(nproc)
- make check -j$(nproc)
- make code-coverage-capture
allow_failure: true
artifacts:
expire_in: 2 weeks
when: on_success
paths:
- wget2-*-coverage
coverity:
stage: stage1-testing
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
script:
- wget https://scan.coverity.com/download/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O /tmp/coverity_tool.tgz
- tar xfz /tmp/coverity_tool.tgz
- tar xf wget2-*.gz && mv wget2-*.gz wget2-latest.tar.gz
- cd wget2-*.*.?
- CFLAGS="-g -Og" ./configure --cache-file cache/config.cache --disable-doc
- cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j$(nproc)
- tar cfz cov-int.tar.gz cov-int
- curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
--form token=$COVERITY_SCAN_TOKEN --form [email protected]
--form [email protected] --form version="`git describe --tags`"
--form description="CI build"
only:
- coverity-scan@gnuwget/wget2
artifacts:
expire_in: 1 week
when: on_failure
paths:
- cov-int/*.txt