From 2df7cca15c01adda8a396a5fd3ff85404ff90ac1 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Fri, 17 Mar 2023 10:21:41 +0100 Subject: [PATCH] CI Replace wasm_bindgen_check.sh with actually building the web-viewer --- .github/workflows/rust.yml | 6 ++++- scripts/check.sh | 2 +- scripts/wasm_bindgen_check.sh | 45 ----------------------------------- 3 files changed, 6 insertions(+), 47 deletions(-) delete mode 100755 scripts/wasm_bindgen_check.sh diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1f375d176aa8..abace0370275 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -226,7 +226,11 @@ jobs: command: check args: --locked --target wasm32-unknown-unknown --target-dir target_wasm -p re_renderer --examples - - run: ./scripts/wasm_bindgen_check.sh --skip-setup + - name: Build web-viewer (debug) + uses: actions-rs/cargo@v1 + with: + command: run + args: --locked -p re_build_web_viewer -- --debug # --------------------------------------------------------------------------- diff --git a/scripts/check.sh b/scripts/check.sh index 80c62d0a3a0e..ce40cce9d4ca 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -36,7 +36,7 @@ cargo doc --document-private-items --no-deps --all-features (cd crates/rerun && cargo check --all-features) (cd examples/rust/objectron && cargo check --all-features) -./scripts/wasm_bindgen_check.sh +cargo run -p re_build_web_viewer -- --debug ./scripts/lint.py diff --git a/scripts/wasm_bindgen_check.sh b/scripts/wasm_bindgen_check.sh deleted file mode 100755 index 6b7e6258a97e..000000000000 --- a/scripts/wasm_bindgen_check.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -set -eu -script_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) -cd "$script_path/.." - -if [[ $* == --skip-setup ]] -then - echo "Skipping setup_web.sh" -else - echo "Running setup_web.sh" - scripts/setup_web.sh -fi - -CRATE_NAME="re_viewer" - -# This is required to enable the web_sys clipboard API which egui_web uses -# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html -# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html -export RUSTFLAGS=--cfg=web_sys_unstable_apis - -echo "Building rust…" -BUILD=debug # debug builds are faster -TARGET_DIR="target_wasm" -WASM_TARGET_FILEPATH="${TARGET_DIR}/wasm32-unknown-unknown/${BUILD}/${CRATE_NAME}.wasm" - -# make sure we re-build it: -rm -f "${WASM_TARGET_FILEPATH}" - -cargo build \ - --package "${CRATE_NAME}" \ - --lib \ - --target wasm32-unknown-unknown \ - --target-dir "${TARGET_DIR}" - -echo "Generating JS bindings for wasm…" - -# Remove old output (if any): -rm -f "${CRATE_NAME}.js" -rm -f "${CRATE_NAME}_bg.wasm" - -wasm-bindgen "${WASM_TARGET_FILEPATH}" --out-dir . --no-modules --no-typescript - -# Remove output: -rm -f "${CRATE_NAME}_bg.wasm" -rm -f "${CRATE_NAME}.js"