Reorganize codebase into src/rsp package structure #128
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-timeout pytest-xdist | |
| - name: Verify environment | |
| run: | | |
| python -c "import sys; print(f'Python: {sys.version}')" | |
| python -c "import pygame; print(f'pygame: {pygame.version.ver}')" | |
| python -c "import tcod; print(f'tcod: {tcod.__version__}')" | |
| - name: Run tests | |
| env: | |
| SDL_VIDEODRIVER: dummy | |
| SDL_AUDIODRIVER: dummy | |
| run: python -m pytest tests/ --no-cov --timeout=60 -x --tb=short | |
| test-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev xvfb | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-timeout pytest-xdist | |
| - name: Verify environment | |
| run: | | |
| python -c "import sys; print(f'Python: {sys.version}')" | |
| python -c "import pygame; print(f'pygame: {pygame.version.ver}')" | |
| python -c "import tcod; print(f'tcod: {tcod.__version__}')" | |
| - name: Run tests | |
| env: | |
| SDL_VIDEODRIVER: dummy | |
| SDL_AUDIODRIVER: dummy | |
| run: xvfb-run -a python -m pytest tests/ --no-cov --timeout=60 -x --tb=short | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| needs: test-linux | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| - name: Verify required files | |
| run: | | |
| missing="" | |
| [ ! -f "RogueSignalProtocol.py" ] && missing="$missing RogueSignalProtocol.py" | |
| [ ! -f "requirements.txt" ] && missing="$missing requirements.txt" | |
| [ ! -f "game_content.json" ] && missing="$missing game_content.json" | |
| [ ! -f "game_rules.json" ] && missing="$missing game_rules.json" | |
| [ ! -f "graphics_tiles.json" ] && missing="$missing graphics_tiles.json" | |
| [ ! -f "narrative_content.json" ] && missing="$missing narrative_content.json" | |
| [ ! -f "default_bindings.json" ] && missing="$missing default_bindings.json" | |
| [ ! -f "KreativeSquare.ttf" ] && missing="$missing KreativeSquare.ttf" | |
| [ ! -d "graphics" ] && missing="$missing graphics/" | |
| [ ! -d "sound" ] && missing="$missing sound/" | |
| [ ! -d "music" ] && missing="$missing music/" | |
| if [ -n "$missing" ]; then | |
| echo "Missing required files:$missing" | |
| exit 1 | |
| fi | |
| echo "All required files found." | |
| - name: Build executable with PyInstaller | |
| run: | | |
| pyinstaller RogueSignalProtocol-linux.spec | |
| # Create debug_mode.flag for alpha builds | |
| echo "This file enables DEBUG logging for playtester bug reports." > dist/debug_mode.flag | |
| - name: Verify executable was created | |
| run: | | |
| if [ ! -f "dist/RogueSignalProtocol" ]; then | |
| echo "Build failed - executable not found!" | |
| exit 1 | |
| fi | |
| chmod +x dist/RogueSignalProtocol | |
| echo "Executable created successfully." | |
| - name: Copy assets to dist | |
| run: | | |
| # Copy JSON config files | |
| echo "Copying JSON config files..." | |
| cp game_content.json dist/ | |
| cp game_rules.json dist/ | |
| cp graphics_tiles.json dist/ | |
| cp narrative_content.json dist/ | |
| cp default_bindings.json dist/ | |
| # Copy font file | |
| echo "Copying font file..." | |
| cp KreativeSquare.ttf dist/ | |
| # Copy LICENSE if it exists | |
| if [ -f "LICENSE" ]; then | |
| echo "Copying LICENSE..." | |
| cp LICENSE dist/ | |
| fi | |
| # Copy README | |
| echo "Copying distribution README..." | |
| cp README.txt dist/README.txt | |
| # Create build info | |
| echo "Creating build info..." | |
| echo "Build Type: Alpha (GitHub Actions - Linux)" > dist/build_info.txt | |
| echo "Log Level: DEBUG" >> dist/build_info.txt | |
| echo "Build Date: $(date '+%Y-%m-%d %H:%M:%S')" >> dist/build_info.txt | |
| # Copy asset folders | |
| echo "Copying graphics folder..." | |
| cp -r graphics dist/ | |
| echo "Copying sound folder..." | |
| cp -r sound dist/ | |
| echo "Copying music folder..." | |
| cp -r music dist/ | |
| # Copy logo for Linux desktop integration | |
| echo "Copying logo..." | |
| cp logo.png dist/ | |
| echo "All assets copied successfully." | |
| - name: Test binary starts without crash | |
| run: | | |
| # Run binary with timeout - it should start and we can verify it doesn't immediately crash | |
| # Use timeout to kill after 5 seconds since the game is interactive | |
| cd dist | |
| timeout 5 ./RogueSignalProtocol --version 2>&1 || true | |
| # If the binary at least started (exit code from timeout is 124 for timeout, not crash) | |
| echo "Binary smoke test passed - no immediate crash." | |
| - name: Upload Linux build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: RogueSignalProtocol-Linux | |
| path: dist/ | |
| retention-days: 7 |