forked from racket/racket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
443 lines (409 loc) · 14.2 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
stages:
- prepare
- test
# ---------------------------------------------------------------------------------------------------
# Using debian:stable-slim to perform an llvm build with Z3 support
# The reason this is necessary is that we need Z3 support in scan-build
# to be able to crosscheck errors with z3 which decreases the false positives
# rate by around 5%.
#
# Also, this should only be performed once. Once in cache llvm won't be build anymore
# until we force it.
prepare-cache:llvm:
image: debian:stable-slim
stage: prepare
tags:
- linux
- x86_64
variables:
INSTALL_DIR: $CI_PROJECT_DIR/install
script:
- if [ -d $INSTALL_DIR ]; then exit 0; fi
- apt-get update && apt-get install -y gcc git cmake wget unzip g++ python libxml2-dev
- wget https://github.com/Z3Prover/z3/releases/download/Z3-4.8.5/z3-4.8.5-x64-debian-8.11.zip
- unzip z3-4.8.5-x64-debian-8.11.zip
- mkdir $INSTALL_DIR
- mv z3-4.8.5-x64-debian-8.11/bin z3-4.8.5-x64-debian-8.11/include $INSTALL_DIR
- export PATH=$INSTALL_DIR/bin:$PATH
- git clone --depth=1 -b release/8.x https://github.com/llvm/llvm-project.git
- cd llvm-project
- mkdir build
- cd build
- cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DCLANG_ANALYZER_ENABLE_Z3_SOLVER=ON -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_PROJECTS=clang -DZ3_INCLUDE_DIR=$INSTALL_DIR/include/ -DCMAKE_BUILD_TYPE=MinSizeRel ../llvm/
- export cpus=$(grep -c ^processor /proc/cpuinfo)
- echo "Detected $cpus cpus"
- make -j$((cpus + 1)) -l$cpus
- make -j$((cpus + 1)) -l$cpus install
cache:
key: llvm-8x-HEAD
paths:
- $INSTALL_DIR
artifacts:
name: "llvm-8x-HEAD"
paths:
- $INSTALL_DIR
expire_in: 1 week
# Build racket with scan-build
scan-build:racket:
stage: test
tags:
- linux
- x86_64
variables:
INSTALL_DIR: $CI_PROJECT_DIR/install
before_script:
- apt-get update && apt-get install -y unzip python libxml2-dev libfindbin-libs-perl make gcc g++
- find $INSTALL_DIR -type f
script:
- export PATH=$INSTALL_DIR/bin:$PATH
- export LD_LIBRARY_PATH=$INSTALL_DIR/bin:$LD_LIBRARY_PATH
- export cpus=$(grep -c ^processor /proc/cpuinfo)
- echo "Detected $cpus cpus"
- scan-build -o scan-report_cc -analyzer-config 'crosscheck-with-z3=true' make --load-average=$cpus PKGS="" CPUS=$((cpus + 1)) CONFIGURE_ARGS_qq='CFLAGS="-O0 -g" --disable-strip'
dependencies:
- prepare-cache:llvm
artifacts:
paths:
- scan-report_cc/
# Build racketcs with scan-build
scan-build:racketcs:
stage: test
tags:
- linux
- x86_64
variables:
INSTALL_DIR: $CI_PROJECT_DIR/install
before_script:
- apt-get update && apt-get install -y unzip python libxml2-dev libfindbin-libs-perl make gcc g++ git uuid-dev
- find $INSTALL_DIR -type f
script:
- export PATH=$INSTALL_DIR/bin:$PATH
- export LD_LIBRARY_PATH=$INSTALL_DIR/bin:$LD_LIBRARY_PATH
- export cpus=$(grep -c ^processor /proc/cpuinfo)
- echo "Detected $cpus cpus"
- scan-build -o scan-report-cs_cc -analyzer-config 'crosscheck-with-z3=true' make --load-average=$cpus PKGS="" CPUS=$((cpus + 1)) CONFIGURE_ARGS_qq='CFLAGS="-O0 -g" --disable-strip' cs
dependencies:
- prepare-cache:llvm
artifacts:
paths:
- scan-report-cs_cc/
# ---------------------------------------------------------------------------------------------------
##
## The following jobs build/test racket and racketcs with ubsan enabled
##
.prepare:
stage: test
image: ubuntu:18.04
before_script:
- apt-get update && apt-get install -y git lsb-release gcc gcc-8 g++ g++-8 make libfontconfig1-dev libcairo2-dev openssl libpango1.0-dev libjpeg-turbo8-dev libncurses5-dev uuid-dev
- update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 700 --slave /usr/bin/g++ g++ /usr/bin/g++-7
- update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 800 --slave /usr/bin/g++ g++ /usr/bin/g++-8
- export PATH=$PWD/racket/bin:$PATH
test:ubsan:
extends: .prepare
script:
- mkdir logs
- make CPUS="2" PKGS="racket-test db-test unstable-flonum-lib net-test" CONFIGURE_ARGS_qq='CFLAGS="-fno-var-tracking-assignments" --enable-ubsan' in-place 2>&1 | tee logs/build.log
- sed -i 's/(sleep 1200)/(sleep 3600)/' pkgs/racket-test-core/tests/racket/quiet.rktl
- raco test -l tests/racket/test 2>&1 | tee logs/test.log
- racket -l tests/racket/contract/all 2>&1 | tee logs/contract-test.log
- raco test -l tests/json/json 2>&1 | tee logs/json-test.log
- raco test -l tests/file/main 2>&1 | tee logs/file-test.log
- raco test -l tests/net/head 2>&1 | tee logs/net-head-test.log
- raco test -l tests/net/uri-codec 2>&1 | tee logs/net-uri-codec-test.log
- raco test -l tests/net/url 2>&1 | tee logs/net-url-test.log
- raco test -l tests/net/url-port 2>&1 | tee logs/net-url-port-test.log
- raco test -l tests/net/encoders 2>&1 | tee logs/net-encoders-test.log
- raco test -l tests/openssl/basic 2>&1 | tee logs/openssl-basic-test.log
- raco test -l tests/openssl/https 2>&1 | tee logs/openssl-https-test.log
- raco test -l tests/match/main 2>&1 | tee logs/match-main-test.log
- raco test -l tests/zo-path 2>&1 | tee logs/zo-path-test.log
- raco test -l tests/xml/test 2>&1 | tee logs/xml-test.log
- raco test -l tests/db/all-tests 2>&1 | tee logs/db-test.log
- raco test -c tests/stxparse 2>&1 | tee logs/stxparse-test.log
after_script:
- grep 'runtime error' logs/*.log > runtime-errors.log
artifacts:
when: always
paths:
- logs/
- runtime-errors.log
# Currently there are still some failures in racketcs so we allow failure
# at the moment but should be removed later on.
test:ubsan:cs:
extends: .prepare
allow_failure: true
script:
- mkdir cs-logs
- make CPUS="2" PKGS="racket-test db-test unstable-flonum-lib net-test" CONFIGURE_ARGS_qq='CFLAGS="-fno-var-tracking-assignments" --enable-ubsan' cs 2>&1 | tee cs-logs/build.log
- sed -i 's/(sleep 1200)/(sleep 3600)/' pkgs/racket-test-core/tests/racket/quiet.rktl
- racocs test -l tests/racket/test 2>&1 | tee cs-logs/test.log
- racketcs -l tests/racket/contract/all 2>&1 | tee cs-logs/contract-test.log
- racocs test -l tests/json/json 2>&1 | tee cs-logs/json-test.log
- racocs test -l tests/file/main 2>&1 | tee cs-logs/file-test.log
- racocs test -l tests/net/head 2>&1 | tee cs-logs/net-head-test.log
- racocs test -l tests/net/uri-codec 2>&1 | tee cs-logs/net-uri-codec-test.log
- racocs test -l tests/net/url 2>&1 | tee cs-logs/net-url-test.log
- racocs test -l tests/net/url-port 2>&1 | tee cs-logs/net-url-port-test.log
- racocs test -l tests/net/encoders 2>&1 | tee cs-logs/net-encoders-test.log
- racocs test -l tests/openssl/basic 2>&1 | tee cs-logs/openssl-basic-test.log
- racocs test -l tests/openssl/https 2>&1 | tee cs-logs/openssl-https-test.log
- racocs test -l tests/match/main 2>&1 | tee cs-logs/match-main-test.log
- racocs test -l tests/zo-path 2>&1 | tee cs-logs/zo-path-test.log
- racocs test -l tests/xml/test 2>&1 | tee cs-logs/xml-test.log
- racocs test -l tests/db/all-tests 2>&1 | tee cs-logs/db-test.log
- racocs test -c tests/stxparse 2>&1 | tee cs-logs/stxparse-test.log
after_script:
- grep 'runtime error' cs-logs/*.log > runtime-errors.log
artifacts:
when: always
paths:
- cs-logs/
- runtime-errors.log
# ---------------------------------------------------------------------------------------------------
# Runs a cross compilation and testing using qemu chrooted into the correct architecture
# Each of the test:<arch>: will extend .preparearch which run the proper script
# Currently testing:
# * arm64
# * armel
# * armhf
# * i386
# * mips
# * mipsel
# * mips64el
# * s390x
# * ppc64el
prepare-cache:qemu:
image: ubuntu:18.04
stage: prepare
tags:
- linux
- x86_64
- privileged
variables:
INSTALL_DIR: $CI_PROJECT_DIR/install
script:
- if [ -d $INSTALL_DIR ]; then exit 0; fi
- apt-get update && apt-get install -y gcc make bison flex git wget xz-utils python pkg-config libglib2.0-dev libpixman-1-dev
- wget https://download.qemu.org/qemu-3.1.0.tar.xz
- tar -xvJf qemu-3.1.0.tar.xz
- mkdir qemu-build
- cd qemu-build
- ../qemu-3.1.0/configure --static --disable-kvm --disable-xen --disable-spice --target-list='i386-linux-user aarch64-linux-user arm-linux-user mips-linux-user mipsel-linux-user mips64el-linux-user s390x-linux-user ppc64le-linux-user riscv64-linux-user' --prefix=$INSTALL_DIR
- export cpus=$(grep -c ^processor /proc/cpuinfo)
- echo "Detected $cpus cpus"
- make -j$((cpus + 1)) --load-average=$cpus
- make -j$((cpus + 1)) --load-average=$cpus install
cache:
key: qemu-3.1.0
paths:
- $INSTALL_DIR
artifacts:
name: "qemu-3.1.0"
paths:
- $INSTALL_DIR
expire_in: 1 week
.preparearch:
image: ubuntu:18.04
stage: test
tags:
- x86_64
- privileged
- linux
before_script:
- ls -la
- find $INSTALL_DIR -type f
- export PATH=$INSTALL_DIR/bin:$PATH
- apt-get update
script:
- export cpus=$(grep -c ^processor /proc/cpuinfo)
- echo "Detected $cpus cpus"
- .gitlab/build-test.sh --jobs $((cpus + 1)) --maxload ${cpus} --with-arch ${ARCH} --with-debian stretch --with-debian-mirror http://ftp.de.debian.org/debian/ --with-project-path ${CI_PROJECT_DIR} --with-chroot-path /tmp/racket-${ARCH}-${CI_COMMIT_SHORT_SHA}-chroot --with-qemu-path $INSTALL_DIR
dependencies:
- prepare-cache:qemu
test:native:x86_64:
extends: .preparearch
variables:
ARCH: "x86_64"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:native:armv7l:
extends: .preparearch
allow_failure: true
variables:
ARCH: "armv7l"
INSTALL_DIR: $CI_PROJECT_DIR/install
tags:
- armv7l
- linux
# Emulation targets
test:emulation:arm64:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "arm64"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:armel:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "armel"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:armhf:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "armhf"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:i386:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "i386"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:mips:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "mips"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:mipsel:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "mipsel"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:mips64el:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "mips64el"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:s390x:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "s390x"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:ppc64el:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "ppc64el"
INSTALL_DIR: $CI_PROJECT_DIR/install
# Emulation targets with --disable-generations
.preparearch:nogenerations:
image: ubuntu:18.04
stage: test
only:
- schedules
tags:
- x86_64
- privileged
- linux
before_script:
- ls -la
- find $INSTALL_DIR -type f
- export PATH=$INSTALL_DIR/bin:$PATH
- apt-get update
script:
- export cpus=$(grep -c ^processor /proc/cpuinfo)
- echo "Detected $cpus cpus"
- .gitlab/build-test.sh --jobs $((cpus + 1)) --maxload ${cpus} --with-arch ${ARCH} --with-debian stretch --with-debian-mirror http://ftp.de.debian.org/debian/ --with-project-path ${CI_PROJECT_DIR} --with-chroot-path /tmp/racket-${ARCH}-${CI_COMMIT_SHORT_SHA}-chroot --with-qemu-path $INSTALL_DIR --with-configure-args '--disable-generations'
dependencies:
- prepare-cache:qemu
test:emulation:nogenerations:arm64:
extends: .preparearch:nogenerations
allow_failure: true
variables:
ARCH: "arm64"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:nogenerations:armel:
extends: .preparearch:nogenerations
allow_failure: true
variables:
ARCH: "armel"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:nogenerations:armhf:
extends: .preparearch:nogenerations
allow_failure: true
variables:
ARCH: "armhf"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:nogenerations:mips:
extends: .preparearch:nogenerations
allow_failure: true
variables:
ARCH: "mips"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:nogenerations:mipsel:
extends: .preparearch:nogenerations
allow_failure: true
variables:
ARCH: "mipsel"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:nogenerations:mips64el:
extends: .preparearch:nogenerations
allow_failure: true
variables:
ARCH: "mips64el"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:nogenerations:s390x:
extends: .preparearch:nogenerations
allow_failure: true
variables:
ARCH: "s390x"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:nogenerations:ppc64el:
extends: .preparearch:nogenerations
allow_failure: true
variables:
ARCH: "ppc64el"
INSTALL_DIR: $CI_PROJECT_DIR/install
# CS
.preparearch:cs:
image: ubuntu:18.04
stage: test
tags:
- x86_64
- privileged
- linux
before_script:
- export PATH=$INSTALL_DIR:$PATH
- apt-get update
script:
- export cpus=$(grep -c ^processor /proc/cpuinfo)
- echo "Detected $cpus cpus"
- .gitlab/build-test.sh --jobs $((cpus + 1)) --maxload ${cpus} --with-arch ${ARCH} --with-debian stretch --with-debian-mirror http://ftp.de.debian.org/debian/ --with-project-path ${CI_PROJECT_DIR} --with-chroot-path /tmp/racket-${ARCH}-${CI_COMMIT_SHORT_SHA}-chroot --enable-cs --with-qemu-path $INSTALL_DIR
dependencies:
- prepare-cache:qemu
test:native:x86_64:cs:
extends: .preparearch:cs
variables:
ARCH: "x86_64"
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:i386:cs:
extends: .preparearch:cs
allow_failure: true
only:
- schedules
variables:
ARCH: "i386"
INSTALL_DIR: $CI_PROJECT_DIR/install