Skip to content

Commit dfd62c8

Browse files
committed
chore(ci): add wasm compilation check
1 parent 78a69fe commit dfd62c8

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

.github/workflows/ci.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,33 @@ jobs:
6969
env:
7070
RUST_LOG: ${{ runner.debug && 'TRACE' || 'DEBUG'}}
7171

72+
wasm_build:
73+
name: Build wasm32
74+
runs-on: ubuntu-latest
75+
env:
76+
RUSTFLAGS: '--cfg getrandom_backend="wasm_js"'
77+
steps:
78+
- name: Checkout sources
79+
uses: actions/checkout@v5
80+
81+
- name: Install stable toolchain
82+
uses: dtolnay/rust-toolchain@stable
83+
84+
- name: Add wasm target
85+
run: rustup target add wasm32-unknown-unknown
86+
87+
- name: Install wasm-tools
88+
uses: bytecodealliance/actions/wasm-tools/setup@v1
89+
90+
- name: wasm32 build
91+
run: cargo build --target wasm32-unknown-unknown
92+
93+
# If the Wasm file contains any 'import "env"' declarations, then
94+
# some non-Wasm-compatible code made it into the final code.
95+
- name: Ensure no 'import "env"' in Wasm
96+
run: |
97+
! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/rcan.wasm | grep 'import "env"'
98+
7299
android_build:
73100
name: Android Build Only
74101
if: "github.event_name != 'pull_request' || ! contains(github.event.pull_request.labels.*.name, 'flaky-test')"
@@ -315,4 +342,4 @@ jobs:
315342
# some non-Wasm-compatible code made it into the final code.
316343
- name: Ensure no 'import "env"' in wasm
317344
run: |
318-
! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/iroh_docs.wasm | grep 'import "env"'
345+
! wasm-tools print --skeleton target/wasm32-unknown-unknown/debug/iroh_docs.wasm | grep 'import "env"'

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ futures-util = { version = "0.3.25" }
3333
hex = "0.4"
3434
iroh = { version = "0.94", default-features = false }
3535
iroh-tickets = { version = "0.1"}
36-
iroh-blobs = { git = "https://github.com/n0-computer/iroh-blobs", branch = "Frando/wasm-nopatch", default-features = false }
36+
iroh-blobs = { version = "0.97" default-features = false }
3737
iroh-gossip = { version = "0.94", features = ["net"], default-features = false }
3838
iroh-metrics = { version = "0.36", default-features = false }
39-
irpc = { git = "https://github.com/n0-computer/irpc", branch = "main", default-features = false }
40-
n0-future = { version = "0.3", features = ["serde"], git = "https://github.com/n0-computer/n0-future", branch = "Frando/time-serde" }
39+
irpc = { version = "0.11", default-features = false }
40+
n0-future = { version = "0.3", features = ["serde"], git = "https://github.com/n0-computer/n0-future", branch = "main" }
4141
num_enum = "0.7"
4242
postcard = { version = "1", default-features = false, features = [
4343
"alloc",

0 commit comments

Comments
 (0)