forked from racket/racket
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
365 lines (341 loc) · 11.7 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
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
- shared-cache
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.4/z3-4.8.4.d6df51951f4c-x64-debian-8.11.zip
- unzip z3-4.8.4.d6df51951f4c-x64-debian-8.11.zip
- mkdir $INSTALL_DIR
- mv z3-4.8.4.d6df51951f4c-x64-debian-8.11/bin z3-4.8.4.d6df51951f4c-x64-debian-8.11/include $INSTALL_DIR
- export PATH=$INSTALL_DIR/bin:$PATH
- git clone -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/
- make -j5
- make -j5 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
- shared-cache
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
- scan-build -o scan-report_cc -analyzer-config 'crosscheck-with-z3=true' make PKGS="" CPUS=5 CONFIGURE_ARGS_qq='CFLAGS="-O0 -g" CPPFLAGS="-DMZ_DECLARE_NORETURN" --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
- shared-cache
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
- scan-build -o scan-report-cs_cc -analyzer-config 'crosscheck-with-z3=true' make PKGS="" CPUS=5 CONFIGURE_ARGS_qq='CFLAGS="-O0 -g" CPPFLAGS="-DMZ_DECLARE_NORETURN" --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:
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:
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
- make -j5
- make -j5 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:
- .gitlab/build-test.sh --jobs ${JOBS} --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"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:native:armv7l:
extends: .preparearch
allow_failure: true
variables:
ARCH: "armv7l"
JOBS: 5
INSTALL_DIR: $CI_PROJECT_DIR/install
tags:
- armv7l
- linux
test:emulation:arm64:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "arm64"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:armel:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "armel"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:armhf:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "armhf"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:i386:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "i386"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:mips:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "mips"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:mipsel:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "mipsel"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:mips64el:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "mips64el"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:s390x:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "s390x"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:ppc64el:
extends: .preparearch
allow_failure: true
only:
- schedules
variables:
ARCH: "ppc64el"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
.preparearch:cs:
image: ubuntu:18.04
stage: test
tags:
- x86_64
- privileged
- linux
before_script:
- export PATH=$INSTALL_DIR:$PATH
- apt-get update
script:
- .gitlab/build-test.sh --jobs ${JOBS} --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
allow_failure: true
variables:
ARCH: "x86_64"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install
test:emulation:i386:cs:
extends: .preparearch:cs
allow_failure: true
only:
- schedules
variables:
ARCH: "i386"
JOBS: 6
INSTALL_DIR: $CI_PROJECT_DIR/install