Skip to content

Commit

Permalink
Merge pull request #506 from hacspec/disable-js-build
Browse files Browse the repository at this point in the history
fix(engine/dune): disable js build by default
  • Loading branch information
franziskuskiefer authored May 7, 2024
2 parents ecbd9cb + 4c70cca commit 228e53b
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/engine_js_build.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion CI.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 4 additions & 8 deletions engine/bin/dune
Original file line number Diff line number Diff line change
Expand Up @@ -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
(_
Expand Down
8 changes: 8 additions & 0 deletions engine/bin/dune-js
Original file line number Diff line number Diff line change
@@ -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))
2 changes: 2 additions & 0 deletions engine/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 228e53b

Please sign in to comment.