Skip to content

Commit

Permalink
Attempt to fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
OlivierNicole committed Oct 2, 2024
1 parent 669db6b commit bbca491
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-wasm_of_ocaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
ocaml-compiler:
- 4.14.x
- 5.00.x
- 5.01.x
- 5.02.x

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

Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,26 @@ jobs:
dune-cache: true
opam-pin: false

- name: Checkout Jane Street opam repository
uses: actions/checkout@v4
with:
repository: janestreet/opam-repository
ref: feaf8f831051fd5f316963b28efd728cf0b0eca1
path: jane-street/opam-repository

- name: Pin dune
run: |
opam pin add -n dune.3.17 https://github.com/ocaml-wasm/dune.git#wasm_of_ocaml-incremental
- name: Install opam file parser
run: opam install opam-format ocamlfind dune graphics

- name: Checkout Jane Street packages
run: opam exec -- ocaml tools/ci_setup.ml

- name: Update test dependencies
run: opam install num cohttp-lwt-unix ppx_expect cstruct

- run: opam install conf-pkg-config
if: runner.os == 'Windows'

Expand All @@ -106,6 +126,12 @@ jobs:
- run: opam exec -- dune build @all @runtest --profile using-effects
if: ${{ !matrix.skip-effects }}

- run: opam exec -- dune build @all @runtest --profile wasm
if: ${{ !matrix.skip-test }}

- run: opam exec -- dune build @all @runtest --profile wasm-effects
if: ${{ !matrix.skip-effects }}

- run: opam exec -- git diff --exit-code
if: ${{ !matrix.skip-test }}

Expand Down
46 changes: 46 additions & 0 deletions tools/ci_setup.ml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,52 @@

module StringSet = Set.Make (String)

module In_channel = struct
include In_channel

let input_all ic =
let chunk_size = 65536 in (* IO_BUFFER_SIZE *)
let initial_size =
try
Stdlib.in_channel_length ic - Stdlib.pos_in ic
with Sys_error _ ->
-1
in
let initial_size = if initial_size < 0 then chunk_size else initial_size in
let initial_size =
if initial_size <= Sys.max_string_length then
initial_size
else
Sys.max_string_length
in
let buf = Bytes.create initial_size in
let nread = read_upto ic buf 0 initial_size in
if nread < initial_size then (* EOF reached, buffer partially filled *)
Bytes.sub_string buf 0 nread
else begin (* nread = initial_size, maybe EOF reached *)
match Stdlib.input_char ic with
| exception End_of_file ->
(* EOF reached, buffer is completely filled *)
Bytes.unsafe_to_string buf
| c ->
(* EOF not reached *)
let rec loop buf ofs =
let buf = ensure buf ofs chunk_size in
let rem = Bytes.length buf - ofs in
(* [rem] can be < [chunk_size] if buffer size close to
[Sys.max_string_length] *)
let r = read_upto ic buf ofs rem in
if r < rem then (* EOF reached *)
Bytes.sub_string buf 0 (ofs + r)
else (* r = rem *)
loop buf (ofs + rem)
in
let buf = ensure buf nread (chunk_size + 1) in
Bytes.set buf nread c;
loop buf (nread + 1)
end
end

(****)

let repo = "jane-street/opam-repository/packages"
Expand Down

0 comments on commit bbca491

Please sign in to comment.