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