-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest-ci-locally.sh
More file actions
executable file
·95 lines (79 loc) · 2.65 KB
/
Copy pathtest-ci-locally.sh
File metadata and controls
executable file
·95 lines (79 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# Local CI Testing Script - Run this before pushing to GitHub
# This script mimics the GitHub Actions CI pipeline
set -e # Exit on first error
echo "🧪 Running UEMCP Comprehensive CI Tests..."
echo "This includes unit, integration, and e2e tests"
echo "================================================"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Track overall status
FAILED=0
# Function to run a test section
run_test() {
local name=$1
local cmd=$2
echo -e "\n${YELLOW}Running: $name${NC}"
if eval "$cmd"; then
echo -e "${GREEN}✅ $name passed${NC}"
else
echo -e "${RED}❌ $name failed${NC}"
FAILED=1
fi
}
# TypeScript/Node.js Tests
echo -e "\n${YELLOW}=== TypeScript/Node.js Tests ===${NC}"
cd server
# Install dependencies if needed
if [ ! -d "node_modules" ]; then
echo "Installing Node.js dependencies..."
npm ci
fi
# Run all TypeScript checks
run_test "ESLint" "npm run lint"
run_test "TypeScript Type Check" "npm run typecheck"
# Check if real tests exist or just placeholder
if npm run test 2>&1 | grep -q "No tests configured"; then
echo -e "${YELLOW}ℹ️ No Jest tests configured yet${NC}"
else
run_test "Jest Tests" "npm run test:coverage"
fi
cd ..
# Python Tests for Plugin
echo -e "\n${YELLOW}=== Python Plugin Tests ===${NC}"
# Check if we have Python 3.11
PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2)
if [[ "$PYTHON_VERSION" != "3.11" ]]; then
echo -e "${YELLOW}Warning: Python $PYTHON_VERSION detected, UE 5.4+ uses 3.11${NC}"
fi
# Install Python dependencies if needed
if ! python3 -m pip show flake8 &>/dev/null; then
echo "Installing Python linting tools..."
pip install flake8 black ruff
fi
# Run comprehensive Python linting (includes formatting, ruff, and flake8)
run_test "Python Linting & Formatting" "./scripts/lint-python.sh"
# Comprehensive Test Suite (Unit + Integration + E2E)
echo -e "\n${YELLOW}=== Comprehensive Test Suite ===${NC}"
echo "Running unified test runner with all test levels..."
# Check if the comprehensive test runner is available
if [ -f "test-e2e.js" ]; then
echo "Using comprehensive test runner..."
run_test "Unit + Integration + E2E Tests" "COVERAGE=true node test-e2e.js"
else
echo -e "${YELLOW}ℹ️ Running legacy server tests only${NC}"
cd server
run_test "Server Tests" "npm test"
cd ..
fi
# Summary
echo -e "\n${YELLOW}=== Summary ===${NC}"
if [ $FAILED -eq 0 ]; then
echo -e "${GREEN}✅ All tests passed! Safe to push to GitHub.${NC}"
else
echo -e "${RED}❌ Some tests failed. Fix these before pushing.${NC}"
exit 1
fi