Skip to content

Commit 15f8c44

Browse files
committed
Add wasm32-wasip2 to the test matrix on CI
This is similar to #3869 except that it adds tests for `wasm32-wasip2` in addition to `wasm32-wasip1`. This is intended to eventually empower definitions from rust-lang/rust#129638 to move into this repository.
1 parent 571e5be commit 15f8c44

File tree

4 files changed

+46
-19
lines changed

4 files changed

+46
-19
lines changed

.github/workflows/full_ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ jobs:
119119
s390x-unknown-linux-gnu,
120120
riscv64gc-unknown-linux-gnu,
121121
wasm32-wasip1,
122+
wasm32-wasip2,
122123
sparc64-unknown-linux-gnu,
123124
wasm32-unknown-emscripten,
124125
x86_64-linux-android,

ci/docker/wasm32-wasip1/Dockerfile

+3-19
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
11
FROM ubuntu:24.04
22

3-
RUN apt-get update && \
4-
apt-get install -y --no-install-recommends \
5-
ca-certificates \
6-
curl \
7-
clang \
8-
xz-utils
9-
10-
# Wasmtime is used to execute tests and wasi-sdk is used to compile tests.
11-
# Download appropriate versions here and configure various flags below.
12-
ENV WASMTIME 24.0.0
13-
ENV WASI_SDK 24
14-
15-
RUN curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v$WASMTIME/wasmtime-v$WASMTIME-x86_64-linux.tar.xz | \
16-
tar xJf -
17-
ENV PATH=$PATH:/wasmtime-v$WASMTIME-x86_64-linux
18-
19-
RUN curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$WASI_SDK/wasi-sdk-$WASI_SDK.0-x86_64-linux.deb
20-
RUN dpkg -i ./wasi-sdk-*.deb
3+
COPY wasi.sh /
4+
RUN bash /wasi.sh
215

226
# Note that `-D_WASI_EMULATED_PROCESS_CLOCKS` is used to enable access to
237
# clock-related defines even though they're emulated. Also note that the usage
@@ -29,4 +13,4 @@ ENV CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime \
2913
CARGO_TARGET_WASM32_WASIP1_RUSTFLAGS="-lwasi-emulated-process-clocks -Ctarget-feature=-crt-static" \
3014
CC_wasm32_wasip1=/opt/wasi-sdk/bin/clang \
3115
CFLAGS_wasm32_wasip1=-D_WASI_EMULATED_PROCESS_CLOCKS \
32-
PATH=$PATH:/rust/bin
16+
PATH=$PATH:/rust/bin:/wasmtime

ci/docker/wasm32-wasip2/Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM ubuntu:24.04
2+
3+
COPY wasi.sh /
4+
RUN bash /wasi.sh
5+
6+
# Note that most of these are copied from `wasm32-wasip1/Dockerfile`
7+
#
8+
# FIXME: the `-Clink-arg` to export `cabi_realloc` is a bug in the target
9+
# itself, this should be fixed upstream.
10+
ENV CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime \
11+
CARGO_TARGET_WASM32_WASIP2_LINKER=/opt/wasi-sdk/bin/clang \
12+
CARGO_TARGET_WASM32_WASIP2_RUSTFLAGS="-lwasi-emulated-process-clocks -Ctarget-feature=-crt-static -Clink-arg=-Wl,--export,cabi_realloc" \
13+
CC_wasm32_wasip2=/opt/wasi-sdk/bin/clang \
14+
CFLAGS_wasm32_wasip2=-D_WASI_EMULATED_PROCESS_CLOCKS \
15+
PATH=$PATH:/rust/bin:/wasmtime

ci/wasi.sh

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
apt-get update
6+
apt-get install -y --no-install-recommends \
7+
ca-certificates \
8+
curl \
9+
clang \
10+
xz-utils
11+
12+
# Wasmtime is used to execute tests and wasi-sdk is used to compile tests.
13+
# Download appropriate versions here and configure various flags below.
14+
#
15+
# At the time of this writing wasmtime 24.0.0 is the latest release and
16+
# wasi-sdk-24 is the latest release, that these numbers match is just
17+
# coincidence.
18+
wasmtime=24.0.0
19+
wasi_sdk=24
20+
21+
curl -L https://github.com/bytecodealliance/wasmtime/releases/download/v$wasmtime/wasmtime-v$wasmtime-x86_64-linux.tar.xz | \
22+
tar xJf -
23+
mv wasmtime-v$wasmtime-x86_64-linux wasmtime
24+
25+
# The pre-built `*.deb` files for wasi-sdk install to `/opt/wasi-sdk`
26+
curl -LO https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-$wasi_sdk/wasi-sdk-$wasi_sdk.0-x86_64-linux.deb
27+
dpkg -i ./wasi-sdk-*.deb

0 commit comments

Comments
 (0)