Spaces:
Sleeping
Sleeping
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 ""
|