Update build and test scripts to handle all three crates (core, client, ui)

This commit is contained in:
Timur Gordon
2025-11-06 23:40:09 +01:00
parent a65c721c64
commit bbced35996
6 changed files with 108 additions and 714 deletions

747
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,12 @@
[workspace]
members = ["core", "client", "ui"]
members = ["core", "client"]
exclude = ["ui"]
resolver = "2"
[workspace.package]
version = "0.1.0"
edition = "2021"
# Note: The UI crate is excluded from the workspace because it targets wasm32-unknown-unknown
# and requires WASM-specific features. Build it separately with: cd ui && trunk build

View File

@@ -4,8 +4,34 @@ set -e
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
PROJECT_DIR=$(cd "$SCRIPT_DIR/.." && pwd)
echo "Building Hero Supervisor..."
cd "$PROJECT_DIR"
RUSTFLAGS="-A warnings" cargo build --release
echo "========================================="
echo "Building Hero Supervisor Workspace"
echo "========================================="
echo "✅ Hero Supervisor built successfully"
# Build core and client (workspace members)
echo ""
echo "📦 Building core and client..."
cd "$PROJECT_DIR"
RUSTFLAGS="-A warnings" cargo build --release --workspace
echo ""
echo "✅ Core and client built successfully"
# Build UI (WASM target)
echo ""
echo "📦 Building UI (WASM)..."
cd "$PROJECT_DIR/ui"
# Check if trunk is installed
if ! command -v trunk &> /dev/null; then
echo "⚠️ Warning: trunk not found. Skipping UI build."
echo " Install trunk with: cargo install trunk"
else
trunk build --release
echo "✅ UI built successfully"
fi
echo ""
echo "========================================="
echo "✅ All builds completed successfully"
echo "========================================="

View File

@@ -1,8 +1,37 @@
#!/bin/bash
# serve.sh - Build optimized WASM and serve with Caddy + Brotli compression
set -e
SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
PROJECT_DIR=$(cd "$SCRIPT_DIR/.." && pwd)
cargo check
cargo test
echo "========================================="
echo "Testing Hero Supervisor Workspace"
echo "========================================="
# Test core and client (workspace members)
echo ""
echo "🧪 Testing core and client..."
cd "$PROJECT_DIR"
cargo test --workspace
echo ""
echo "✅ Core and client tests passed"
# Test UI (WASM target)
echo ""
echo "🧪 Testing UI (WASM)..."
cd "$PROJECT_DIR/ui"
# Check if wasm-pack is installed for WASM testing
if ! command -v wasm-pack &> /dev/null; then
echo "⚠️ Warning: wasm-pack not found. Skipping UI tests."
echo " Install wasm-pack with: cargo install wasm-pack"
else
wasm-pack test --headless --firefox
echo "✅ UI tests passed"
fi
echo ""
echo "========================================="
echo "✅ All tests completed successfully"
echo "========================================="