Install wasm-opt on Netlify, since wasm-pack fails to do so

This commit is contained in:
Brian Carroll 2022-05-15 13:45:37 +01:00
parent 6a91e66192
commit 1b6c2fccef
No known key found for this signature in database
GPG Key ID: 9CF4E3BF9C4722C7
3 changed files with 15 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
target target
generated-docs generated-docs
netlify-install
zig-cache zig-cache
.direnv .direnv
.envrc .envrc

View File

@ -39,4 +39,7 @@ echo "Building Web REPL..."
repl_www/build.sh repl_www/build.sh
cp -r repl_www/public/* www/build cp -r repl_www/public/* www/build
echo "Asset sizes:"
ls -lh www/build/*
popd popd

View File

@ -8,9 +8,19 @@ rustup update
rustup default stable rustup default stable
rustup target add wasm32-unknown-unknown wasm32-wasi rustup target add wasm32-unknown-unknown wasm32-wasi
cd netlify-install
ZIG_DIRNAME="zig-linux-x86_64-0.9.1" ZIG_DIRNAME="zig-linux-x86_64-0.9.1"
wget https://ziglang.org/download/0.9.1/${ZIG_DIRNAME}.tar.xz wget https://ziglang.org/download/0.9.1/${ZIG_DIRNAME}.tar.xz
tar --extract --xz --file=${ZIG_DIRNAME}.tar.xz tar --extract --xz --file=${ZIG_DIRNAME}.tar.xz
export PATH="$(pwd)/${ZIG_DIRNAME}:${PATH}"
# Work around an issue with wasm-pack where it fails to install wasm-opt (from binaryen) on some CI systems
# https://github.com/rustwasm/wasm-pack/issues/864
BINARYEN_DIRNAME="binaryen-version_108-x86_64-linux"
wget https://github.com/WebAssembly/binaryen/releases/download/version_108/${BINARYEN_DIRNAME}.tar.gz
tar --extract --gzip --file=${BINARYEN_DIRNAME}.tar.gz
cd ..
export PATH="$(pwd)/netlify-install/${BINARYEN_DIRNAME}/bin:$(pwd)/netlify-install/${ZIG_DIRNAME}:${PATH}"
bash build.sh bash build.sh