generated from actions/container-action
-
Notifications
You must be signed in to change notification settings - Fork 4
433 lines (414 loc) · 14.8 KB
/
coq-demo.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
name: Docker-Coq CI
on:
push:
branches:
- master # forall push/merge in master
- v1 # forall push/merge in v1
pull_request:
branches:
- "**" # forall submitted Pull Requests
schedule:
# test master every day at 16:00 UTC
# cf. https://crontab.guru/
- cron: '0 16 * * *'
jobs:
# The following two jobs are standard/recommended versions, assuming
# your coq project repository contains a committed .opam file.
demo-1:
name: coq_version / docker-coq / opam
runs-on: ubuntu-latest
strategy:
matrix:
# To get the list of supported (coq, ocaml) versions from coqorg/coq,
# see https://github.com/coq-community/docker-coq/wiki#supported-tags
coq_version:
- '8.18'
- 'latest-native'
- 'dev'
ocaml_version: ['default']
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
with:
opam_file: 'coq-demo.opam'
coq_version: ${{ matrix.coq_version }}
ocaml_version: ${{ matrix.ocaml_version }}
demo-2:
name: custom_image / docker-mathcomp / opam
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'mathcomp/mathcomp-dev:coq-dev'
- 'mathcomp/mathcomp:latest-coq-8.19'
# - 'mathcomp/mathcomp:latest-coq-dev' # not always available,
# see https://hub.docker.com/r/mathcomp/mathcomp#supported-tags
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
with:
opam_file: 'coq-demo.opam'
custom_image: ${{ matrix.image }}
# The following job illustrates the use of several customizable fields,
# while keeping the default value of the overall "custom_script" field,
# see https://github.com/coq-community/docker-coq-action#custom_script
demo-3:
name: custom_image / docker-coq / make / script
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'coqorg/coq:latest'
- 'coqorg/coq:dev'
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
with:
# As the install/script/uninstall fields are overridden,
# the "opam_file" field is unneeded in this example job.
custom_image: ${{ matrix.image }}
install: |
startGroup "Install dependencies"
opam install -y -j 2 coq-mathcomp-ssreflect
endGroup
before_script: |
startGroup "Workaround permission issue"
sudo chown -R coq:coq .
endGroup
script: |
startGroup "Build project"
coq_makefile -f _CoqProject -o Makefile
make -j2
make test
make install
endGroup
uninstall: |
startGroup "Clean project"
make clean
make uninstall
endGroup
- name: Revert permissions
# to avoid a warning at cleanup time
if: ${{ always() }}
run: sudo chown -R 1001:116 .
# The following job illustrates the redefinition of the
# "custom_script" field.
demo-4:
name: custom_image / docker-coq / make / custom_script
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'coqorg/coq:latest'
- 'coqorg/coq:dev'
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
with:
custom_image: ${{ matrix.image }}
custom_script: |
startGroup "Print opam config"
opam config list; opam repo list; opam list
endGroup
startGroup "Install dependencies"
opam update -y
opam install -y -j 2 coq-mathcomp-ssreflect
endGroup
startGroup "List installed packages"
opam list
endGroup
startGroup "Workaround permission issue"
sudo chown -R coq:coq .
endGroup
startGroup "Build project"
coq_makefile -f _CoqProject -o Makefile
make -j2
make test
make install
endGroup
startGroup "Clean project"
make clean
make uninstall
endGroup
- name: Revert permissions
# to avoid a warning at cleanup time
if: ${{ always() }}
run: sudo chown -R 1001:116 .
# The following job illustrates how to pass environment variables.
demo-5:
name: custom_image / docker-coq / opam / env
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'coqorg/coq:latest'
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
with:
opam_file: 'coq-demo.opam'
custom_image: ${{ matrix.image }}
before_script: |
startGroup "Toy example"
echo "COQ_IMAGE=$COQ_IMAGE"
[ -n "$COQ_IMAGE" ]
echo "ex_var=$ex_var"
[ "$ex_var" = "ex_value" ]
endGroup
export: 'COQ_IMAGE ex_var OPAMWITHTEST' # space-sep. list of vars
env:
OPAMWITHTEST: 'true'
ex_var: 'ex_value'
# The following two jobs illustrate the installation of system packages.
demo-6:
name: custom_image / docker-coq / opam / auto install depexts
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'coqorg/coq:dev'
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
with:
opam_file: 'coq-depexts-test.opam'
custom_image: ${{ matrix.image }}
after_script: |
startGroup "Post-test"
gappa --version
endGroup
demo-7:
name: custom_image / docker-coq / opam / apt-get install more
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'coqorg/coq:latest'
- 'coqorg/coq:dev'
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
with:
opam_file: 'coq-demo.opam'
custom_image: ${{ matrix.image }}
before_script: |
startGroup "Install APT dependencies"
cat /etc/os-release
# sudo apt-get update -y -q # this mandatory command is already run in install step by default
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -q --no-install-recommends \
emacs \
tree # for instance
# Alphabetical order is recommended for long package lists to ease review and update
endGroup
after_script: |
startGroup "Post-test"
emacs --version
tree
endGroup
# The following job illustrates the upload of generated artifacts.
demo-8:
name: custom_image / docker-coq / opam+make / upload-artifacts
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'coqorg/coq:latest'
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
with:
opam_file: 'coq-demo.opam'
custom_image: ${{ matrix.image }}
before_script: |
startGroup "Workaround permission issue"
sudo chown -R coq:coq .
endGroup
script: |
startGroup "Build project"
coq_makefile -f _CoqProject -o Makefile
make -j2
endGroup
after_script: |
set -o pipefail # recommended if the script uses pipes
startGroup "Build artifacts"
mkdir -v -p artifacts
opam list > artifacts/opam_list.txt
make test 2>&1 | tee artifacts/make_test.txt
endGroup
uninstall: ''
- name: Revert permissions
# to avoid a warning at cleanup time
if: ${{ always() }}
run: sudo chown -R 1001:116 .
- uses: actions/upload-artifact@v4
with:
name: example-artifact
path: artifacts/
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
retention-days: 8
# The following job illustrates the upload of github environment files.
demo-9:
name: custom_image / docker-mathcomp / opam / env+GITHUB_ENV
runs-on: ubuntu-latest
strategy:
matrix:
image:
- 'mathcomp/mathcomp:latest-coq-8.19'
fail-fast: false # don't stop jobs if one fails
steps:
################################################################
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block
# # if you copy this demo workflow elsewhere!
- uses: actions/checkout@v4
with:
repository: 'erikmd/docker-coq-github-action-demo'
ref: 'master'
- uses: actions/checkout@v4
with:
path: 'docker-coq-action'
- uses: './docker-coq-action'
# End GHA_TEST_ENV
##################
# - uses: actions/checkout@v4
# - uses: coq-community/docker-coq-action@v1
id: docker-coq-action
env:
# Pass string data to docker-coq-action
after_ok: 'Test successful!'
with:
export: 'COQ_IMAGE after_ok'
custom_image: ${{ matrix.image }}
opam_file: 'coq-demo.opam'
before_script: |
# Pass step outputs (Docker image name) to next step
echo "docker_image=$COQ_IMAGE" >> "$GITHUB_OUTPUT"
after_script: |
# Pass env vars (Coq version string...) to next step
echo "coq_version=$(opam var coq:version)" >> "$GITHUB_ENV"
echo "some_variable=expected_value" >> "$GITHUB_ENV"
# Display Markdown summary
[ -n "$after_ok" ]
echo "### $after_ok :rocket:" >> "$GITHUB_STEP_SUMMARY"
- name: Next step
env:
docker_image: ${{ steps.docker-coq-action.outputs.docker_image }}
run: |
: Summary
echo "Previous step pulled Docker image: $docker_image"
[ -n "$docker_image" ]
echo "Previous step used: coq_version=$coq_version"
[ -n "$coq_version" ]
echo "some_variable=$some_variable"
[ "$some_variable" = "expected_value" ]