-
Notifications
You must be signed in to change notification settings - Fork 193
593 lines (556 loc) · 21.7 KB
/
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
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
name: CI
on: [ push , pull_request , merge_group ]
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
# We set the supported coq-version from here. In order to use this environment variable correctly, look at how they are used in the following jobs.
env:
coq-version-supported: '8.19'
ocaml-version: '4.14-flambda'
deployment-branch: 'gh-pages'
# Our jobs come in 3 stages, the latter stages depending on the former:
# - Stage 1: Build jobs
# - Stage 2: Documentation and validation jobs
# - Stage 3: Deployment job
# - Stage 4: Clean-up job
jobs:
#
# Stage 1:
#
# Here we define the build jobs:
# - opam-build: Building the library using opam
# - quick-build: Building the library quickly using make
# - build: Building with timeing information for use in doc jobs
# Building the library using opam
opam-build:
strategy:
fail-fast: false
matrix:
coq-version-dummy:
- 'supported'
- 'latest'
- 'dev'
os:
- ubuntu-latest
env:
coq-version: ${{ matrix.coq-version-dummy }}
runs-on: ${{ matrix.os }}
steps:
# Github actions doesn't let us set workflow level enviornment variables inside the stategy of a job. Therefore we use the dummy variable coq-version in the matrix to set an environment varible env.coq-version, which uses the globablly set coq-version-supported when running the 'supported' case.
- name: Set supported coq-version
if: matrix.coq-version-dummy == 'supported'
run: echo "coq-version=${{ env.coq-version-supported }}" >> $GITHUB_ENV
- name: Checkout repo
uses: actions/checkout@v4
- name: Build HoTT
uses: coq-community/docker-coq-action@v1
with:
opam_file: 'coq-hott.opam'
coq_version: ${{ env.coq-version }}
ocaml_version: ${{ env.ocaml-version }}
export: 'OPAMWITHTEST'
env:
OPAMWITHTEST: 'true'
# Quick build
quick-build:
strategy:
fail-fast: false
matrix:
coq-version-dummy:
- 'supported'
- 'latest'
- 'dev'
os:
- ubuntu-latest
env:
coq-version: ${{ matrix.coq-version-dummy }}
runs-on: ${{ matrix.os }}
steps:
# Github actions doesn't let us set workflow level enviornment variables inside the stategy of a job. Therefore we use the dummy variable coq-version in the matrix to set an environment varible env.coq-version, which uses the globablly set coq-version-supported when running the 'supported' case.
- name: Set supported coq-version
if: matrix.coq-version-dummy == 'supported'
run: echo "coq-version=${{ env.coq-version-supported }}" >> $GITHUB_ENV
- name: Checkout repo
uses: actions/checkout@v4
- name: Build HoTT
uses: coq-community/docker-coq-action@v1
with:
coq_version: ${{ env.coq-version }}
ocaml_version: ${{ env.ocaml-version }}
custom_script: |
startGroup "Workaround permission issue" # https://github.com/coq-community/docker-coq-action#permissions
sudo chown -R coq:coq .
endGroup
echo "::remove-matcher owner=coq-problem-matcher::" # remove problem matcher installed by Coq docker action, so we don't get duplicate warning annotations
make -j2
- name: Revert permissions
# to avoid a warning at cleanup time - https://github.com/coq-community/docker-coq-action#permissions
if: ${{ always() }}
run: sudo chown -R 1001:116 .
# Main build which docs will run off
build:
strategy:
fail-fast: false
matrix:
# We build on our supported version of coq and the master version
coq-version-dummy:
- 'supported'
- 'latest'
include:
- coq-version-dummy: 'dev'
extra-gh-reportify: '--warnings'
env:
coq-version: ${{ matrix.coq-version-dummy }}
runs-on: ubuntu-latest
steps:
# Github actions doesn't let us set workflow level enviornment variables inside the stategy of a job. Therefore we use the dummy variable coq-version in the matrix to set an environment varible env.coq-version, which uses the globablly set coq-version-supported when running the 'supported' case.
- name: Set supported coq-version
if: matrix.coq-version-dummy == 'supported'
run: echo "coq-version=${{ env.coq-version-supported }}" >> $GITHUB_ENV
# Checkout branch
- uses: actions/checkout@v4
with:
submodules: recursive
# We use the coq docker so we don't have to build coq
- uses: coq-community/docker-coq-action@v1
with:
coq_version: ${{ env.coq-version }}
ocaml_version: ${{ env.ocaml-version }}
custom_script: |
startGroup "Workaround permission issue" # https://github.com/coq-community/docker-coq-action#permissions
sudo chown -R coq:coq .
endGroup
echo "::remove-matcher owner=coq-problem-matcher::" # remove problem matcher installed by Coq docker action, so we don't get duplicate warning annotations
sudo apt-get -o Acquire::Retries=30 update -q
sudo apt-get -o Acquire::Retries=30 install python3 python-is-python3 -y --allow-unauthenticated
etc/coq-scripts/github/reportify-coq.sh --errors ${{ matrix.extra-gh-reportify }} make TIMED=1 -j2 --output-sync
- name: Revert permissions
# to avoid a warning at cleanup time - https://github.com/coq-community/docker-coq-action#permissions
if: ${{ always() }}
run: sudo chown -R 1001:116 .
# Tar workspace files
- name: 'Tar .vo files'
run: tar -cf workspace.tar .
# We upload build artifacts for use by documentation
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: workspace-${{ env.coq-version }}
path: workspace.tar
# Nix build
nix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v20
with:
name: coq-hott
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
extraPullNames: coq-hott
- run: nix build
#
# Stage 2:
#
# Here we define the documentation and validation jobs:
# - doc-alectryon: Builds the alectryon documentation
# - doc-dep-graph: Builds dependency graphs
# - doc-coqdoc: Builds the coqdoc documentation
# - doc-timing: Builds the timing documentation
# - coqchk: Runs coqchk
# - install: Tests install target
# alectryon job
doc-alectryon:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# Download artifact
- uses: actions/download-artifact@v3
with:
name: workspace-${{ env.coq-version-supported }}
# Unpack Tar
- run: tar -xf workspace.tar
- name: add problem matchers
run: |
#echo "::add-matcher::etc/coq-scripts/github/coq-oneline-error.json" # now via a script
#echo "::add-matcher::etc/coq-scripts/github/coqdoc.json" # disabled for now, since they don't have file names
echo "::add-matcher::etc/coq-scripts/github/alectryon-error.json"
#echo "::add-matcher::etc/coq-scripts/github/alectryon-warning.json" # too noisy right now, cf https://github.com/cpitclaudel/alectryon/issues/34 and https://github.com/cpitclaudel/alectryon/issues/33
- uses: coq-community/docker-coq-action@v1
with:
coq_version: ${{ env.coq-version-supported }}
ocaml_version: ${{ env.ocaml-version }}
custom_script: |
opam install -y coq-serapi
sudo apt-get -o Acquire::Retries=30 update -q
sudo apt-get -o Acquire::Retries=30 install python3-pip python3-venv autoconf -y --allow-unauthenticated
startGroup "Workaround permission issue" # https://github.com/coq-community/docker-coq-action#permissions
sudo chown -R coq:coq .
endGroup
# Create and activate a virtual environment
python3 -m venv myenv
source myenv/bin/activate
# Install the required Python packages in the virtual environment
python -m pip install --upgrade pip
python -m pip install pygments dominate beautifulsoup4 docutils==0.17.1
echo "::remove-matcher owner=coq-problem-matcher::" # remove problem matcher installed by Coq docker action, so we don't get duplicate warning annotations
make alectryon ALECTRYON_EXTRAFLAGS=--traceback
- name: Revert permissions
# to avoid a warning at cleanup time - https://github.com/coq-community/docker-coq-action#permissions
if: ${{ always() }}
run: sudo chown -R 1001:116 .
- name: tar alectryon artifact
run: tar -cf alectryon-html.tar alectryon-html
- name: upload alectryon artifact
uses: actions/upload-artifact@v1
with:
name: alectryon-html
path: alectryon-html.tar
# dependency graph doc job
doc-dep-graphs:
needs: build
runs-on: ubuntu-latest
steps:
# Checkout branch
- uses: actions/checkout@v4
with:
submodules: recursive
# Download artifact
- uses: actions/download-artifact@v3
with:
name: workspace-${{ env.coq-version-supported }}
# Unpack Tar
- run: tar -xf workspace.tar
# We use the coq docker so we don't have to build coq
- uses: coq-community/docker-coq-action@v1
with:
coq_version: ${{ env.coq-version-supported }}
ocaml_version: ${{ env.ocaml-version }}
custom_script: |
sudo apt-get update
sudo apt-get install -y ghc cabal-install
sudo apt-get install -y --allow-unauthenticated \
libssl-dev aspcud \
graphviz xsltproc python3-lxml python-pexpect-doc \
libxml2-dev libxslt1-dev time lua5.1 unzip npm
# libnode-dev node-gyp
cabal update
cabal install --lib graphviz text fgl
sudo -E npm config set strict-ssl false
#sudo -E npm i -g npm
sudo -E npm install -g doctoc
startGroup "Workaround permission issue" # https://github.com/coq-community/docker-coq-action#permissions
sudo chown -R coq:coq .
endGroup
echo "::remove-matcher owner=coq-problem-matcher::" # remove problem matcher installed by Coq docker action, so we don't get duplicate warning annotations
## Make dependency graph
make HoTT.deps HoTTCore.deps
runhaskell etc/DepsToDot.hs --coqdocbase="http://hott.github.io/Coq-HoTT/alectryon-html/" --title="HoTT Library Dependency Graph" < HoTT.deps > HoTT.dot
runhaskell etc/DepsToDot.hs --coqdocbase="http://hott.github.io/Coq-HoTT/alectryon-html/" --title="HoTT Core Library Dependency Graph" < HoTTCore.deps > HoTTCore.dot
dot -Tsvg HoTT.dot -o HoTT.svg
dot -Tsvg HoTTCore.dot -o HoTTCore.svg
rm -rf dep-graphs
mkdir -p dep-graphs
mv HoTT.svg HoTTCore.svg dep-graphs/
## Install coq-dpdgraph
opam install coq-dpdgraph.1.0+8.19 -y
# For some reason, we get a stackoverflow. So we are lax
# with making these.
ulimit -s unlimited
make svg-file-dep-graphs -k || true
## Try to make again to see errors
make svg-file-dep-graphs -k || true
# `dot` hates file-dep-graphs/hott-all.dot, because it's too big, and
# makes `dot` spin for over a dozen minutes. So disable it for now.
#make svg-aggregate-dep-graphs -k || exit $?
# We try to make the index.html but there might be some dead
# links if the previous didn't succeed.
make file-dep-graphs/index.html -k || true
- name: Revert permissions
# to avoid a warning at cleanup time - https://github.com/coq-community/docker-coq-action#permissions
if: ${{ always() }}
run: sudo chown -R 1001:116 .
# Tar dependency graph files
- name: 'Tar .svg files'
run: |
tar -cf dep-graphs.tar dep-graphs
tar -cf file-dep-graphs.tar file-dep-graphs
# We upload the artifacts
- name: 'Upload Artifact dep-graphs.tar'
uses: actions/upload-artifact@v3
with:
name: dep-graphs
path: dep-graphs.tar
- name: 'Upload Artifact file-dep-graphs.tar'
uses: actions/upload-artifact@v3
with:
name: file-dep-graphs
path: file-dep-graphs.tar
# doc-coqdoc job
# This builds coqdoc and timing docs and uploads their artifacts
doc-coqdoc:
needs: build
runs-on: ubuntu-latest
steps:
# Checkout branch
- uses: actions/checkout@v4
with:
submodules: recursive
# Download artifact
- uses: actions/download-artifact@v3
with:
name: workspace-${{ env.coq-version-supported }}
# Unpack Tar
- run: tar -xf workspace.tar
# We use the coq docker so we don't have to build coq
- uses: coq-community/docker-coq-action@v1
with:
coq_version: ${{ env.coq-version-supported }}
ocaml_version: ${{ env.ocaml-version }}
custom_script: |
startGroup "Workaround permission issue" # https://github.com/coq-community/docker-coq-action#permissions
sudo chown -R coq:coq .
endGroup
echo "::remove-matcher owner=coq-problem-matcher::" # remove problem matcher installed by Coq docker action, so we don't get duplicate warning annotations
## Make HTML doc
make -j2 html
mv html coqdoc-html
- name: Revert permissions
# to avoid a warning at cleanup time - https://github.com/coq-community/docker-coq-action#permissions
if: ${{ always() }}
run: sudo chown -R 1001:116 .
# Tar html files
- name: 'Tar doc files'
run: tar -cf coqdoc-html.tar coqdoc-html
# Upload coqdoc-html artifact
- name: 'Upload coqdoc-html Artifact'
uses: actions/upload-artifact@v3
with:
name: coqdoc-html
path: coqdoc-html.tar
# doc-timing job
# This builds coqdoc and timing docs and uploads their artifacts
doc-timing:
needs: build
runs-on: ubuntu-latest
steps:
# Checkout branch
- uses: actions/checkout@v4
with:
submodules: recursive
# Download artifact
- uses: actions/download-artifact@v3
with:
name: workspace-${{ env.coq-version-supported }}
# Unpack Tar
- run: tar -xf workspace.tar
# We use the coq docker so we don't have to build coq
- uses: coq-community/docker-coq-action@v1
with:
coq_version: ${{ env.coq-version-supported }}
ocaml_version: ${{ env.ocaml-version }}
custom_script: |
sudo apt-get update
sudo apt-get install -y time python3 python-is-python3 lua5.1
startGroup "Workaround permission issue" # https://github.com/coq-community/docker-coq-action#permissions
sudo chown -R coq:coq .
endGroup
echo "::remove-matcher owner=coq-problem-matcher::" # remove problem matcher installed by Coq docker action, so we don't get duplicate warning annotations
## Make timing doc
make -j2 timing-html
- name: Revert permissions
# to avoid a warning at cleanup time - https://github.com/coq-community/docker-coq-action#permissions
if: ${{ always() }}
run: sudo chown -R 1001:116 .
# Tar html files
- name: 'Tar doc files'
run: tar -cf timing-html.tar timing-html
# Upload timing-html artifact
- name: 'Upload timing-html Artifact'
uses: actions/upload-artifact@v3
with:
name: timing-html
path: timing-html.tar
# The coqchk job
coqchk:
needs: build
strategy:
fail-fast: false
matrix:
# We build on our supported version of coq and the master version
coq-version-dummy:
- 'supported'
- 'latest'
- 'dev'
env:
coq-version: ${{ matrix.coq-version-dummy }}
runs-on: ubuntu-latest
steps:
# Github actions doesn't let us set workflow level enviornment variables inside the stategy of a job. Therefore we use the dummy variable coq-version in the matrix to set an environment varible env.coq-version, which uses the globablly set coq-version-supported when running the 'supported' case.
- name: Set supported coq-version
if: matrix.coq-version-dummy == 'supported'
run: echo "coq-version=${{ env.coq-version-supported }}" >> $GITHUB_ENV
# Checkout branch
- uses: actions/checkout@v4
with:
submodules: recursive
# Download artifact
- uses: actions/download-artifact@v3
with:
name: workspace-${{ env.coq-version }}
# Unpack Tar
- run: tar -xf workspace.tar
# We use the coq docker so we don't have to build coq
- uses: coq-community/docker-coq-action@v1
with:
coq_version: ${{ env.coq-version }}
ocaml_version: ${{ env.ocaml-version }}
custom_script: |
startGroup "Workaround permission issue" # https://github.com/coq-community/docker-coq-action#permissions
sudo chown -R coq:coq .
endGroup
echo "::remove-matcher owner=coq-problem-matcher::" # remove problem matcher installed by Coq docker action, so we don't get duplicate warning annotations
make validate
- name: Revert permissions
# to avoid a warning at cleanup time - https://github.com/coq-community/docker-coq-action#permissions
if: ${{ always() }}
run: sudo chown -R 1001:116 .
# Test install target
install:
needs: build
strategy:
fail-fast: false
matrix:
# We build on our supported version of coq and the master version
coq-version-dummy:
- 'supported'
- 'latest'
- 'dev'
env:
coq-version: ${{ matrix.coq-version-dummy }}
runs-on: ubuntu-latest
steps:
# Github actions doesn't let us set workflow level enviornment variables inside the stategy of a job. Therefore we use the dummy variable coq-version in the matrix to set an environment varible env.coq-version, which uses the globablly set coq-version-supported when running the 'supported' case.
- name: Set supported coq-version
if: matrix.coq-version-dummy == 'supported'
run: echo "coq-version=${{ env.coq-version-supported }}" >> $GITHUB_ENV
# Checkout branch
- uses: actions/checkout@v4
with:
submodules: recursive
# Download artifact
- uses: actions/download-artifact@v3
with:
name: workspace-${{ env.coq-version }}
# Unpack Tar
- run: tar -xf workspace.tar
# We use the coq docker so we don't have to build coq
- uses: coq-community/docker-coq-action@v1
with:
coq_version: ${{ env.coq-version }}
ocaml_version: ${{ env.ocaml-version }}
custom_script: |
startGroup "Workaround permission issue" # https://github.com/coq-community/docker-coq-action#permissions
sudo chown -R coq:coq .
endGroup
echo "::remove-matcher owner=coq-problem-matcher::" # remove problem matcher installed by Coq docker action, so we don't get duplicate warning annotations
## Test install target
make install
echo 'Require Import HoTT.HoTT.' | coqtop -q
- name: Revert permissions
# to avoid a warning at cleanup time - https://github.com/coq-community/docker-coq-action#permissions
if: ${{ always() }}
run: sudo chown -R 1001:116 .
#
# Stage 3
#
deploy-doc:
# We only deploy when the reference is the master branch
if: ${{ github.ref == 'refs/heads/master' }}
# This job relies on the documentation jobs having finished. Technically we don't need to rely on coqchk and install, but it is simpler this way.
needs:
- coqchk
- install
- doc-alectryon
- doc-dep-graphs
- doc-coqdoc
- doc-timing
runs-on: ubuntu-latest
steps:
# Checkout branch
- uses: actions/checkout@v4
# Download alectryon artifact
- uses: actions/download-artifact@v3
with:
name: alectryon-html
# Download dependency graph artifacts
- uses: actions/download-artifact@v3
with:
name: dep-graphs
# Download file dependency graph artifacts
- uses: actions/download-artifact@v3
with:
name: file-dep-graphs
# Download coqdoc artifact
- uses: actions/download-artifact@v3
with:
name: coqdoc-html
# Download timing artifact
- uses: actions/download-artifact@v3
with:
name: timing-html
# Unpack Tar files
- run: |
mkdir doc
tar -xf alectryon-html.tar -C doc
tar -xf dep-graphs.tar -C doc
tar -xf file-dep-graphs.tar -C doc
tar -xf coqdoc-html.tar -C doc
tar -xf timing-html.tar -C doc
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: ${{ env.deployment-branch }}
folder: doc
single-commit: true
#
# Stage 4
#
# Here we define the cleanup job:
# - delete-artifacts: We delete the artifacts from the previous jobs
delete-artifacts:
# We always want to run this job even if we cancel
if: ${{ always() }}
# We depend on the stage 3 jobs
needs:
- deploy-doc
runs-on: ubuntu-latest
steps:
# Delete workspace artifacts
- uses: geekyeggo/delete-artifact@v1
with:
name: workspace-${{ env.coq-version-supported }}
- uses: geekyeggo/delete-artifact@v1
with:
name: workspace-latest
- uses: geekyeggo/delete-artifact@v1
with:
name: workspace-dev
# Delete documentation artifacts
- uses: geekyeggo/delete-artifact@v1
with:
name: dep-graphs
- uses: geekyeggo/delete-artifact@v1
with:
name: file-dep-graphs
- uses: geekyeggo/delete-artifact@v1
with:
name: alectryon-html
- uses: geekyeggo/delete-artifact@v1
with:
name: coqdoc-html
- uses: geekyeggo/delete-artifact@v1
with:
name: timing-html