From c24b5e782b3b0e426bd6566eeea0d853899b72e5 Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Tue, 13 Feb 2024 09:53:34 +0100 Subject: [PATCH 1/2] fix(engine/dune): disable js build by default --- engine/bin/dune | 12 ++++-------- engine/bin/dune-js | 8 ++++++++ engine/default.nix | 2 ++ 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 engine/bin/dune-js diff --git a/engine/bin/dune b/engine/bin/dune index 085686c48..2027c3ab7 100644 --- a/engine/bin/dune +++ b/engine/bin/dune @@ -25,14 +25,10 @@ (modules native_driver) (libraries lib)) -(executable - (optional) - (name js_driver) - (modes js) - (modules js_driver) - (js_of_ocaml - (javascript_files js_stubs/mutex.js js_stubs/stdint.js js_stubs/unix.js)) - (libraries zarith_stubs_js js_of_ocaml lib)) +; The following line is commented: by default, we don't want to +; generate javascript. + +; (include dune-js) (env (_ diff --git a/engine/bin/dune-js b/engine/bin/dune-js new file mode 100644 index 000000000..68df628e7 --- /dev/null +++ b/engine/bin/dune-js @@ -0,0 +1,8 @@ +(executable + (optional) + (name js_driver) + (modes js) + (modules js_driver) + (js_of_ocaml + (javascript_files js_stubs/mutex.js js_stubs/stdint.js js_stubs/unix.js)) + (libraries zarith_stubs_js js_of_ocaml lib)) diff --git a/engine/default.nix b/engine/default.nix index a9d6c7b3b..9c1405590 100644 --- a/engine/default.nix +++ b/engine/default.nix @@ -111,6 +111,8 @@ name = "hax-engine.js"; nativeBuildInputs = old.nativeBuildInputs ++ [closurecompiler gnused]; buildPhase = '' + # Enable JS build + sed -i "s/; (include dune-js)/(include dune-js)/g" bin/dune # Compile JS target dune build bin/js_driver.bc.js # Optimize the size of the JS file From 4c70ccab2f4b72cfa135bd1d876e476c3fe2e546 Mon Sep 17 00:00:00 2001 From: Lucas Franceschino Date: Tue, 7 May 2024 09:29:03 +0200 Subject: [PATCH 2/2] feat(ci): test JS compilation of the engine --- .github/workflows/engine_js_build.yml | 18 ++++++++++++++++++ CI.md | 4 +++- 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/engine_js_build.yml diff --git a/.github/workflows/engine_js_build.yml b/.github/workflows/engine_js_build.yml new file mode 100644 index 000000000..36d7c9498 --- /dev/null +++ b/.github/workflows/engine_js_build.yml @@ -0,0 +1,18 @@ +name: Test JS build + +on: + pull_request: + merge_group: + workflow_dispatch: + push: + branches: [main] + +jobs: + engine-js-build: + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'merge_group' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - run: nix build .\#hax-engine.passthru.js -L diff --git a/CI.md b/CI.md index e8aa10b72..d78af2135 100644 --- a/CI.md +++ b/CI.md @@ -17,7 +17,9 @@ FStar, we do not run Coq or FStar on the extractions. - [`test_installs`](./.github/workflows/test_installs.yml): compiles the toolchain on two versions of Ubuntu and two versions of MacOS - using `apt` or `homebrew` and the `setup.sh` script. + using `apt` or `homebrew` and the `setup.sh` script; + - [`engine-js-build`](./.github/workflows/engine_js_build.yml): tests + the build the JS version of the engine. ## Merge queue Additional actions are triggered on pull requests in the merge queue. They are