forked from OCamlPro/alt-ergo
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (77 loc) · 3.14 KB
/
build_js.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
name: Build Javascript
# this worflow try to build and test the nodejs compatible version of Alt-Ergo
# and try to build the webworker of Alt-Ergo
on: [push,pull_request]
env:
OCAML_DEFAULT_VERSION: 4.14.2
# Add OPAMYES=true to the environment, this is usefull to replace `-y` option
# in any opam call
OPAMYES: true
# Alt-Ergo's depext crashs with with-test flag to yes
# # The with-test flag is set to true to force installation of deps and
# # depext needed to run the alt-ergo tests
# OPAMWITHTEST: true
OPAMLOCKED: locked
jobs:
compile_and_test_js:
# check if the project build in js.
name: Compile AE with JsoO and test it with NodeJs
runs-on: ubuntu-latest
steps:
# Checkout the code of the current branch
- name: Checkout code
uses: actions/checkout@v4
# Update apt-get database
- name: Update apt-get database
run: sudo apt-get update
# Retrieve the opam cache with unique key
# A new cache is created/used if the `.opam` files changes or
# if we use another ocaml version
# This action only retrieve de .opam/ directory
- name: Retrieve opam cache
uses: actions/cache@v4
id: cache-opam
with:
path: ~/.opam
key: v1-${{ runner.os }}-alt-ergo-js-${{ env.OCAML_DEFAULT_VERSION }}-${{ hashFiles('*.opam') }}
# Get an OCaml environment with opam installed and the proper ocaml version
# opam will used opam cache environment if retrieved
- name: Use OCaml ${{ env.OCAML_DEFAULT_VERSION }}
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ env.OCAML_DEFAULT_VERSION }}
# Install dependencies
- name: Install deps
run: opam exec -- make test-deps js-deps
# compile Alt-Ergo with Js_of_ocaml
- name: Make alt-ergo.js
run: opam exec -- make js-node
# Use Node Js actions
- uses: actions/setup-node@v4
with:
node-version: '14'
# Run simple test with node
# TODO: use gentest to run more tests there.
- name: Run simple example with node
run: opam exec -- node alt-ergo.js tests/everything/f1.ae
# Upload Alt-Ergo.js as an artifact
# the artifact name contains the system is builded on and the ocaml
# compiler version used
- name: Upload alt-ergo.js
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next'
with:
name: alt-ergo-js-${{ runner.os }}-${{ env.OCAML_DEFAULT_VERSION }}
path: "alt-ergo.js"
# compile the Alt-Ergo web worker with Js_of_ocaml
- name: Make alt-ergo-worker.js
run: opam exec -- make js-worker
# Upload Alt-Ergo-worker.js as an artifact
# the artifact name contains the system is builded on and the ocaml
# compiler version used
- name: Upload alt-ergo-worker.js
uses: actions/upload-artifact@v4
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next'
with:
name: alt-ergo-worker-js-${{ runner.os }}-${{ env.OCAML_DEFAULT_VERSION }}
path: "alt-ergo-worker.js"