#!/usr/bin/env bash # # Run all Archipelago tests: frontend (local) + backend (dev server via SSH). # Exit 0 only if both pass. # set -euo pipefail SSH_KEY="${ARCHIPELAGO_SSH_KEY:-$HOME/.ssh/archipelago-deploy}" SSH_HOST="${ARCHIPELAGO_SSH_HOST:-archipelago@192.168.1.228}" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" PROJECT_DIR="$(dirname "$SCRIPT_DIR")" FRONTEND_OK=0 BACKEND_OK=0 echo "=========================================" echo " Archipelago Test Runner" echo "=========================================" echo "" # --- Frontend Tests --- echo "--- Frontend Tests (local) ---" if (cd "$PROJECT_DIR/neode-ui" && npm test 2>&1); then echo "✅ Frontend tests PASSED" FRONTEND_OK=1 else echo "❌ Frontend tests FAILED" fi echo "" # --- Backend Tests (on dev server) --- echo "--- Backend Tests (dev server) ---" # Sync source to server echo "Syncing source to dev server..." rsync -az --exclude 'target' --exclude 'node_modules' --exclude '.git' \ -e "ssh -i $SSH_KEY" \ "$PROJECT_DIR/core/" "$SSH_HOST:~/archy/core/" 2>&1 # Run tests on server if ssh -i "$SSH_KEY" "$SSH_HOST" \ "source ~/.cargo/env && cd ~/archy/core && cargo test -p archipelago 2>&1"; then echo "✅ Backend unit tests PASSED" BACKEND_OK=1 else echo "❌ Backend unit tests FAILED" fi echo "" # --- Integration Tests --- echo "--- Integration Tests (dev server) ---" if ssh -i "$SSH_KEY" "$SSH_HOST" \ "source ~/.cargo/env && cd ~/archy/core && cargo test --test rpc_integration 2>&1"; then echo "✅ Integration tests PASSED" else echo "❌ Integration tests FAILED" BACKEND_OK=0 fi echo "" echo "=========================================" echo " Results" echo "=========================================" if [ "$FRONTEND_OK" -eq 1 ]; then echo " Frontend: ✅ PASS" else echo " Frontend: ❌ FAIL" fi if [ "$BACKEND_OK" -eq 1 ]; then echo " Backend: ✅ PASS" else echo " Backend: ❌ FAIL" fi echo "=========================================" if [ "$FRONTEND_OK" -eq 1 ] && [ "$BACKEND_OK" -eq 1 ]; then echo "All tests passed!" exit 0 else echo "Some tests failed." exit 1 fi