Skip to content

Commit 9b5260c

Browse files
Web3NLclaude
andcommitted
chore: parallelize checks, frontend builds, and unit tests
- check.sh: run npm check, deps:check, and rust-lint-format.sh in parallel after npm ci + build (biggest win — Rust compilation no longer blocks JS checks) - validate-and-test-all.sh: build all 3 frontend assets in parallel - run-test.sh: run 4 JS vitest workspaces in parallel (acceptance tests remain sequential as they use PocketIC) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0841360 commit 9b5260c

3 files changed

Lines changed: 42 additions & 25 deletions

File tree

scripts/check.sh

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,32 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
echo "🔍 Running prerelease validation checks..."
4+
echo "Running prerelease validation checks..."
55

6-
echo "📦 Installing dependencies..."
6+
echo "Installing dependencies..."
77
npm ci
88

9-
echo "🏗️ Building all workspace packages..."
9+
echo "Building all workspace packages..."
1010
npm run build
1111

12-
echo "🔍 Running lint, format, and typecheck..."
13-
npm run check
12+
# Run JS checks, dependency checks, and Rust checks in parallel
13+
echo "Running checks in parallel (JS + deps + Rust)..."
1414

15-
echo "🔗 Checking dependency consistency and usage..."
16-
npm run deps:check
15+
npm run check &
16+
pid_js=$!
1717

18-
echo "Rust lint and format..."
19-
./scripts/rust-lint-format.sh
18+
npm run deps:check &
19+
pid_deps=$!
2020

21-
echo "Validation checks complete!"
21+
./scripts/rust-lint-format.sh &
22+
pid_rust=$!
23+
24+
# Wait for each — set -e will exit on first failure
25+
wait $pid_js
26+
echo "JS checks passed"
27+
wait $pid_deps
28+
echo "Dependency checks passed"
29+
wait $pid_rust
30+
echo "Rust checks passed"
31+
32+
echo "Validation checks complete!"

scripts/run-test.sh

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
echo "Unit testing my-canister-dashboard"
5-
npm run test --workspace=@web3nl/my-canister-dashboard
6-
7-
echo "Unit testing vite-plugin-canister-dapp"
8-
npm run test --workspace=@web3nl/vite-plugin-canister-dapp
9-
10-
echo "Unit testing canister-dashboard-frontend"
11-
npm run test --workspace=canister-dashboard-frontend
12-
13-
echo "Unit testing my-canister-app"
14-
npm run test --workspace=my-canister-app
4+
# Run JS unit tests in parallel
5+
echo "Running JS unit tests in parallel..."
6+
npm run test --workspace=@web3nl/my-canister-dashboard &
7+
pid1=$!
8+
npm run test --workspace=@web3nl/vite-plugin-canister-dapp &
9+
pid2=$!
10+
npm run test --workspace=canister-dashboard-frontend &
11+
pid3=$!
12+
npm run test --workspace=my-canister-app &
13+
pid4=$!
14+
wait $pid1 $pid2 $pid3 $pid4
15+
echo "JS unit tests passed"
1516

17+
# Acceptance tests run sequentially (each uses PocketIC)
1618
echo "Acceptance testing my-hello-world"
1719
cargo run -p canister-dapp-test -- wasm/my-hello-world.wasm.gz
1820

validate-and-test-all.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@ set -a
6565
source tests/test.env
6666
set +a
6767

68-
# --- Phase 1: Build all frontend assets for Rust canister embedding ---
68+
# --- Phase 1: Build all frontend assets in parallel ---
6969
echo "Building frontend assets..."
70-
./scripts/prebuild-mcd.sh
71-
npm run build --workspace=my-hello-world-frontend
72-
npm run build --workspace=my-notepad-frontend
70+
./scripts/prebuild-mcd.sh &
71+
pid_mcd=$!
72+
npm run build --workspace=my-hello-world-frontend &
73+
pid_hw=$!
74+
npm run build --workspace=my-notepad-frontend &
75+
pid_np=$!
76+
wait $pid_mcd $pid_hw $pid_np
7377

7478
# --- Phase 2: Batch-build all Rust canister wasms ---
7579
echo "Batch-building all canister wasms..."

0 commit comments

Comments
 (0)