Skip to content

Commit 8d6da57

Browse files
vouillonhhugo
authored andcommitted
CI: switch to version 0.18 of Jane Street packages
1 parent e83bac7 commit 8d6da57

File tree

2 files changed

+109
-109
lines changed

2 files changed

+109
-109
lines changed

.github/workflows/build-wasm_of_ocaml.yml

Lines changed: 68 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,29 @@ jobs:
2020
- "4.14"
2121
- "5.0"
2222
- "5.1"
23-
- "5.2"
2423
- "5.3"
2524
separate_compilation:
2625
- true
26+
jane_street_tests:
27+
- false
28+
all_jane_street_tests:
29+
- false
2730
include:
2831
- os: macos-latest
2932
ocaml-compiler: "5.3"
3033
separate_compilation: true
34+
jane_street_tests: false
35+
all_jane_street_tests: false
3136
- os: ubuntu-latest
32-
ocaml-compiler: "4.14"
37+
ocaml-compiler: "5.2"
38+
separate_compilation: true
39+
jane_street_tests: true
40+
all_jane_street_tests: true
41+
- os: ubuntu-latest
42+
ocaml-compiler: "5.2"
3343
separate_compilation: false
44+
jane_street_tests: true
45+
all_jane_street_tests: false
3446

3547
runs-on: ${{ matrix.os }}
3648

@@ -48,10 +60,11 @@ jobs:
4860
path: wasm_of_ocaml
4961

5062
- name: Checkout Jane Street opam repository
63+
if: matrix.jane_street_tests
5164
uses: actions/checkout@v4
5265
with:
5366
repository: janestreet/opam-repository
54-
ref: feaf8f831051fd5f316963b28efd728cf0b0eca1
67+
ref: 41c89c7824533f6b63cc5b6d75e6ddb1441d1520
5568
path: janestreet/opam-repository
5669

5770
- name: Set-up Node.js
@@ -78,10 +91,20 @@ jobs:
7891
run: opam pin -n --with-version `< VERSION` .
7992

8093
- name: Checkout Jane Street packages
94+
if: matrix.jane_street_tests
8195
run: |
82-
opam install opam-format ocamlfind dune graphics cmdliner sexplib0.v0.16.0
96+
opam repo add js janestreet/opam-repository
97+
opam install opam-format ocamlfind dune graphics cmdliner
8398
opam exec -- ocaml wasm_of_ocaml/tools/ci_setup.ml
8499
100+
- name: Pin Jane Street packages
101+
if: ${{ ! matrix.jane_street_tests }}
102+
run: |
103+
opam pin add -n base.v0.16.1 https://github.com/ocaml-wasm/base.git#wasm
104+
opam pin add -n time_now.v0.16.1 https://github.com/ocaml-wasm/time_now.git#wasm
105+
opam pin add -n ppx_inline_test.v0.16.1 https://github.com/ocaml-wasm/ppx_inline_test.git#wasm
106+
opam pin add -n ppx_expect.v0.16.1 https://github.com/ocaml-wasm/ppx_expect.git#wasm
107+
85108
- name: Install wasm_of_ocaml and its test dependencies
86109
working-directory: ./wasm_of_ocaml
87110
run: |
@@ -97,52 +120,82 @@ jobs:
97120
working-directory: ./wasm_of_ocaml
98121
run: opam exec -- dune build @runtest-wasm --profile with-effects
99122

123+
- name: Create node wrapper for Jane Street tests
124+
run: |
125+
mkdir -p ~/.local/bin
126+
cat > ~/.local/bin/node <<EOF
127+
#!/bin/sh
128+
exec `which node` --experimental-wasm-jspi "\$@"
129+
EOF
130+
chmod +x ~/.local/bin/node
131+
echo ~/.local/bin >> "$GITHUB_PATH"
132+
100133
- name: Run Base tests
101-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
134+
if: matrix.all_jane_street_tests
102135
working-directory: ./janestreet/lib/base
103136
run: opam exec -- dune runtest
104137

105138
- name: Run Base bigstring tests
106-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
139+
if: matrix.all_jane_street_tests
107140
working-directory: ./janestreet/lib/base_bigstring
108141
run: opam exec -- dune runtest
109142

110143
- name: Run Core tests
111-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
144+
if: matrix.all_jane_street_tests
112145
working-directory: ./janestreet/lib/core
113146
run: opam exec -- dune runtest
114147

115148
- name: Run Bignum tests
116-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
149+
if: matrix.all_jane_street_tests
117150
working-directory: ./janestreet/lib/bignum
118151
run: opam exec -- dune runtest
119152

120153
- name: Run Bin_prot tests
121-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
154+
if: matrix.all_jane_street_tests
122155
working-directory: ./janestreet/lib/bin_prot
123156
run: opam exec -- dune runtest
124157

125158
- name: Run String_dict tests
126-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
159+
if: matrix.all_jane_street_tests
127160
working-directory: ./janestreet/lib/string_dict
128161
run: opam exec -- dune runtest
129162

130163
- name: Run Zarith tests
131-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
164+
if: matrix.all_jane_street_tests
132165
working-directory: ./janestreet/lib/zarith_stubs_js
133166
run: opam exec -- dune runtest
134167

135168
- name: Run Virtual_dom tests
136-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
169+
if: matrix.all_jane_street_tests
137170
working-directory: ./janestreet/lib/virtual_dom
138171
run: opam exec -- dune runtest
139172

140173
- name: Run Bonsai tests
141-
if: ${{ matrix.ocaml-compiler < '5.' && matrix.separate_compilation }}
142-
working-directory: ./janestreet/lib/bonsai
174+
if: matrix.all_jane_street_tests
175+
working-directory: ./janestreet/lib/bonsai_test
176+
run: opam exec -- dune runtest
177+
178+
- name: Run Bonsai web tests
179+
if: matrix.all_jane_street_tests
180+
working-directory: ./janestreet/lib/bonsai_web_test
181+
run: opam exec -- dune runtest
182+
183+
- name: Run Bonsai web components' tests
184+
if: matrix.all_jane_street_tests
185+
working-directory: ./janestreet/lib/bonsai_web_components
143186
run: opam exec -- dune runtest
144187

145188
- name: Run Bonsai tests (release profile)
146189
if: ${{ ! matrix.separate_compilation }}
147-
working-directory: ./janestreet/lib/bonsai
190+
working-directory: ./janestreet/lib/bonsai_test
191+
run: opam exec -- dune runtest --profile release
192+
193+
- name: Run Bonsai web tests (release profile)
194+
if: ${{ ! matrix.separate_compilation }}
195+
working-directory: ./janestreet/lib/bonsai_web_test
196+
run: opam exec -- dune runtest --profile release
197+
198+
- name: Run Bonsai web components' tests (release profile)
199+
if: ${{ ! matrix.separate_compilation }}
200+
working-directory: ./janestreet/lib/bonsai_web_components
148201
run: opam exec -- dune runtest --profile release

tools/ci_setup.ml

Lines changed: 41 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,52 @@ module StringSet = Set.Make (String)
1212

1313
let repo = "janestreet/opam-repository/packages"
1414

15-
let roots = [ "bonsai"; "string_dict" ]
15+
let roots = [ "bonsai_web_components"; "string_dict"; "ppx_html" ]
1616

1717
let omitted_others = StringSet.of_list [ "cohttp-async"; "cohttp"; "uri"; "uri-sexp" ]
1818

1919
let omitted_js = StringSet.of_list [ "sexplib0" ]
2020

21-
let do_not_pin =
21+
let do_pin =
2222
StringSet.of_list
23-
[ "wasocaml"; "wasm_of_ocaml"; "dune"; "ezjs"; "ezjs_blockies"; "fmlib"; "graphv" ]
23+
[ "base"
24+
; "ppx_expect"
25+
; "ppx_inline_test"
26+
; "time_now"
27+
; "ocaml_intrinsics_kernel"
28+
; "bigstringaf"
29+
]
2430

25-
let do_pin = StringSet.of_list [ "base"; "ppx_expect"; "ppx_inline_test"; "time_now" ]
26-
27-
let aliases = [ "ocaml-cstruct", "cstruct" ]
31+
let forked_packages =
32+
StringSet.of_list
33+
[ "async_js"
34+
; "base"
35+
; "base_bigstring"
36+
; "bin_prot"
37+
; "bonsai_test"
38+
; "bonsai_web"
39+
; "bonsai_web_components"
40+
; "bonsai_web_test"
41+
; "core"
42+
; "core_kernel"
43+
; "ocaml_intrinsics_kernel"
44+
; "ppx_expect"
45+
; "ppx_inline_test"
46+
; "ppx_module_timer"
47+
; "string_dict"
48+
; "time_now"
49+
; "virtual_dom"
50+
; "virtual_dom_toplayer"
51+
; "zarith_stubs_js"
52+
]
2853

2954
let dune_workspace =
3055
{|(lang dune 3.17)
3156
(env
3257
(_
3358
(env-vars (TESTING_FRAMEWORK inline-test))
3459
(js_of_ocaml (enabled_if false))
35-
(flags :standard -warn-error -8-32-34-49-52-55 -w -67-69)))
60+
(flags :standard -warn-error -7-8-27-30-32-34-37-49-52-55 -w -67-69)))
3661
|}
3762

3863
let patches =
@@ -60,19 +85,17 @@ diff --git a/dune-project b/dune-project
6085
index e563d7e..b87e356 100644
6186
--- a/dune-project
6287
+++ b/dune-project
63-
@@ -1,3 +1,3 @@
64-
-(lang dune 2.0)
88+
@@ -1 +1 @@
89+
-(lang dune 3.11)
6590
+(lang dune 3.17)
66-
67-
(formatting disabled)
6891
diff --git a/test/src/dune b/test/src/dune
6992
index f93ae3f..3f00557 100644
7093
--- a/test/src/dune
7194
+++ b/test/src/dune
7295
@@ -2,5 +2,6 @@
7396
(name bignum_test)
7497
(libraries bigint bignum core expect_test_helpers_core
75-
sexp_grammar_validation)
98+
sexp_grammar_validation zarith)
7699
+ (inline_tests (flags -drop-tag no-js -drop-tag no-wasm -drop-tag 64-bits-only) (modes js wasm))
77100
(preprocess
78101
(pps ppx_jane)))
@@ -91,58 +114,7 @@ index c6d09fb..61b1e5b 100644
91114
+
92115
let%expect_test "Bignum.abs" =
93116
let test t =
94-
let t' = require_no_allocation [%here] (fun () -> abs t) in
95-
@@ -71,7 +76,7 @@ let%expect_test "Bignum.sexp_of_t does use Scientific Notation" =
96-
let compare_floats ~of_float x =
97-
let x' = x |> of_float |> Bignum.to_float in
98-
if not (Float.( = ) x x' || (Float.is_nan x && Float.is_nan x'))
99-
- then raise_s [%message "mismatch" (x : float) (x' : float)]
100-
+ then raise_s [%message "mismatch" (x : float) (x' : float) (x |> of_float : Bignum.t)]
101-
;;
102-
103-
let%expect_test "roundtrip: f |> Bignum.of_float_decimal |> Bignum.to_float" =
104-
@@ -783,7 +788,7 @@ let%test_module _ =
105-
-1073741825 -> ( 6) \001\253\255\255\255\191 |}]
106-
;;
107-
108-
- let%expect_test ("bin_io serialization V2 (javascript)" [@tags "js-only"]) =
109-
+ let%expect_test ("bin_io serialization V2 (javascript)" [@tags "js-only", "no-wasm"]) =
110-
bin_io_tests (module V2);
111-
[%expect
112-
{|
113-
@@ -811,6 +816,34 @@ let%test_module _ =
114-
-1073741825 -> ( 6) \001\253\255\255\255\191 |}]
115-
;;
116-
117-
+ let%expect_test ("bin_io serialization V2 (Wasm)" [@tags "wasm-only"]) =
118-
+ bin_io_tests (module V2);
119-
+ [%expect
120-
+ {|
121-
+ 0 -> ( 1) \000
122-
+ 1 -> ( 2) \001\001
123-
+ -1 -> ( 3) \001\255\255
124-
+ 100000001 -> ( 6) \001\253\001\225\245\005
125-
+ 1000000.1 -> ( 6) \002\253\129\150\152\000
126-
+ 100000.01 -> ( 6) \003\253\129\150\152\000
127-
+ 10000.001 -> ( 6) \004\253\129\150\152\000
128-
+ 1000.0001 -> ( 6) \005\253\129\150\152\000
129-
+ 100.00001 -> ( 6) \006\253\129\150\152\000
130-
+ 10.000001 -> ( 6) \007\253\129\150\152\000
131-
+ 1.0000001 -> ( 6) \008\253\129\150\152\000
132-
+ 0.10000001 -> ( 6) \009\253\129\150\152\000
133-
+ 0.010000001 -> (11) \010\253\129\150\152\000\253\000\202\154\059
134-
+ 0.0010000001 -> (22) \011\02010000001\04710000000000
135-
+ 10000000000000 -> (16) \011\01410000000000000
136-
+ -10000000000000 -> (17) \011\015\04510000000000000
137-
+12345678901234567.12345678901234567 -> (55) \01151234567890123456712345678901234567\047100000000000000000
138-
+ 1099511627775 -> (15) \011\0131099511627775
139-
+ 1073741823 -> ( 6) \001\253\255\255\255\063
140-
+ -1073741824 -> ( 6) \001\253\000\000\000\192
141-
+ 1073741824 -> (12) \011\0101073741824
142-
+ -1073741825 -> (13) \011\011\0451073741825 |}]
143-
+ ;;
144-
+
145-
let%expect_test "bin_io de-serialization V2" =
117+
let t' = require_no_allocation (fun () -> abs t) in
146118
|bignum}
147119
)
148120
]
@@ -181,17 +153,6 @@ let rec traverse visited p =
181153
let l = dependencies opam in
182154
List.fold_left traverse visited l
183155

184-
let forked_packages =
185-
let ch =
186-
Unix.open_process_in
187-
"curl -L -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: \
188-
2022-11-28' https://api.github.com/orgs/ocaml-wasm/repos 2> /dev/null | jq -r \
189-
'.[] | .name'"
190-
in
191-
let l = Str.(split (regexp "\n")) (In_channel.input_all ch) in
192-
close_in ch;
193-
StringSet.of_list l
194-
195156
let is_forked p = StringSet.mem p forked_packages
196157

197158
let exec_async ~delay cmd =
@@ -210,18 +171,11 @@ let pin delay nm =
210171
exec_async
211172
~delay
212173
(Printf.sprintf
213-
"opam pin add -n %s https://github.com/ocaml-wasm/%s.git#wasm"
214-
(try List.assoc nm aliases
215-
with Not_found -> if List.mem_assoc nm packages then nm ^ ".v0.16.1" else nm)
174+
"opam pin add -n %s https://github.com/ocaml-wasm/%s.git#wasm-v0.18"
175+
nm
216176
nm)
217177

218-
let pin_packages js =
219-
sync_exec
220-
pin
221-
(StringSet.elements
222-
(StringSet.union
223-
(StringSet.diff (StringSet.diff forked_packages js) do_not_pin)
224-
do_pin))
178+
let pin_packages () = sync_exec pin (StringSet.elements do_pin)
225179

226180
let install_others others =
227181
let others = StringSet.elements (StringSet.diff others omitted_others) in
@@ -257,19 +211,12 @@ let () =
257211
List.fold_left traverse StringSet.empty roots
258212
|> StringSet.partition (fun p -> List.mem_assoc p packages)
259213
in
260-
pin_packages js;
214+
pin_packages ();
261215
install_others others;
262216
sync_exec (fun i () -> clone i "ocaml-uri" "https://github.com/mirage/ocaml-uri") [ () ];
263217
sync_exec
264218
(fun i nm ->
265-
let branch =
266-
if is_forked nm
267-
then
268-
if List.mem nm [ "bonsai"; "virtual_dom"; "async_js"; "zarith_stubs_js" ]
269-
then Some "jsoo-6"
270-
else Some "wasm"
271-
else None
272-
in
219+
let branch = if is_forked nm then Some "wasm-v0.18" else None in
273220
let commit =
274221
if is_forked nm
275222
then None

0 commit comments

Comments
 (0)