Skip to content

Commit 78a69fe

Browse files
Frandob5
authored andcommitted
chore: add wasm ci
1 parent a5efddc commit 78a69fe

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/ci.yaml

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

0 commit comments

Comments
 (0)