Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 0040a07

Browse files
committed
Properly run wasm32-unknown-unknown tests on CI
1 parent b82bba2 commit 0040a07

File tree

5 files changed

+50
-14
lines changed

5 files changed

+50
-14
lines changed

Cargo.toml

+6-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ members = [
2929
"crates/libm-bench",
3030
]
3131

32+
[build-dependencies]
33+
rand = { version = "0.6.5", optional = true }
34+
3235
[dev-dependencies]
3336
no-panic = "0.1.8"
3437

35-
[build-dependencies]
36-
rand = { version = "0.6.5", optional = true }
38+
[target.wasm32-unknown-unknown.dev-dependencies]
39+
wasm-bindgen-test = "0.2.47"
40+

azure-pipelines.yml

+3-11
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,9 @@ jobs:
3939
TARGET: powerpc64le-unknown-linux-gnu
4040
x86_64:
4141
TARGET: x86_64-unknown-linux-gnu
42-
43-
- job: wasm
44-
pool:
45-
vmImage: ubuntu-16.04
46-
steps:
47-
- template: ci/azure-install-rust.yml
48-
- script: rustup target add wasm32-unknown-unknown
49-
displayName: "Install rust wasm target"
50-
- script: sh ./ci/run.sh wasm32-unknown-unknown
51-
variables:
52-
TOOLCHAIN: nightly
42+
wasm32:
43+
TARGET: wasm32-unknown-unknown
44+
TOOLCHAIN: nightly
5345

5446
- job: rustfmt
5547
pool:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ubuntu:18.04
2+
3+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
clang \
6+
cmake \
7+
curl \
8+
git \
9+
libc6-dev \
10+
make \
11+
python \
12+
xz-utils
13+
14+
# Install `wasm2wat`
15+
RUN git clone --recursive https://github.com/WebAssembly/wabt
16+
RUN make -C wabt -j$(nproc)
17+
ENV PATH=$PATH:/wabt/bin
18+
19+
# Install `node`
20+
RUN curl https://nodejs.org/dist/v12.0.0/node-v12.0.0-linux-x64.tar.xz | tar xJf -
21+
ENV PATH=$PATH:/node-v12.0.0-linux-x64/bin
22+
23+
COPY docker/wasm32-unknown-unknown/wasm-entrypoint.sh /wasm-entrypoint.sh
24+
ENTRYPOINT ["/wasm-entrypoint.sh"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
# Download an appropriate version of wasm-bindgen based off of what's being used
6+
# in the lock file. Ideally we'd use `wasm-pack` at some point for this!
7+
version=$(grep -A 1 'name = "wasm-bindgen"' Cargo.lock | grep version)
8+
version=$(echo $version | awk '{print $3}' | sed 's/"//g')
9+
curl -L https://github.com/rustwasm/wasm-bindgen/releases/download/$version/wasm-bindgen-$version-x86_64-unknown-linux-musl.tar.gz \
10+
| tar xzf - -C target
11+
export PATH=$PATH:`pwd`/target/wasm-bindgen-$version-x86_64-unknown-linux-musl
12+
export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_RUNNER=wasm-bindgen-test-runner
13+
export NODE_ARGS=--experimental-wasm-simd
14+
15+
exec "$@"

ci/run-docker.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ run() {
1212
# will be owned by root
1313
mkdir -p target
1414

15-
docker build -t $target ci/docker/$target
15+
docker build -t $target -f ci/docker/$target/Dockerfile ci/
1616
docker run \
1717
--rm \
1818
--user $(id -u):$(id -g) \
@@ -24,6 +24,7 @@ run() {
2424
-v `rustc --print sysroot`:/rust:ro \
2525
--init \
2626
-w /checkout \
27+
--privileged \
2728
$target \
2829
sh -c "HOME=/tmp PATH=\$PATH:/rust/bin exec ci/run.sh $target"
2930
}

0 commit comments

Comments
 (0)