#!/usr/bin/env bash set -euo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" cd "$ROOT" RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' pass_count=0 fail_count=0 start_time=$(date +%s) step() { local label="$1" shift echo -e "${YELLOW}[CI]${NC} ${label}..." if "$@" > /tmp/ci-output-$$.log 2>&1; then echo -e " ${GREEN}PASS${NC}" pass_count=$((pass_count + 1)) else echo -e " ${RED}FAIL${NC}" tail -30 /tmp/ci-output-$$.log fail_count=$((fail_count + 1)) fi } echo "============================================================" echo " Imhotep CI Verification" echo "============================================================" echo "" # 1. Build all packages step "Build" npm run build # 2. Typecheck step "Typecheck" npm run typecheck # 3. Lint step "Lint" npm run lint # 4. Structural conformance (as any, empty catch, ?? 0 baselines) step "Structural conformance" node scripts/check-structural.js # 5. Unit tests (DSL, core, solver, playwright) step "Core tests (DSL)" npm test --workspace=imhotep-dsl --if-present step "Core tests (core)" npm test --workspace=imhotep-core --if-present step "Core tests (solver)" npm test --workspace=imhotep-solver --if-present step "Core tests (extractor)" npm test --workspace=imhotep-extractor --if-present step "Core tests (geometry)" npm test --workspace=imhotep-geometry --if-present # 6. E2E tests (requires browser) echo -e "${YELLOW}[CI]${NC} E2E hard tests..." if npx playwright test --config packages/imhotep-fixtures/playwright.config.ts --grep="hard test" --workers=1 > /tmp/ci-output-$$.log 2>&1; then echo -e " ${GREEN}PASS${NC}" pass_count=$((pass_count + 1)) else echo -e " ${RED}FAIL${NC}" tail -30 /tmp/ci-output-$$.log fail_count=$((fail_count + 1)) fi # Summary end_time=$(date +%s) elapsed=$((end_time - start_time)) echo "" echo "============================================================" echo " CI Summary" echo "============================================================" echo " Passed: ${GREEN}${pass_count}${NC}" echo " Failed: ${RED}${fail_count}${NC}" echo " Elapsed: ${elapsed}s" echo "" if [ "$fail_count" -gt 0 ]; then echo -e "${RED}CI verification FAILED${NC}" exit 1 else echo -e "${GREEN}CI verification PASSED${NC}" exit 0 fi