Skip to content

Add zarith_stubs_js v0.17.0 in nix-shell (#1233) #2952

Add zarith_stubs_js v0.17.0 in nix-shell (#1233)

Add zarith_stubs_js v0.17.0 in nix-shell (#1233) #2952

Workflow file for this run

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"