diff --git a/azure-pipelines.yml b/azure-pipelines.yml index ca17cc9fa..934eb839c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -39,17 +39,9 @@ jobs: TARGET: powerpc64le-unknown-linux-gnu x86_64: TARGET: x86_64-unknown-linux-gnu - - - job: wasm - pool: - vmImage: ubuntu-16.04 - steps: - - template: ci/azure-install-rust.yml - - script: rustup target add wasm32-unknown-unknown - displayName: "Install rust wasm target" - - script: sh ./ci/run.sh wasm32-unknown-unknown - variables: - TOOLCHAIN: nightly + wasm32: + TARGET: wasm32-unknown-unknown + TOOLCHAIN: nightly - job: rustfmt pool: diff --git a/ci/docker/wasm32-unknown-unknown/Dockerfile b/ci/docker/wasm32-unknown-unknown/Dockerfile new file mode 100644 index 000000000..ff8eb2844 --- /dev/null +++ b/ci/docker/wasm32-unknown-unknown/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:18.04 + +RUN apt-get update -y && apt-get install -y --no-install-recommends \ + ca-certificates \ + clang \ + cmake \ + curl \ + git \ + libc6-dev \ + make \ + python \ + xz-utils + +# Install `wasm2wat` +RUN git clone --recursive https://github.com/WebAssembly/wabt +RUN make -C wabt -j$(nproc) +ENV PATH=$PATH:/wabt/bin + +# Install `node` +RUN curl https://nodejs.org/dist/v12.0.0/node-v12.0.0-linux-x64.tar.xz | tar xJf - +ENV PATH=$PATH:/node-v12.0.0-linux-x64/bin + +COPY docker/wasm32-unknown-unknown/wasm-entrypoint.sh /wasm-entrypoint.sh +ENTRYPOINT ["/wasm-entrypoint.sh"] diff --git a/ci/docker/wasm32-unknown-unknown/wasm-entrypoint.sh b/ci/docker/wasm32-unknown-unknown/wasm-entrypoint.sh new file mode 100755 index 000000000..89b1d6855 --- /dev/null +++ b/ci/docker/wasm32-unknown-unknown/wasm-entrypoint.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +set -ex + +# Download an appropriate version of wasm-bindgen based off of what's being used +# in the lock file. Ideally we'd use `wasm-pack` at some point for this! +version=$(grep -A 1 'name = "wasm-bindgen"' Cargo.lock | grep version) +version=$(echo $version | awk '{print $3}' | sed 's/"//g') +curl -L https://github.com/rustwasm/wasm-bindgen/releases/download/$version/wasm-bindgen-$version-x86_64-unknown-linux-musl.tar.gz \ + | tar xzf - -C target +export PATH=$PATH:`pwd`/target/wasm-bindgen-$version-x86_64-unknown-linux-musl +export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner +export NODE_ARGS=--experimental-wasm-simd + +exec "$@" diff --git a/ci/run-docker.sh b/ci/run-docker.sh index e7b80c719..96720626b 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -12,7 +12,7 @@ run() { # will be owned by root mkdir -p target - docker build -t $target ci/docker/$target + docker build -t $target -f ci/docker/$target/Dockerfile ci/ docker run \ --rm \ --user $(id -u):$(id -g) \ @@ -24,6 +24,7 @@ run() { -v `rustc --print sysroot`:/rust:ro \ --init \ -w /checkout \ + --privileged \ $target \ sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh $target" }