Skip to content

Commit c85d51a

Browse files
committed
Install wasm-bindgen for the CI wasm job
`make test-wasm` builds the viewer as well since the playground preview moved to WebCSG, so the job needs the wasm32-unknown-unknown target and a wasm-bindgen CLI matching Cargo.lock — the same steps the deploy workflow already carries.
1 parent 39e8adb commit c85d51a

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎.github/workflows/build.yml‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ jobs:
201201
- name: Install Rust toolchain
202202
uses: dtolnay/rust-toolchain@stable
203203
with:
204-
targets: wasm32-unknown-emscripten
204+
# The engine is built with Emscripten, the viewer with wasm-bindgen.
205+
targets: wasm32-unknown-emscripten, wasm32-unknown-unknown
205206

206207
- name: Install Emscripten
207208
uses: emscripten-core/setup-emsdk@v16
@@ -214,6 +215,21 @@ jobs:
214215
with:
215216
key: wasm32-unknown-emscripten
216217

218+
# The CLI has to be the exact version of the `wasm-bindgen` crate the
219+
# viewer is built against, so it is read off Cargo.lock rather than
220+
# written down a second time. `make wasm-viewer` refuses to run when the
221+
# two differ anyway.
222+
- name: Read the wasm-bindgen version
223+
run: |
224+
version=$(awk '/^name = "wasm-bindgen"$/ { found = 1 }
225+
found && /^version = / { gsub(/[",]/, ""); print $3; exit }' Cargo.lock)
226+
echo "WASM_BINDGEN_VERSION=$version" >> "$GITHUB_ENV"
227+
228+
- name: Install wasm-bindgen
229+
uses: taiki-e/install-action@v2
230+
with:
231+
tool: wasm-bindgen-cli@${{ env.WASM_BINDGEN_VERSION }}
232+
217233
- name: Build and smoke-test the wasm module
218234
run: make test-wasm
219235

0 commit comments

Comments
 (0)