-
Notifications
You must be signed in to change notification settings - Fork 9
434 lines (424 loc) · 16.4 KB
/
hs-to-coq.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
name: hs-to-coq
on: [push, pull_request]
jobs:
pre_check:
runs-on: ubuntu-latest
outputs:
should_skip_coq: ${{ steps.skip_coq_check.outputs.should_skip }}
should_skip_hs: ${{ steps.skip_hs_check.outputs.should_skip }}
steps:
- id: skip_hs_check
name: Check if the changes are about Haskell src files
uses: fkirc/skip-duplicate-actions@master
with:
paths: '["src/**", "stack.yaml", "hs-to-coq.cabal", "cabal.project"]'
- id: skip_coq_check
name: Check if the changes are about Coq files
uses: fkirc/skip-duplicate-actions@master
with:
paths: '["examples/**", "base/**", "base-thy/**"]'
installing-haskell:
name: Installing Haskell dependencies
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
ghc: [8.4.3]
resolver: [lts-12.0]
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_hs != 'true' }}
steps:
- uses: actions/checkout@v2
- name: Caching Stack
id: caching-stack
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
examples/containers/extraction/.stack-work
~/.ghc
key: stack-${{ runner.os }}-ghc${{ matrix.ghc }}-${{ matrix.resolver }}-${{ hashFiles('**/hs-to-coq.cabal') }}
- uses: haskell/actions/setup@v1
if: steps.caching-stack.outputs.cache-hit != 'true'
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
- name: Setup Stack
if: steps.caching-stack.outputs.cache-hit != 'true'
run: |
stack --no-terminal --install-ghc test --only-dependencies
stack --no-terminal --install-ghc install QuickCheck HUnit test-framework test-framework-hunit test-framework-quickcheck2
- name: Build hs-to-coq
if: steps.caching-stack.outputs.cache-hit != 'true'
run: stack --no-terminal --install-ghc build
installing-coq:
name: Installing Coq dependencies
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
ocaml: [4.07.1]
coq: [8.10.2]
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_coq != 'true' }}
steps:
- name: Caching OPAM
id: caching-opam
uses: actions/cache@v2
with:
path: ~/.opam
key: opam-${{ runner.os }}-coq${{ matrix.coq }}
- name: Set up OCaml
if: steps.caching-opam.outputs.cache-hit != 'true'
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml }}
- name: Set up Coq
if: steps.caching-opam.outputs.cache-hit != 'true'
run: |
if ! [ -e $HOME/.opam/config ]; then opam init -j 2 -n -y; fi
opam repo add coq-released http://coq.inria.fr/opam/released || true
opam list -i coq.8.10.2 --silent || { opam update && opam unpin coq && opam install -v -y -j 1 --unlock-base coq.8.10.2 ocamlfind.1.8.0 ; }
opam list -i coq-mathcomp-ssreflect --silent || opam install -y coq-mathcomp-ssreflect
opam install -y coq-equations.1.2+8.10
cross-build-hs-to-coq:
name: Cross building hs-to-coq with multiple GHC versions
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
ghc: [8.4.3]
resolver: [lts-12.26, lts-14.27, lts-16.31, lts-18.10]
needs: pre_check
if: ${{ needs.pre_check.outputs.should_skip_hs != 'true' }}
steps:
- uses: actions/checkout@v2
- name: Caching Stack
id: caching-stack
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
examples/containers/extraction/.stack-work
~/.ghc
key: stack-${{ runner.os }}-ghc${{ matrix.ghc }}-${{ matrix.resolver }}-${{ hashFiles('**/hs-to-coq.cabal') }}
- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
- name: Replacing resolver
run: sed -i 's/lts-.*/${{ matrix.resolver }}/g' stack.yaml
- name: Building hs-to-coq
run: |
stack --no-terminal --install-ghc test --only-dependencies
stack --no-terminal --install-ghc install QuickCheck HUnit test-framework test-framework-hunit test-framework-quickcheck2
stack --no-terminal --install-ghc build
test-coq-files:
name: Testing base, containers, transformers, GHC, etc.
runs-on: ${{ matrix.os }}
needs: [installing-coq, pre_check]
strategy:
matrix:
os: [ubuntu-latest]
ocaml: [4.07.1]
coq: [8.10.2]
if: ${{ needs.pre_check.outputs.should_skip_coq != 'true' }}
steps:
- uses: actions/checkout@v2
- name: Caching OPAM
uses: actions/cache@v2
with:
path: ~/.opam
key: opam-${{ runner.os }}-coq${{ matrix.coq }}
- name: Set up OCaml
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml }}
- name: Set up Coq
if: steps.caching-opam.outputs.cache-hit != 'true'
run: |
opam init -j 2 -n -y
- name: Installing Coq dependencies
run: |
opam repo add coq-released http://coq.inria.fr/opam/released || true
opam list -i coq.8.10.2 --silent || { opam update && opam unpin coq && opam install -v -y -j 1 --unlock-base coq.8.10.2 ocamlfind.1.8.0 ; }
opam list -i coq-mathcomp-ssreflect --silent || opam install -y coq-mathcomp-ssreflect
opam install -y coq-equations.1.2+8.10
- name: Compiling base
run: |
eval $(opam config env)
(cd base; coq_makefile -f _CoqProject -o Makefile)
make -j -C base
(cd base-thy; coq_makefile -f _CoqProject -o Makefile)
make -j -C base-thy
- name: Compiling transformers
run: |
eval $(opam config env)
(cd examples/transformers/lib; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/transformers/lib
(cd examples/transformers/theories; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/transformers/theories
- name: Compiling containers
run: |
eval $(opam config env)
(cd examples/containers/lib; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/containers/lib
(cd examples/containers/theories; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/containers/theories
- name: Compiling GHC and core-semantics
run: |
eval $(opam config env)
(cd examples/ghc/lib; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/ghc/lib
(cd examples/ghc/theories; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/ghc/theories
(cd examples/core-semantics/lib; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/core-semantics/lib
- name: Compiling Graph (FGL)
run: |
eval $(opam config env)
(cd examples/graph/lib; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/graph/lib
(cd examples/graph/theories; coq_makefile -f _CoqProject -o Makefile)
make -j -C examples/graph/theories
tests:
name: Tests, base tests, and other examples
runs-on: ${{ matrix.os }}
needs: [installing-haskell, installing-coq, pre_check]
if: ${{ needs.pre_check.outputs.should_skip_coq != 'true' && needs.pre_check.outputs.should_skip_hs != 'true' }}
strategy:
matrix:
os: [ubuntu-latest]
ghc: [8.4.3]
resolver: [lts-12.0]
ocaml: [4.07.1]
coq: [8.10.2]
steps:
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
- name: Caching Stack
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
examples/containers/extraction/.stack-work
~/.ghc
key: stack-${{ runner.os }}-ghc${{ matrix.ghc }}-${{ matrix.resolver }}-${{ hashFiles('**/hs-to-coq.cabal') }}
- name: Setup Stack
if: steps.caching-stack.outputs.cache-hit != 'true'
run: |
stack --no-terminal --install-ghc test --only-dependencies
stack --no-terminal --install-ghc install QuickCheck HUnit test-framework test-framework-hunit test-framework-quickcheck2
- name: Build hs-to-coq
run: stack --no-terminal --install-ghc build
- name: Caching OPAM
uses: actions/cache@v2
with:
path: ~/.opam
key: opam-${{ runner.os }}-coq${{ matrix.coq }}
- name: Set up OPAM
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml }}
- name: Set up Coq
if: steps.caching-opam.outputs.cache-hit != 'true'
run: |
opam init -j 2 -n -y
- name: Installing Coq dependencies
run: |
opam repo add coq-released http://coq.inria.fr/opam/released || true
opam list -i coq.8.10.2 --silent || { opam update && opam unpin coq && opam install -v -y -j 1 --unlock-base coq.8.10.2 ocamlfind.1.8.0 ; }
opam list -i coq-mathcomp-ssreflect --silent || opam install -y coq-mathcomp-ssreflect
opam install -y coq-equations.1.2+8.10
- name: Run tests
run: |
eval $(opam config env)
(cd base; coq_makefile -f _CoqProject -o Makefile)
make -j -C base
make -j -C examples/tests
make -j -C examples/base-tests
(cd base-thy; coq_makefile -f _CoqProject -o Makefile)
make -j -C base-thy
make -j -C examples/successors
make -j -C examples/compiler
make -j -C examples/rle
make -j -C examples/bag
make -j -C examples/quicksort
make -j -C examples/dlist
make -j -C examples/intervals
make -j -C examples/coinduction
test-translation:
name: Translation (ensures convenience copy is up-to-date)
runs-on: ${{ matrix.os }}
needs: [installing-haskell, pre_check]
strategy:
matrix:
os: [ubuntu-latest]
ghc: [8.4.3]
resolver: [lts-12.0]
ocaml: [4.07.1]
coq: [8.10.2]
if: ${{ needs.pre_check.outputs.should_skip_hs != 'true' }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Installing dependencies for Linux
if: runner.os == 'Linux'
run: sudo apt-get install xutils-dev
- name: Installing dependencies for MacOS
if: runner.os == 'macOS'
run: |
brew install --cask xquartz
export PATH=$PATH:/usr/X11/bin >> ~/.bash_profile
- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
- name: Caching Stack
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
examples/containers/extraction/.stack-work
~/.ghc
key: stack-${{ runner.os }}-ghc${{ matrix.ghc }}-${{ matrix.resolver }}-${{ hashFiles('**/hs-to-coq.cabal') }}
- name: Setup Stack
if: steps.caching-stack.outputs.cache-hit != 'true'
run: |
stack --no-terminal --install-ghc test --only-dependencies
stack --no-terminal --install-ghc install QuickCheck HUnit test-framework test-framework-hunit test-framework-quickcheck2
- name: Build hs-to-coq
run: stack --no-terminal --install-ghc build
- name: Translating base
run: |
make -C examples/base-src clean
make -C examples/base-src vfiles
- name: Comparing convenience copy of base
run: |
git add base
git status
git diff-index --cached --quiet HEAD -- base
- name: Translating containers
run: |
make -C examples/containers clean
make -C examples/containers vfiles
- name: Comparing convenience copy of containers
run: |
git add examples/containers/lib
git status
git diff-index --cached --quiet HEAD -- examples/containers/lib
- name: Translating transformers
run: |
make -C examples/transformers clean
make -C examples/transformers vfiles
- name: Comparing convenience copy of transformers
run: |
git add examples/transformers/lib
git status
git diff-index --cached --quiet HEAD -- examples/transformers/lib
- name: Translating GHC and core-semantics
run: |
make -C examples/ghc clean
make -C examples/ghc vfiles
make -C examples/core-semantics clean
make -C examples/core-semantics vfiles
- name: Comparing convenience copy of GHC and core-semantics
run: |
git add examples/ghc/lib
git add examples/core-semantics/lib
git status
git diff-index --cached --quiet HEAD -- examples/ghc/lib/
- name: Translating Graph (FGL)
run: |
make -C examples/graph clean
make -C examples/graph vfiles
- name: Comparing convenience copy of Graph (FGL)
run: |
git add examples/graph/lib
git status
git diff-index --cached --quiet HEAD -- examples/graph/lib
test-container-extraction:
name: Testing containers extraction
runs-on: ${{ matrix.os }}
needs: [installing-haskell, installing-coq, pre_check]
strategy:
matrix:
os: [ubuntu-latest]
ghc: [8.4.3]
resolver: [lts-12.0]
ocaml: [4.07.1]
coq: [8.10.2]
if: ${{ needs.pre_check.outputs.should_skip_coq != 'true' }}
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
stack-version: 'latest'
- name: Caching Stack
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
examples/containers/extraction/.stack-work
~/.ghc
key: stack-${{ runner.os }}-ghc${{ matrix.ghc }}-${{ matrix.resolver }}-${{ hashFiles('**/hs-to-coq.cabal') }}
- name: Setup Stack
if: steps.caching-stack.outputs.cache-hit != 'true'
run: |
stack --no-terminal --install-ghc test --only-dependencies
stack --no-terminal --install-ghc install QuickCheck HUnit test-framework test-framework-hunit test-framework-quickcheck2
- name: Build hs-to-coq
run: stack --no-terminal --install-ghc build
- name: Caching OPAM
uses: actions/cache@v2
with:
path: ~/.opam
key: opam-${{ runner.os }}-coq${{ matrix.coq }}
- name: Set up OPAM
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml }}
- name: Set up Coq
if: steps.caching-opam.outputs.cache-hit != 'true'
run: |
opam init -j 2 -n -y
- name: Installing Coq dependencies
run: |
opam repo add coq-released http://coq.inria.fr/opam/released || true
opam list -i coq.8.10.2 --silent || { opam update && opam unpin coq && opam install -v -y -j 1 --unlock-base coq.8.10.2 ocamlfind.1.8.0 ; }
opam list -i coq-mathcomp-ssreflect --silent || opam install -y coq-mathcomp-ssreflect
opam install -y coq-equations.1.2+8.10
- name: Extract containers
run: |
stack --no-terminal --install-ghc build
eval $(opam config env)
(cd base; coq_makefile -f _CoqProject -o Makefile)
make -j2 -C base
(cd examples/containers/lib; coq_makefile -f _CoqProject -o Makefile)
make -j2 -C examples/containers/lib
(cd examples/containers/extraction/extracted-src; coq_makefile -f _CoqProject -o Makefile)
make -j2 -C examples/containers/extraction/extracted-src/
perl -i examples/containers/extraction/extracted-src/fixcode.pl examples/containers/extraction/extracted-src/*.hs
- name: Testing containers extraction
run: |
cd examples/containers/extraction
stack --no-terminal --install-ghc test
- name: Bench
run: stack --no-terminal --install-ghc bench