Skip to content

Commit c117d77

Browse files
committed
ci: add wasm compile checks and guard selector window retrieval
1 parent 1dc0c9f commit c117d77

4 files changed

Lines changed: 30 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,22 @@ jobs:
8282
components: rustfmt
8383
- name: Run cargo fmt
8484
run: cargo fmt --all -- --check
85+
86+
# Run wasm compile checks to catch web-only type mismatches.
87+
wasm_check:
88+
name: Wasm Compile
89+
runs-on: ubuntu-latest
90+
timeout-minutes: 30
91+
steps:
92+
- name: Checkout sources
93+
uses: actions/checkout@v4
94+
with:
95+
submodules: recursive
96+
- name: Install stable toolchain
97+
uses: dtolnay/rust-toolchain@stable
98+
- name: Check wasm target
99+
run: rustup target add wasm32-unknown-unknown
100+
- name: Run wasm compile checks
101+
run: |
102+
cargo check -p vizmat-core --target wasm32-unknown-unknown --no-default-features
103+
cargo check -p vizmat-app --target wasm32-unknown-unknown --no-default-features

.github/workflows/deploy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ jobs:
3030
run: |
3131
curl https://drager.github.io/wasm-pack/installer/init.sh -sSf | bash
3232
33+
- name: Run wasm compile checks
34+
run: |
35+
cargo check -p vizmat-core --target wasm32-unknown-unknown --no-default-features
36+
cargo check -p vizmat-app --target wasm32-unknown-unknown --no-default-features
37+
3338
- name: Build WASM
3439
run: |
3540
if [ "${{ github.ref }}" = "refs/heads/main" ]; then

justfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ watch:
6161
bench:
6262
cargo bench -p vizmat-core --bench bond_cache
6363

64+
wasm-check:
65+
rustup target add wasm32-unknown-unknown
66+
cargo check -p vizmat-core --target wasm32-unknown-unknown --no-default-features
67+
cargo check -p vizmat-app --target wasm32-unknown-unknown --no-default-features
68+
6469
wasm:
6570
rustup target add wasm32-unknown-unknown --toolchain nightly-aarch64-apple-darwin
6671
cd vizmat-app && PATH="$HOME/.cargo/bin:$PATH" NO_COLOR=false trunk serve --port 8082

vizmat-core/src/ui/picker.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ pub(crate) fn set_structure_picker_keyboard_active(visible: bool) {
9797
}
9898

9999
#[cfg(target_arch = "wasm32")]
100-
let Some(window) = window() else {
101-
return;
102-
};
100+
let window = window();
103101

104102
#[cfg(target_arch = "wasm32")]
105103
let event_name = if visible {

0 commit comments

Comments
 (0)