Skip to content

Commit cec8c07

Browse files
committed
chore: ci for wasm
1 parent 3c79c5f commit cec8c07

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,3 +277,43 @@ jobs:
277277
- uses: actions/checkout@v5
278278
- run: pip install --user codespell[toml]
279279
- run: codespell --ignore-words-list=ans,atmost,crate,inout,ratatui,ser,stayin,swarmin,worl --skip=CHANGELOG.md
280+
281+
wasm_build:
282+
name: Build & test wasm32
283+
runs-on: ubuntu-latest
284+
env:
285+
RUSTFLAGS: '--cfg getrandom_backend="wasm_js"'
286+
steps:
287+
- name: Checkout sources
288+
uses: actions/checkout@v4
289+
290+
- name: Install Node.js
291+
uses: actions/setup-node@v4
292+
with:
293+
node-version: 20
294+
295+
- name: Install stable toolchain
296+
uses: dtolnay/rust-toolchain@stable
297+
298+
- name: Add wasm target
299+
run: rustup target add wasm32-unknown-unknown
300+
301+
- name: Install wasm-tools
302+
uses: bytecodealliance/actions/wasm-tools/setup@v1
303+
304+
- name: Install wasm-pack
305+
uses: taiki-e/install-action@v2
306+
with:
307+
tool: wasm-bindgen,wasm-pack
308+
309+
- name: wasm32 build
310+
run: cargo build --target wasm32-unknown-unknown
311+
312+
# If the Wasm file contains any 'import "env"' declarations, then
313+
# some non-Wasm-compatible code made it into the final code.
314+
- name: Ensure no 'import "env"' in wasm
315+
run: |
316+
! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/iroh_blobs.wasm | grep 'import "env"'
317+
318+
- name: wasm32 test
319+
run: wasm-pack test --node

0 commit comments

Comments
 (0)