Skip to content

Commit bbc4b47

Browse files
committed
run tests on wasm32-wasip2 on CI
1 parent ae82c35 commit bbc4b47

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

.github/workflows/main.yml

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
- build: msrv
2222
os: ubuntu-latest
2323
rust: nightly
24+
- build: wasm32
25+
os: ubuntu-latest
26+
rust: stable
2427
- build: macos
2528
os: macos-latest
2629
rust: stable
@@ -42,15 +45,25 @@ jobs:
4245
run: rustup update ${{ matrix.rust }} --no-self-update && rustup default ${{ matrix.rust }}
4346
shell: bash
4447
if: matrix.build != 'msrv'
45-
- name: Install Rust (rustup)
48+
- name: Install wasmtime
49+
run: |
50+
curl https://wasmtime.dev/install.sh -sSf | bash
51+
/home/runner/.wasmtime/bin/wasmtime --version
52+
if: matrix.build == 'wasm32'
53+
- name: Configure Toolchain (msrv)
4654
run: |
4755
# extract the MSRV from the Cargo.toml's `rust-version`
4856
MSRV=$(awk -F'"' '/rust-version/ {print $2}' Cargo.toml)
4957
TOOLCHAIN="${MSRV}-x86_64-unknown-linux-gnu"
5058
rustup update $TOOLCHAIN --no-self-update && rustup default $TOOLCHAIN
5159
shell: bash
5260
if: matrix.build == 'msrv'
53-
- name: Run cargo doc, deny warnings
61+
- name: Install target (wasm32)
62+
run: |
63+
rustup target add wasm32-wasip2
64+
shell: bash
65+
if: matrix.build == 'wasm32'
66+
- name: Run cargo doc, deny warnings (bzip2-sys)
5467
env:
5568
RUSTDOCFLAGS: "-D warnings"
5669
run: |
@@ -61,8 +74,16 @@ jobs:
6174
RUSTDOCFLAGS: "-Dwarnings"
6275
if: matrix.build != 'msrv'
6376
run: cargo doc -p bzip2 --no-deps --no-default-features --features libbz2-rs-sys
64-
- run: cargo test
65-
- run: cargo test --no-default-features --features libbz2-rs-sys
77+
- name: Configure wasm32 env vars
78+
run: |
79+
echo "CARGO_TARGET_WASM32_WASIP2_RUNNER=/home/runner/.wasmtime/bin/wasmtime" >> $GITHUB_ENV
80+
echo "CARGO_BUILD_TARGET=wasm32-wasip2" >> $GITHUB_ENV
81+
if: matrix.build == 'wasm32'
82+
- name: Run cargo test (bzip2-sys)
83+
run: cargo test
84+
if: matrix.build != 'wasm32'
85+
- name: Run cargo test (libbzip2-rs-sys)
86+
run: cargo test --no-default-features --features libbz2-rs-sys
6687
if: matrix.build != 'msrv'
6788

6889
rustfmt:

0 commit comments

Comments
 (0)