Luigi's picture
deploy(web): full clean snapshot with app code and assets
12d64f8
#!/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 ""