aboutsummaryrefslogtreecommitdiffhomepage
path: root/.circleci/config.yml
blob: 9b0cc211976a95ce252a83e01d2d42f2355ca324 (plain)
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
defaults:
  params: &params
    # Following parameters are used in Coq CircleCI Job (using yaml
    # reference syntax)
    working_directory: ~/coq
    docker:
      - image: ocaml/opam:ubuntu

  environment: &envvars
    # required by some of the targets, e.g. compcert, passed for
    # instance to opam to configure the number of parallel jobs
    # allowed
    NJOBS: 2
    COMPILER: "system"
    CAMLP5_VER: "6.14"
    NATIVE_COMP: "yes"

    # some useful values
    COMPILER_32BIT: &compiler-32bit "4.02.3+32bit"

    COMPILER_BLEEDING_EDGE: &compiler-be "4.06.0"
    CAMLP5_VER_BLEEDING_EDGE: &camlp5-ver-be "7.03"

    TIMING_PACKAGES: &timing-packages "time python"

    COQIDE_PACKAGES: &coqide-packages "libgtk2.0-dev libgtksourceview2.0-dev"
    #COQIDE_PACKAGES_32BIT: "libgtk2.0-dev:i386 libgtksourceview2.0-dev:i386"
    COQIDE_OPAM: &coqide-opam "lablgtk-extras"
    COQIDE_OPAM_BE: &coqide-opam-be "num lablgtk.2.18.6 lablgtk-extras.1.6"
    COQDOC_PACKAGES: &coqdoc-packages "texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-math-extra texlive-fonts-recommended texlive-fonts-extra latex-xcolor ghostscript transfig imagemagick tipa"
    COQDOC_OPAM: &coqdoc-opam "hevea"

version: 2

before_script: &before_script
  name: Install system packages
  command: |
    echo export TERM=xterm >> ~/.profile
    source ~/.profile
    printenv
    #if [ "$COMPILER" = "$COMPILER_32BIT" ]; then sudo dpkg --add-architecture i386; fi
    if [ -n "${EXTRA_PACKAGES}" ]; then sudo apt-get update -yq && sudo apt-get install -yq --no-install-recommends ${EXTRA_PACKAGES}; fi

opam-switch: &opam-switch
  name: Select opam switch
  command: |
    source ~/.profile
    opam switch ${COMPILER}
    opam config list
    opam list

.opam-boot-template: &opam-boot-template
  <<: *params
  steps:
    - checkout
    - run: *before_script
    - run:
        name: Cache selection
        command: |
          source ~/.profile
          # We can't use environment variables in cache names
          # So put it in a file and use the checksum
          echo "$COMPILER" > COMPILER
    - restore_cache:
        keys:
          - coq-opam-cache-v1-{{ arch }}-{{ checksum "COMPILER" }}-{{ checksum ".circleci/config.yml" }}-
          - coq-opam-cache-v1-{{ arch }}-{{ checksum "COMPILER" }}- # this grabs old cache if checksum doesn't match
    - run:
        name: Update opam lists
        command: |
          source ~/.profile
          opam repository set-url default https://opam.ocaml.org
          opam update
    - run:
        name: Install opam packages
        command: |
          source ~/.profile
          opam switch -j ${NJOBS} ${COMPILER}
          opam install -j ${NJOBS} -y camlp5.${CAMLP5_VER} ocamlfind ${COQIDE_OPAM} ${COQDOC_OPAM} ${EXTRA_OPAM}
    - run:
        name: Clean cache
        command: |
          source ~/.profile
          rm -rf ~/.opam/log/
    - save_cache:
        key: coq-opam-cache-v1-{{ arch }}-{{ checksum "COMPILER" }}-{{ checksum ".circleci/config.yml" }}-
        paths:
          - ~/.opam
    - persist_to_workspace:
        root: &workspace ~/
        paths:
          - .opam/

.build-template: &build-template
  <<: *params
  steps:
    - checkout
    - run: *before_script
    - attach_workspace: &attach_workspace
        at: *workspace
    - run: *opam-switch
    - run: &build-configure
        name: Configure
        command: |
          source ~/.profile

          ./configure -local -native-compiler ${NATIVE_COMP} ${EXTRA_CONF}
    - run: &build-build
        name: Build
        command: |
          source ~/.profile
          make -j ${NJOBS} byte
          make -j ${NJOBS}
          make test-suite/misc/universes/all_stdlib.v
    - persist_to_workspace:
        root: *workspace
        paths:
          - coq/

  environment: &build-variables
    <<: *envvars
    EXTRA_CONF: "-coqide opt"
    EXTRA_PACKAGES: *coqide-packages

.validate-template: &validate-template
  <<: *params
  steps:
    - run: *before_script
    - attach_workspace: *attach_workspace
    - run:
        name: Validate
        command: |
          source ~/.profile
          make validate
  environment: *envvars

.documentation-template: &documentation-template
  <<: *params
  steps:
    - run: *before_script
    - attach_workspace: *attach_workspace
    - run:
        name: Documentation
        command: |
          source ~/.profile
          make -j ${NJOBS} doc
  environment: &documentation-variables
    <<: *envvars
    EXTRA_PACKAGES: *coqdoc-packages

.test-suite-template: &test-suite-template
  <<: *params
  steps:
    - run: *before_script
    - attach_workspace: *attach_workspace
    - run:
        name: Test
        command: |
          source ~/.profile
          cd test-suite
          make clean
          make -j ${NJOBS} all
  environment: &test-suite-variables
    <<: *envvars
    EXTRA_PACKAGES: *timing-packages

.ci-template: &ci-template
  <<: *params
  steps:
    - run: *before_script
    - attach_workspace: *attach_workspace
    - run:
        name: Test
        command: |
          source ~/.profile
          dev/ci/ci-wrapper.sh ${CIRCLE_JOB}
    - persist_to_workspace:
        root: *workspace
        paths:
          - coq/
  environment: &ci-template-vars
    <<: *envvars
    EXTRA_PACKAGES: *timing-packages

# Defines individual jobs, see the workflows section below for job orchestration
jobs:
  # TODO: linter

  opam-boot:
    <<: *opam-boot-template
    environment:
      <<: *envvars
      EXTRA_PACKAGES: *coqide-packages
      EXTRA_OPAM: "ocamlgraph"

  opam-boot-32bit:
    <<: *opam-boot-template
    environment:
      <<: *envvars
      EXTRA_PACKAGES: "gcc-multilib"
      COMPILER: *compiler-32bit
      COQIDE_OPAM: ""
      COQDOC_OPAM: ""

  opam-boot-be:
    <<: *opam-boot-template
    environment:
      <<: *envvars
      EXTRA_PACKAGES: *coqide-packages
      COMPILER: *compiler-be
      CAMLP5_VER: *camlp5-ver-be
      COQIDE_OPAM: *coqide-opam-be

  # Build and prepare test environment
  build: *build-template

  build-32bit:
    <<: *build-template
    environment:
      <<: *envvars # no coqide for 32bit
      EXTRA_PACKAGES: "gcc-multilib"
      COMPILER: *compiler-32bit

  build-be:
    <<: *build-template
    environment:
      <<: *build-variables
      COMPILER: *compiler-be

  validate: *validate-template

  validate-32bit:
    <<: *validate-template
    environment:
      <<: *envvars
      COMPILER: *compiler-32bit
      EXTRA_PACKAGES: "gcc-multilib"

  documentation: *documentation-template

  documentation-be:
    <<: *documentation-template
    environment:
      <<: *documentation-variables
      COMPILER: *compiler-be
      CAMLP5_VER: *camlp5-ver-be

  test-suite:
    <<: *test-suite-template

  test-suite-32bit:
    <<: *test-suite-template
    environment:
      <<: *test-suite-variables
      COMPILER: *compiler-32bit
      EXTRA_PACKAGES: "gcc-multilib time python"

  test-suite-be:
    <<: *test-suite-template
    environment:
      <<: *test-suite-variables
      COMPILER: *compiler-be
      EXTRA_PACKAGES: *timing-packages

  bignums:
    <<: *ci-template

  color:
    <<: *ci-template
    environment:
      <<: *ci-template-vars
      EXTRA_PACKAGES: *timing-packages

  compcert:
    <<: *ci-template

  coq-dpdgraph:
    <<: *ci-template
    environment:
      <<: *ci-template-vars
      EXTRA_PACKAGES: "time python autoconf automake"

  coquelicot:
    <<: *ci-template
    environment:
      <<: *ci-template-vars
      EXTRA_PACKAGES: "time python autoconf automake"

  equations:
    <<: *ci-template

  geocoq:
    <<: *ci-template

  fiat-crypto:
    <<: *ci-template

  fiat-parsers:
    <<: *ci-template
    environment:
      <<: *ci-template-vars
      EXTRA_PACKAGES: *timing-packages

  flocq:
    <<: *ci-template
    environment:
      <<: *ci-template-vars
      EXTRA_PACKAGES: "time python autoconf automake"

  math-classes:
    <<: *ci-template

  corn:
    <<: *ci-template

  formal-topology:
    <<: *ci-template

  hott:
    <<: *ci-template
    environment:
      <<: *ci-template-vars
      EXTRA_PACKAGES: "time python autoconf automake"

  iris-lambda-rust:
    <<: *ci-template

  ltac2:
    <<: *ci-template

  math-comp:
    <<: *ci-template

  sf:
    <<: *ci-template
    environment:
      <<: *ci-template-vars
      EXTRA_PACKAGES: "time python wget"

  unimath:
    <<: *ci-template

  vst:
    <<: *ci-template

workflows:
  version: 2
  # Run on each push
  main:
    jobs:
      - opam-boot
      - opam-boot-32bit
      - opam-boot-be

      - build:
          requires:
            - opam-boot
      - validate: &req-main
          requires:
            - build
      - test-suite: *req-main
      - documentation: *req-main

      - bignums: *req-main
      - color:
          requires:
            - build
            - bignums
      - compcert: *req-main
      - coq-dpdgraph: *req-main
      - coquelicot: *req-main
      - equations: *req-main
      - geocoq: *req-main
      - fiat-crypto: *req-main
      - fiat-parsers: *req-main
      - flocq: *req-main
      - math-classes:
          requires:
            - build
            - bignums
      - corn:
          requires:
            - build
            - math-classes
      - formal-topology:
          requires:
            - build
            - corn
      - hott: *req-main
      - iris-lambda-rust: *req-main
      - ltac2: *req-main
      - math-comp: *req-main
      - sf: *req-main
      - unimath: *req-main
      - vst: *req-main

      - build-32bit:
          requires:
            - opam-boot-32bit
      - validate-32bit: &req-32bit
          requires:
            - build-32bit
      - test-suite-32bit: *req-32bit

      - build-be:
          requires:
            - opam-boot-be
      - test-suite-be: &req-be
          requires:
            - build-be
      - documentation-be: *req-be