@@ -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
8799 with :
88100 node-version : latest
89101
102+ - name : Set-up Rust toolchain
103+ if : matrix.wasi
104+ uses : actions-rust-lang/setup-rust-toolchain@v1
105+
106+ - name : Checkout Wasmtime
107+ if : matrix.wasi
108+ uses : actions/checkout@v4
109+ with :
110+ repository : bytecodealliance/wasmtime
111+ path : wasmtime
112+ submodules : true
113+
114+ - name : Build Wasmtime
115+ if : matrix.wasi
116+ working-directory : ./wasmtime
117+ run : |
118+ cargo build
119+ echo `pwd`/target/debug >> "$GITHUB_PATH"
120+
90121 - name : Set-up OCaml ${{ matrix.ocaml-compiler }}
91122 uses : ocaml/setup-ocaml@v3
92123 with :
@@ -133,7 +164,7 @@ jobs:
133164 opam install . -t
134165
135166 - name : Run tests
136- if : ${{ matrix.separate_compilation }}
167+ if : ${{ matrix.separate_compilation && ! matrix.wasi }}
137168 working-directory : ./wasm_of_ocaml
138169 run : opam exec -- dune build @runtest-wasm
139170
@@ -142,11 +173,24 @@ jobs:
142173 # See https://github.com/libuv/libuv/issues/3622
143174
144175 - name : Run tests with CPS effects
145- if : ${{ matrix.ocaml-compiler >= '5.' && matrix.separate_compilation }}
176+ if : ${{ matrix.ocaml-compiler >= '5.' && matrix.separate_compilation && ! matrix.wasi }}
146177 continue-on-error : ${{ matrix.os == 'windows-latest' }}
147178 working-directory : ./wasm_of_ocaml
148179 run : opam exec -- dune build @runtest-wasm --profile with-effects
149180
181+ - name : Run tests (WASI runtime - node)
182+ if : ${{ matrix.wasi }}
183+ working-directory : ./wasm_of_ocaml
184+ run : opam exec -- dune build @runtest-wasm --profile wasi
185+
186+ - name : Run tests (WASI runtime - wasmtime)
187+ if : ${{ matrix.wasi }}
188+ working-directory : ./wasm_of_ocaml
189+ env :
190+ WASM_ENGINE : wasmtime
191+ WASI_FLAGS : --enable exnref
192+ run : opam exec -- dune build @runtest-wasm --profile wasi
193+
150194 - name : Run Base tests
151195 if : matrix.all_jane_street_tests
152196 continue-on-error : ${{ matrix.os == 'windows-latest' }}
0 commit comments