Skip to content

Commit 7628958

Browse files
committed
CI updates
1 parent 51842da commit 7628958

File tree

2 files changed

+61
-5
lines changed

2 files changed

+61
-5
lines changed

.github/workflows/wasm_of_ocaml.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ jobs:
2929
- false
3030
all_jane_street_tests:
3131
- false
32+
wasi:
33+
- false
3234
include:
3335
- os: macos-latest
3436
os-name: MacOS
3537
ocaml-compiler: "5.3"
3638
separate_compilation: true
3739
jane_street_tests: false
3840
all_jane_street_tests: false
41+
wasi: false
3942
- os: windows-latest
4043
os-name: Windows
4144
ocaml-compiler: "5.3"
@@ -49,17 +52,26 @@ jobs:
4952
separate_compilation: true
5053
jane_street_tests: true
5154
all_jane_street_tests: true
55+
wasi: false
5256
- os: ubuntu-latest
5357
os-name: Ubuntu
5458
ocaml-compiler: "5.3"
5559
separate_compilation: false
5660
jane_street_tests: true
5761
all_jane_street_tests: false
62+
wasi: false
63+
- os: ubuntu-latest
64+
os-name: Ubuntu
65+
ocaml-compiler: "5.3"
66+
separate_compilation: true
67+
jane_street_tests: false
68+
all_jane_street_tests: false
69+
wasi: true
5870

5971
runs-on: ${{ matrix.os }}
6072

6173
name:
62-
${{ (! matrix.separate_compilation) && 'Whole program / ' || ''}}${{ matrix.ocaml-compiler }} / ${{ matrix.os-name }}${{ matrix.all_jane_street_tests && ' / Jane Street tests' || ''}}
74+
${{ matrix.wasi && 'WASI / ' || '' }}${{ (! matrix.separate_compilation) && 'Whole program / ' || ''}}${{ matrix.ocaml-compiler }} / ${{ matrix.os-name }}${{ matrix.all_jane_street_tests && ' / Jane Street tests' || ''}}
6375

6476
steps:
6577
- name: Update apt cache
@@ -91,6 +103,25 @@ jobs:
91103
with:
92104
node-version: latest
93105

106+
- name: Set-up Rust toolchain
107+
if: matrix.wasi
108+
uses: actions-rust-lang/setup-rust-toolchain@v1
109+
110+
- name: Checkout Wasmtime
111+
if: matrix.wasi
112+
uses: actions/checkout@v4
113+
with:
114+
repository: bytecodealliance/wasmtime
115+
path: wasmtime
116+
submodules: true
117+
118+
- name: Build Wasmtime
119+
if: matrix.wasi
120+
working-directory: ./wasmtime
121+
run: |
122+
cargo build
123+
echo `pwd`/target/debug >> "$GITHUB_PATH"
124+
94125
- name: Set-up OCaml ${{ matrix.ocaml-compiler }}
95126
uses: ocaml/setup-ocaml@v3
96127
with:
@@ -140,7 +171,7 @@ jobs:
140171
opam install . -t
141172
142173
- name: Run tests
143-
if: ${{ matrix.separate_compilation }}
174+
if: ${{ matrix.separate_compilation && ! matrix.wasi }}
144175
working-directory: ./wasm_of_ocaml
145176
run: opam exec -- dune build @runtest-wasm
146177

@@ -149,11 +180,24 @@ jobs:
149180
# See https://github.com/libuv/libuv/issues/3622
150181

151182
- name: Run tests with CPS effects
152-
if: ${{ matrix.ocaml-compiler >= '5.' && matrix.separate_compilation }}
183+
if: ${{ matrix.ocaml-compiler >= '5.' && matrix.separate_compilation && ! matrix.wasi }}
153184
continue-on-error: ${{ matrix.os == 'windows-latest' }}
154185
working-directory: ./wasm_of_ocaml
155186
run: opam exec -- dune build @runtest-wasm --profile with-effects
156187

188+
- name: Run tests (WASI runtime - node)
189+
if: ${{ matrix.wasi }}
190+
working-directory: ./wasm_of_ocaml
191+
run: opam exec -- dune build @runtest-wasm --profile wasi
192+
193+
- name: Run tests (WASI runtime - wasmtime)
194+
if: ${{ matrix.wasi }}
195+
working-directory: ./wasm_of_ocaml
196+
env:
197+
WASM_ENGINE: wasmtime
198+
WASI_FLAGS: --enable exnref
199+
run: opam exec -- dune build @runtest-wasm --profile wasi
200+
157201
- name: Run Base tests
158202
if: matrix.all_jane_street_tests
159203
continue-on-error: ${{ matrix.os == 'windows-latest' }}

dune

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@
4141
(build_runtime_flags
4242
(:standard --enable wasi))
4343
(flags
44-
(:standard --pretty --enable wasi))
45-
(compilation_mode separate))
44+
(:standard
45+
--pretty
46+
--enable
47+
wasi
48+
(:include wasi_extra_flags)))
49+
; Wasmtime is slow on large binaries, so use whole program compilation
50+
(compilation_mode whole_program))
4651
(binaries
4752
(tools/node_wrapper.exe as node)
4853
(tools/node_wrapper.exe as node.exe)))
@@ -88,6 +93,13 @@
8893
%{target}
8994
(echo "(--debug invariant)"))))
9095

96+
(rule
97+
(targets wasi_extra_flags)
98+
(action
99+
(with-stdout-to
100+
%{targets}
101+
(echo "(%{env:WASI_FLAGS=})"))))
102+
91103
(data_only_dirs _wikidoc doc-dev janestreet)
92104

93105
(vendored_dirs)

0 commit comments

Comments
 (0)