diff --git a/script/test b/script/test index c8920f03..4df7523c 100755 --- a/script/test +++ b/script/test @@ -11,10 +11,12 @@ export GIT_CONFIG_VALUE_0=master SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" -# Ordered fail-fast: cheapest deterministic checks first, slowest builds and -# test suites last. `set -euo pipefail` aborts at the first failure, so a fmt -# or clippy drift never wastes time on a frontend build or a multi-minute -# test run. +# Ordered fail-fast: cheapest deterministic checks first. The frontend build +# must run *before* anything that compiles Rust, because story 1113 introduced +# a compile-time dependency on `frontend/dist/` via `rust-embed` — a fresh +# merge worktree without that directory will fail `cargo clippy` on +# `EmbeddedAssets::iter()` before the frontend build has a chance to populate +# it. `set -euo pipefail` aborts at the first failure. echo "=== Checking Rust formatting ===" if cargo fmt --version &>/dev/null; then @@ -44,12 +46,6 @@ if [ "$_dup_found" -eq 1 ]; then exit 1 fi -echo "=== Running cargo clippy ===" -cargo clippy --manifest-path "$PROJECT_ROOT/Cargo.toml" --all-targets --all-features -- -D warnings - -echo "=== Checking doc coverage on changed files ===" -cargo run --manifest-path "$PROJECT_ROOT/Cargo.toml" -p source-map-gen --bin source-map-check --quiet -- --worktree "$PROJECT_ROOT" --base master - echo "=== Building frontend ===" if [ -d "$PROJECT_ROOT/frontend" ]; then cd "$PROJECT_ROOT/frontend" @@ -75,6 +71,12 @@ else echo "Skipping frontend build (no frontend directory)" fi +echo "=== Running cargo clippy ===" +cargo clippy --manifest-path "$PROJECT_ROOT/Cargo.toml" --all-targets --all-features -- -D warnings + +echo "=== Checking doc coverage on changed files ===" +cargo run --manifest-path "$PROJECT_ROOT/Cargo.toml" -p source-map-gen --bin source-map-check --quiet -- --worktree "$PROJECT_ROOT" --base master + echo "=== Running Rust tests ===" cargo test --manifest-path "$PROJECT_ROOT/Cargo.toml" --bin huskies cargo test --manifest-path "$PROJECT_ROOT/Cargo.toml" -p source-map-gen