From 4c3e05bf4b33db2ae2c5bf597258633b1b24a2ec Mon Sep 17 00:00:00 2001 From: Erwan Or Date: Wed, 27 Mar 2024 13:20:29 -0400 Subject: [PATCH] ci: add wasm check --- .github/workflows/rust.yml | 7 ++++ deployments/scripts/check-wasm-compat.sh | 41 ++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100755 deployments/scripts/check-wasm-compat.sh diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9d1dff519f..b8077bb7d9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -9,18 +9,24 @@ jobs: - uses: actions/checkout@v4 with: lfs: true + - name: Install rust toolchain uses: dtolnay/rust-toolchain@stable + - name: Install nextest uses: taiki-e/install-action@nextest + - name: Load rust cache uses: astriaorg/buildjet-rust-cache@v2.5.1 + - name: Run cargo check, failing on warnings run: cargo check --release --all-targets env: # The `-D warnings` option causes an error on warnings; # we must duplicate the rustflags from `.cargo/config.toml`. RUSTFLAGS: "-D warnings --cfg tokio_unstable" + - name: Check wasm compatibility + run: ./deployments/scripts/check-wasm-compat.sh # If a dependency was modified, Cargo.lock may flap if not committed. - name: Check for diffs @@ -35,6 +41,7 @@ jobs: else echo "OK: no uncommitted changes detected" fi + - name: Run tests with nextest run: cargo nextest run --release --features migration env: diff --git a/deployments/scripts/check-wasm-compat.sh b/deployments/scripts/check-wasm-compat.sh new file mode 100755 index 0000000000..9b6b2cdaf7 --- /dev/null +++ b/deployments/scripts/check-wasm-compat.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -e + +packages=( + "penumbra-asset" + "penumbra-tct" + "penumbra-community-pool" + "penumbra-compact-block" + "penumbra-dex" + "penumbra-distributions" + "penumbra-fee" + "penumbra-funding" + "penumbra-governance" + "penumbra-ibc" + "penumbra-sct" + "penumbra-shielded-pool" + "penumbra-stake" + "penumbra-keys" + "penumbra-transaction" + "penumbra-txhash" + # Note: we can't include those ones because they rely on `getrandom` + # but there's a `js` feature... + # "penumbra-num" + # "penumbra-proto" + # "decaf377-fmd" + # "decaf377-frost" + # "decaf377-ka" + # "penumbra-proof-params" +) + +for package in "${packages[@]}"; do + echo "Building package: $package" + cargo check --release --target wasm32-unknown-unknown --package "$package" --no-default-features + if [ $? -ne 0 ]; then + echo "Compile error encountered while building package $package" + exit 1 + fi + echo "Package $package built successfully" + echo "------------------------" +done