Skip to content

Commit 0420f15

Browse files
committed
Install Binaryen for wasm_of_ocaml
Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent 578d356 commit 0420f15

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ LABEL org.opencontainers.image.description="Docker image for ReScript developmen
44

55
RUN sudo apt-get update && export DEBIAN_FRONTEND=noninteractive \
66
&& apt-get -y install --no-install-recommends \
7+
binaryen \
78
cmake \
89
musl-tools \
910
ninja-build \

.github/actions/setup-ocaml/action.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,54 @@ outputs:
2323
runs:
2424
using: composite
2525
steps:
26+
# wasm_of_ocaml requires Binaryen 119 or newer, including wasm-merge.
27+
# Hosted runners do not consistently provide a suitable complete version,
28+
# so use the same pinned official release on Linux and macOS.
29+
- name: Install Binaryen
30+
if: runner.os != 'Windows'
31+
shell: bash
32+
env:
33+
BINARYEN_VERSION: "131"
34+
run: |
35+
case "$RUNNER_OS-$RUNNER_ARCH" in
36+
Linux-X64)
37+
platform=x86_64-linux
38+
checksum=b5bf1f0eaf17c63ee588ff7a5954dc8f6ce2c26989051c66f24dfe9ece3e46db
39+
;;
40+
Linux-ARM64)
41+
platform=aarch64-linux
42+
checksum=ba991f677edd9a21d2bc96c0144bc8ac5b112d4d98a3eb266e075e22e557df2a
43+
;;
44+
macOS-X64)
45+
platform=x86_64-macos
46+
checksum=d209fadd8a894bdaf3bd3612a23c32a0af184d2f4a979b8c789e6e4f6a4de883
47+
;;
48+
macOS-ARM64)
49+
platform=arm64-macos
50+
checksum=e441b48dc22163d209b4f05e44dc7210909b01237642b6c9ae48fd710a3ef83e
51+
;;
52+
*)
53+
echo "Unsupported Binaryen platform: $RUNNER_OS-$RUNNER_ARCH" >&2
54+
exit 1
55+
;;
56+
esac
57+
58+
archive="binaryen-version_${BINARYEN_VERSION}-${platform}.tar.gz"
59+
install_dir="$RUNNER_TOOL_CACHE/binaryen/$BINARYEN_VERSION/$RUNNER_ARCH"
60+
curl -fsSL \
61+
"https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/${archive}" \
62+
-o "$RUNNER_TEMP/$archive"
63+
64+
if [[ "$RUNNER_OS" == "macOS" ]]; then
65+
echo "$checksum $RUNNER_TEMP/$archive" | shasum -a 256 --check
66+
else
67+
echo "$checksum $RUNNER_TEMP/$archive" | sha256sum --check
68+
fi
69+
70+
mkdir -p "$install_dir"
71+
tar -xzf "$RUNNER_TEMP/$archive" --strip-components=1 -C "$install_dir"
72+
echo "$install_dir/bin" >> "$GITHUB_PATH"
73+
2674
- name: Get OPAM cache key
2775
id: cache-key
2876
shell: bash

0 commit comments

Comments
 (0)