File size: 1,908 Bytes
12d64f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
96
#!/bin/bash

echo "๐Ÿงช Testing RTS Game Web Application"
echo "===================================="
echo ""

# Check if Python is installed
if ! command -v python3 &> /dev/null; then
    echo "โŒ Python 3 is not installed"
    exit 1
fi
echo "โœ… Python 3 is installed"

# Check if pip is installed
if ! command -v pip3 &> /dev/null; then
    echo "โŒ pip3 is not installed"
    exit 1
fi
echo "โœ… pip3 is installed"

# Install requirements
echo ""
echo "๐Ÿ“ฆ Installing dependencies..."
pip3 install -r requirements.txt -q

if [ $? -eq 0 ]; then
    echo "โœ… Dependencies installed successfully"
else
    echo "โŒ Failed to install dependencies"
    exit 1
fi

# Check if static files exist
echo ""
echo "๐Ÿ“‚ Checking static files..."
if [ -f "static/index.html" ]; then
    echo "โœ… index.html exists"
else
    echo "โŒ index.html not found"
    exit 1
fi

if [ -f "static/styles.css" ]; then
    echo "โœ… styles.css exists"
else
    echo "โŒ styles.css not found"
    exit 1
fi

if [ -f "static/game.js" ]; then
    echo "โœ… game.js exists"
else
    echo "โŒ game.js not found"
    exit 1
fi

# Test Python imports
echo ""
echo "๐Ÿ Testing Python imports..."
python3 -c "
try:
    from fastapi import FastAPI
    from fastapi.websockets import WebSocket
    import uvicorn
    print('โœ… All Python imports successful')
except ImportError as e:
    print(f'โŒ Import error: {e}')
    exit(1)
"

if [ $? -ne 0 ]; then
    exit 1
fi

# Test app.py syntax
echo ""
echo "๐Ÿ” Checking app.py syntax..."
python3 -m py_compile app.py

if [ $? -eq 0 ]; then
    echo "โœ… app.py syntax is valid"
else
    echo "โŒ app.py has syntax errors"
    exit 1
fi

echo ""
echo "๐ŸŽ‰ All tests passed!"
echo ""
echo "๐Ÿš€ To start the server, run:"
echo "   uvicorn app:app --host 0.0.0.0 --port 7860 --reload"
echo ""
echo "๐Ÿณ To build Docker image, run:"
echo "   docker build -t rts-game ."
echo ""