@@ -32,13 +32,16 @@ jobs:
3232 - false
3333 all_jane_street_tests :
3434 - false
35+ wasi :
36+ - false
3537 include :
3638 - os : macos-latest
3739 os-name : MacOS
3840 ocaml-compiler : " 5.3"
3941 separate_compilation : true
4042 jane_street_tests : false
4143 all_jane_street_tests : false
44+ wasi : false
4245 - os : windows-latest
4346 os-name : Windows
4447 ocaml-compiler : " 5.3"
@@ -52,17 +55,26 @@ jobs:
5255 separate_compilation : true
5356 jane_street_tests : true
5457 all_jane_street_tests : true
58+ wasi : false
5559 - os : ubuntu-latest
5660 os-name : Ubuntu
5761 ocaml-compiler : " 5.3"
5862 separate_compilation : false
5963 jane_street_tests : true
6064 all_jane_street_tests : false
65+ wasi : false
66+ - os : ubuntu-latest
67+ os-name : Ubuntu
68+ ocaml-compiler : " 5.3"
69+ separate_compilation : true
70+ jane_street_tests : false
71+ all_jane_street_tests : false
72+ wasi : true
6173
6274 runs-on : ${{ matrix.os }}
6375
6476 name :
65- ${{ (! matrix.separate_compilation) && 'Whole program / ' || ''}}${{ matrix.ocaml-compiler }} / ${{ matrix.os-name }}${{ matrix.all_jane_street_tests && ' / Jane Street tests' || ''}}
77+ ${{ matrix.wasi && 'WASI / ' || '' }}${{ (! matrix.separate_compilation) && 'Whole program / ' || ''}}${{ matrix.ocaml-compiler }} / ${{ matrix.os-name }}${{ matrix.all_jane_street_tests && ' / Jane Street tests' || ''}}
6678
6779 steps :
6880 - name : Update apt cache
@@ -94,6 +106,25 @@ jobs:
94106 with :
95107 node-version : latest
96108
109+ - name : Set-up Rust toolchain
110+ if : matrix.wasi
111+ uses : actions-rust-lang/setup-rust-toolchain@v1
112+
113+ - name : Checkout Wasmtime
114+ if : matrix.wasi
115+ uses : actions/checkout@v4
116+ with :
117+ repository : bytecodealliance/wasmtime
118+ path : wasmtime
119+ submodules : true
120+
121+ - name : Build Wasmtime
122+ if : matrix.wasi
123+ working-directory : ./wasmtime
124+ run : |
125+ cargo build
126+ echo `pwd`/target/debug >> "$GITHUB_PATH"
127+
97128 - name : Set-up OCaml ${{ matrix.ocaml-compiler }}
98129 uses : ocaml/setup-ocaml@v3
99130 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' }}
0 commit comments