Skip to content

Commit a8e0de9

Browse files
committed
CI updates
1 parent 73bac49 commit a8e0de9

File tree

2 files changed

+70
-3
lines changed

2 files changed

+70
-3
lines changed

.github/workflows/build-wasm_of_ocaml.yml

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ jobs:
1616
matrix:
1717
os:
1818
- ubuntu-latest
19+
os-name:
20+
- Ubuntu
1921
ocaml-compiler:
2022
- "4.14"
2123
- "5.0"
@@ -27,30 +29,50 @@ jobs:
2729
- false
2830
all_jane_street_tests:
2931
- false
32+
wasi:
33+
- false
3034
include:
3135
- os: macos-latest
36+
os-name: MacOS
3237
ocaml-compiler: "5.3"
3338
separate_compilation: true
3439
jane_street_tests: false
3540
all_jane_street_tests: false
41+
wasi: false
3642
- os: windows-latest
43+
os-name: Windows
3744
ocaml-compiler: "5.2"
3845
separate_compilation: true
3946
jane_street_tests: true
4047
all_jane_street_tests: true
48+
wasi: false
4149
- os: ubuntu-latest
50+
os-name: Ubuntu
4251
ocaml-compiler: "5.2"
4352
separate_compilation: true
4453
jane_street_tests: true
4554
all_jane_street_tests: true
55+
wasi: false
4656
- os: ubuntu-latest
57+
os-name: Ubuntu
4758
ocaml-compiler: "5.2"
4859
separate_compilation: false
4960
jane_street_tests: true
5061
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
5170

5271
runs-on: ${{ matrix.os }}
5372

73+
name:
74+
${{ matrix.wasi && 'WASI / ' || '' }}${{ (! matrix.separate_compilation) && 'Whole program / ' || ''}}${{ matrix.ocaml-compiler }} / ${{ matrix.os-name }}${{ matrix.all_jane_street_tests && ' / Jane Street tests' || ''}}
75+
5476
steps:
5577
- name: Set git to use LF
5678
if: ${{ matrix.os == 'windows-latest' && matrix.ocaml-compiler < 5.2 }}
@@ -77,6 +99,25 @@ jobs:
7799
with:
78100
node-version: latest
79101

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+
80121
- name: Set-up OCaml ${{ matrix.ocaml-compiler }}
81122
uses: ocaml/setup-ocaml@v3
82123
with:
@@ -127,7 +168,7 @@ jobs:
127168
opam install num cohttp-lwt-unix ppx_expect cstruct uucp
128169
129170
- name: Run tests
130-
if: ${{ matrix.separate_compilation }}
171+
if: ${{ matrix.separate_compilation && ! matrix.wasi }}
131172
working-directory: ./wasm_of_ocaml
132173
run: opam exec -- dune build @runtest-wasm
133174

@@ -136,11 +177,26 @@ jobs:
136177
# See https://github.com/libuv/libuv/issues/3622
137178

138179
- name: Run tests with CPS effects
139-
if: ${{ matrix.ocaml-compiler >= '5.' && matrix.separate_compilation }}
180+
if: ${{ matrix.ocaml-compiler >= '5.' && matrix.separate_compilation && ! matrix.wasi }}
140181
continue-on-error: ${{ matrix.os == 'windows-latest' }}
141182
working-directory: ./wasm_of_ocaml
142183
run: opam exec -- dune build @runtest-wasm --profile with-effects
143184

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+
144200
- name: Run Base tests
145201
if: matrix.all_jane_street_tests
146202
continue-on-error: ${{ matrix.os == 'windows-latest' }}

dune

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@
3333
(wasi
3434
(wasm_of_ocaml
3535
(flags
36-
(:standard --pretty --enable wasi))
36+
(:standard
37+
--pretty
38+
--enable
39+
wasi
40+
(:include wasi_extra_flags)))
3741
(compilation_mode whole_program))
3842
(binaries
3943
(tools/node_wrapper.exe as node)
@@ -63,6 +67,13 @@
6367
%{dep:VERSION}
6468
%{dep:tools/version/GIT-VERSION}))))
6569

70+
(rule
71+
(targets wasi_extra_flags)
72+
(action
73+
(with-stdout-to
74+
%{targets}
75+
(echo "(%{env:WASI_FLAGS=})"))))
76+
6677
(data_only_dirs _wikidoc doc-dev janestreet)
6778

6879
(vendored_dirs)

0 commit comments

Comments
 (0)