-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
447 lines (378 loc) · 10.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
443
444
445
446
447
image: "$IMAGE"
stages:
- docker
- build
- test
# some default values
variables:
# Format: $IMAGE-V$DATE [Cache is not used as of today but kept here
# for reference]
CACHEKEY: "bionic_coq-V2018-10-04-V1"
IMAGE: "$CI_REGISTRY_IMAGE:$CACHEKEY"
# By default, jobs run in the base switch; override to select another switch
OPAM_SWITCH: "base"
# Used to select special compiler switches such as flambda, 32bits, etc...
OPAM_VARIANT: ""
docker-boot:
stage: docker
image: docker:stable
services:
- docker:dind
before_script: []
script:
- docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" "$CI_REGISTRY"
- cd dev/ci/docker/bionic_coq/
- if docker pull "$IMAGE"; then echo "Image prebuilt!"; exit 0; fi
- docker build -t "$IMAGE" .
- docker push "$IMAGE"
except:
variables:
- $SKIP_DOCKER == "true"
tags:
- docker
before_script:
- cat /proc/{cpu,mem}info || true
- ls -a # figure out if artifacts are around
- printenv -0 | sort -z | tr '\0' '\n'
- declare -A switch_table
- switch_table=( ["base"]="$COMPILER" ["edge"]="$COMPILER_EDGE" )
- opam switch set -y "${switch_table[$OPAM_SWITCH]}$OPAM_VARIANT"
- eval $(opam env)
- opam list
- opam config list
after_script:
- echo "The build completed normally (not a runner failure)."
################ GITLAB CACHING ######################
# - use artifacts between jobs #
######################################################
# TODO figure out how to build doc for installed Coq
.build-template: &build-template
stage: build
artifacts:
name: "$CI_JOB_NAME"
paths:
- _install_ci
- config/Makefile
- config/coq_config.py
- test-suite/misc/universes/all_stdlib.v
expire_in: 1 week
script:
- set -e
- echo 'start:coq.clean'
- make clean # ensure that `make clean` works on a fresh clone
- echo 'end:coq.clean'
- echo 'start:coq.config'
- ./configure -warn-error yes -prefix "$(pwd)/_install_ci" ${COQ_EXTRA_CONF}"$COQ_EXTRA_CONF_QUOTE"
- echo 'end:coq.config'
- echo 'start:coq.build'
- make -j "$NJOBS" byte
- make -j "$NJOBS" world $EXTRA_TARGET
- make test-suite/misc/universes/all_stdlib.v
- echo 'end:coq:build'
- echo 'start:coq.install'
- make install
- make install-byte
- cp bin/fake_ide _install_ci/bin/
- echo 'end:coq.install'
- set +e
.dune-template: &dune-template
dependencies: []
stage: build
artifacts:
name: "$CI_JOB_NAME"
paths:
- _build/
expire_in: 1 week
script:
- set -e
- make -f Makefile.dune "$DUNE_TARGET"
- set +e
# every non build job must set dependencies otherwise all build
# artifacts are used together and we may get some random Coq. To that
# purpose, we add a spurious dependency `not-a-real-job` that must be
# overridden otherwise the CI will fail.
.doc-template: &doc-template
stage: test
dependencies:
- not-a-real-job
script:
- SPHINXENV='COQBIN="'"$PWD"'/_install_ci/bin/" COQBOOT=no'
- make -j "$NJOBS" SPHINXENV="$SPHINXENV" SPHINX_DEPS= refman
- make install-doc-sphinx
artifacts:
name: "$CI_JOB_NAME"
paths:
- _install_ci/share/doc/coq/
# set dependencies when using
.test-suite-template: &test-suite-template
stage: test
dependencies:
- not-a-real-job
script:
- cd test-suite
- make clean
# careful with the ending /
- BIN=$(readlink -f ../_install_ci/bin)/
- LIB=$(readlink -f ../_install_ci/lib/coq)/
- export OCAMLPATH=$(readlink -f ../_install_ci/lib/):"$OCAMLPATH"
- make -j "$NJOBS" BIN="$BIN" LIB="$LIB" all
artifacts:
name: "$CI_JOB_NAME.logs"
when: on_failure
paths:
- test-suite/logs
# set dependencies when using
.validate-template: &validate-template
stage: test
dependencies:
- not-a-real-job
script:
- cd _install_ci
- find lib/coq/ -name '*.vo' -print0 > vofiles
- for regexp in 's/.vo//' 's:lib/coq/plugins:Coq:' 's:lib/coq/theories:Coq:' 's:/:.:g'; do sed -z -i "$regexp" vofiles; done
- xargs -0 --arg-file=vofiles bin/coqchk -boot -silent -o -m -coqlib lib/coq/
.ci-template: &ci-template
stage: test
script:
- set -e
- echo 'start:coq.test'
- make -f Makefile.ci -j "$NJOBS" ${TEST_TARGET}
- echo 'end:coq.test'
- set +e
dependencies:
- build:base
variables: &ci-template-vars
TEST_TARGET: "$CI_JOB_NAME"
.ci-template-flambda: &ci-template-flambda
<<: *ci-template
dependencies:
- build:edge+flambda
variables:
<<: *ci-template-vars
OPAM_SWITCH: "edge"
OPAM_VARIANT: "+flambda"
.windows-template: &windows-template
stage: test
artifacts:
name: "%CI_JOB_NAME%"
paths:
- artifacts
when: always
expire_in: 1 week
dependencies: []
tags:
- windows
before_script: []
script:
- call dev/ci/gitlab.bat
only:
variables:
- $WINDOWS =~ /enabled/
build:base:
<<: *build-template
variables:
COQ_EXTRA_CONF: "-native-compiler yes -coqide opt"
# coqdoc for stdlib, until we know how to build it from installed Coq
EXTRA_TARGET: "stdlib"
# no coqide for 32bit: libgtk installation problems
build:base+32bit:
<<: *build-template
variables:
OPAM_VARIANT: "+32bit"
COQ_EXTRA_CONF: "-native-compiler yes"
build:edge:
<<: *build-template
variables:
OPAM_SWITCH: edge
COQ_EXTRA_CONF: "-native-compiler yes -coqide opt"
build:edge+flambda:
<<: *build-template
variables:
OPAM_SWITCH: edge
OPAM_VARIANT: "+flambda"
COQ_EXTRA_CONF: "-native-compiler yes -coqide opt -flambda-opts "
COQ_EXTRA_CONF_QUOTE: "-O3 -unbox-closures"
build:egde:dune:dev:
<<: *dune-template
variables:
OPAM_SWITCH: edge
DUNE_TARGET: world
windows64:
<<: *windows-template
variables:
ARCH: "64"
windows32:
<<: *windows-template
variables:
ARCH: "32"
except:
- /^pr-.*$/
pkg:opam:
stage: test
# OPAM will build out-of-tree so no point in importing artifacts
dependencies: []
script:
- set -e
- opam pin add coq .
- opam pin add coqide-server .
- opam pin add coqide .
- set +e
variables:
OPAM_SWITCH: edge
pkg:nix:
image: nixorg/nix:latest # Minimal NixOS image which doesn't even contain git
stage: test
variables:
# By default we use coq.cachix.org as an extra substituter but this can be overridden
EXTRA_SUBSTITUTERS: https://coq.cachix.org
EXTRA_PUBLIC_KEYS: coq.cachix.org-1:Jgt0DwGAUo+wpxCM52k2V+E0hLoOzFPzvg94F65agtI=
# The following variables should not be overridden
GIT_STRATEGY: none
CACHIX_PUBLIC_KEY: cachix.cachix.org-1:eWNHQldwUO7G2VkjpnjDbWwy4KQ/HNxht7H4SSoMckM=
NIXOS_PUBLIC_KEY: cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
dependencies: [] # We don't need to download build artifacts
before_script: [] # We don't want to use the shared 'before_script'
script:
# Use current worktree as tmpdir to allow exporting artifacts in case of failure
- export TMPDIR=$PWD
# Install Cachix as documented at https://github.com/cachix/cachix
- nix-env -if https://github.com/cachix/cachix/tarball/master --substituters https://cachix.cachix.org --trusted-public-keys "$CACHIX_PUBLIC_KEY"
# We build an expression rather than a direct URL to not be dependent on
# the URL location; we are forced to put the public key of cache.nixos.org
# because there is no --extra-trusted-public-key option.
- nix-build -E "import (fetchTarball $CI_PROJECT_URL/-/archive/$CI_COMMIT_SHA.tar.gz) {}" -K --extra-substituters "$EXTRA_SUBSTITUTERS" --trusted-public-keys "$NIXOS_PUBLIC_KEY $EXTRA_PUBLIC_KEYS" | if [ ! -z "$CACHIX_SIGNING_KEY" ]; then cachix push coq; fi
artifacts:
name: "$CI_JOB_NAME.logs"
when: on_failure
paths:
- nix-build-coq.drv-0/*/test-suite/logs
doc:refman:
<<: *doc-template
dependencies:
- build:base
doc:ml-api:odoc:
stage: test
dependencies:
- build:egde:dune:dev
script: make -f Makefile.dune apidoc
variables:
OPAM_SWITCH: edge
artifacts:
name: "$CI_JOB_NAME"
paths:
- _build/default/_doc/
test-suite:base:
<<: *test-suite-template
dependencies:
- build:base
test-suite:base+32bit:
<<: *test-suite-template
dependencies:
- build:base+32bit
variables:
OPAM_VARIANT: "+32bit"
test-suite:edge:
<<: *test-suite-template
dependencies:
- build:edge
variables:
OPAM_SWITCH: edge
test-suite:edge+flambda:
<<: *test-suite-template
dependencies:
- build:edge+flambda
variables:
OPAM_SWITCH: edge
OPAM_VARIANT: "+flambda"
test-suite:egde:dune:dev:
stage: test
dependencies:
- build:egde:dune:dev
script: make -f Makefile.dune test-suite
variables:
OPAM_SWITCH: edge
artifacts:
name: "$CI_JOB_NAME.logs"
when: on_failure
paths:
- _build/default/test-suite/logs
validate:base:
<<: *validate-template
dependencies:
- build:base
validate:base+32bit:
<<: *validate-template
dependencies:
- build:base+32bit
variables:
OPAM_VARIANT: "+32bit"
validate:edge:
<<: *validate-template
dependencies:
- build:edge
variables:
OPAM_SWITCH: edge
validate:edge+flambda:
<<: *validate-template
dependencies:
- build:edge+flambda
variables:
OPAM_SWITCH: edge
OPAM_VARIANT: "+flambda"
ci-aac-tactics:
<<: *ci-template
ci-bedrock2:
<<: *ci-template
allow_failure: true
ci-bignums:
<<: *ci-template
ci-color:
<<: *ci-template-flambda
ci-compcert:
<<: *ci-template-flambda
ci-coq-dpdgraph:
<<: *ci-template
ci-coquelicot:
<<: *ci-template
ci-cross-crypto:
<<: *ci-template
ci-elpi:
<<: *ci-template
ci-equations:
<<: *ci-template
ci-fcsl-pcm:
<<: *ci-template
ci-fiat-crypto:
<<: *ci-template-flambda
ci-fiat-crypto-legacy:
<<: *ci-template-flambda
ci-fiat-parsers:
<<: *ci-template
ci-flocq:
<<: *ci-template
ci-formal-topology:
<<: *ci-template-flambda
ci-geocoq:
<<: *ci-template-flambda
ci-hott:
<<: *ci-template
ci-iris-lambda-rust:
<<: *ci-template-flambda
ci-ltac2:
<<: *ci-template
ci-math-comp:
<<: *ci-template-flambda
ci-mtac2:
<<: *ci-template
ci-pidetop:
<<: *ci-template
ci-plugin-tutorial:
<<: *ci-template
ci-quickchick:
<<: *ci-template-flambda
ci-sf:
<<: *ci-template
ci-unimath:
<<: *ci-template-flambda
ci-vst:
<<: *ci-template-flambda