Skip to content

Commit 312732f

Browse files
committed
CI updates
1 parent cdcddeb commit 312732f

File tree

2 files changed

+61
-4
lines changed

2 files changed

+61
-4
lines changed

.github/workflows/wasm_of_ocaml.yml

Lines changed: 49 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:
@@ -137,7 +168,7 @@ jobs:
137168
opam install . -t
138169
139170
- name: Run tests
140-
if: ${{ matrix.separate_compilation }}
171+
if: ${{ matrix.separate_compilation && ! matrix.wasi }}
141172
working-directory: ./wasm_of_ocaml
142173
run: opam exec -- dune build @runtest-wasm
143174

@@ -146,11 +177,26 @@ jobs:
146177
# See https://github.com/libuv/libuv/issues/3622
147178

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

185+
- name: Run tests (WASI runtime - node)
186+
if: ${{ matrix.wasi }}
187+
working-directory: ./wasm_of_ocaml
188+
run: opam exec -- dune build @runtest-wasm --profile wasi
189+
190+
- name: Run tests (WASI runtime - wasmtime)
191+
if: ${{ matrix.wasi }}
192+
working-directory: ./wasm_of_ocaml
193+
env:
194+
WASM_ENGINE: wasmtime
195+
WASI_FLAGS: --enable trap-on-exception
196+
RUST_BACKTRACE: 0
197+
continue-on-error: true
198+
run: opam exec -- dune build @runtest-wasm --profile wasi
199+
154200
- name: Run Base tests
155201
if: matrix.all_jane_street_tests
156202
continue-on-error: ${{ matrix.os == 'windows-latest' }}

dune

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@
4444
wasi
4545
(:include wasi_extra_flags)))
4646
(flags
47-
(:standard --pretty --enable wasi))
47+
(:standard
48+
--pretty
49+
--enable
50+
wasi
51+
(:include wasi_extra_flags)))
4852
(compilation_mode separate))
4953
(binaries
5054
(tools/node_wrapper.exe as node)
@@ -91,6 +95,13 @@
9195
%{target}
9296
(echo "(--debug invariant)"))))
9397

98+
(rule
99+
(targets wasi_extra_flags)
100+
(action
101+
(with-stdout-to
102+
%{targets}
103+
(echo "(%{env:WASI_FLAGS=})"))))
104+
94105
(data_only_dirs _wikidoc doc-dev janestreet)
95106

96107
(vendored_dirs)

0 commit comments

Comments
 (0)