Deduplicate worker cap calculation — delegate to worker_cap_logic.gd #292
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: Test | |
| on: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| jobs: | |
| smoke-test: | |
| name: Headless smoke test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - uses: ./.github/actions/load-godot-toolchain | |
| id: godot-config | |
| - name: Download Godot | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p .tools | |
| curl -fsSL "${{ steps.godot-config.outputs.linux_url }}" -o /tmp/godot_linux.zip | |
| printf '%s %s\n' "${{ steps.godot-config.outputs.linux_sha256 }}" /tmp/godot_linux.zip | shasum -a 256 -c - | |
| unzip -oq /tmp/godot_linux.zip -d .tools/ | |
| chmod +x .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 | |
| - name: Verify Godot binary | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| chmod +x .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 | |
| ./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --version | |
| - name: Run headless smoke test | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| timeout 15 ./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --fixed-fps 60 --quit-after 300 > smoke.log 2>&1 | |
| if grep -E "SCRIPT ERROR|ERROR:" smoke.log; then | |
| echo "Smoke test logged an engine/script error" >&2 | |
| cat smoke.log >&2 | |
| exit 1 | |
| fi | |
| script-tests: | |
| name: Script test suite | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - uses: ./.github/actions/load-godot-toolchain | |
| id: godot-config | |
| - name: Download Godot | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p .tools | |
| curl -fsSL "${{ steps.godot-config.outputs.linux_url }}" -o /tmp/godot_linux.zip | |
| printf '%s %s\n' "${{ steps.godot-config.outputs.linux_sha256 }}" /tmp/godot_linux.zip | shasum -a 256 -c - | |
| unzip -oq /tmp/godot_linux.zip -d .tools/ | |
| chmod +x .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 | |
| - name: Run script tests | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --script res://tests/test_runner.gd > tests.log 2>&1 | |
| TEST_EXIT=$? | |
| cat tests.log | |
| # Print structured summary for CI | |
| if [ $TEST_EXIT -ne 0 ]; then | |
| echo "::error::Script tests failed (exit code $TEST_EXIT)" | |
| exit 1 | |
| fi | |
| PASS_COUNT=$(grep -c ": PASS" tests.log || true) | |
| FAIL_COUNT=$(grep -c ": FAIL" tests.log || true) | |
| echo "test_runner: $PASS_COUNT passed, $FAIL_COUNT failed" | |
| - name: Run E2E gameplay flow tests | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --script res://tests/test_e2e.gd > e2e-tests.log 2>&1 | |
| E2E_EXIT=$? | |
| cat e2e-tests.log | |
| if [ $E2E_EXIT -ne 0 ]; then | |
| echo "::error::E2E tests failed (exit code $E2E_EXIT)" | |
| exit 1 | |
| fi | |
| - name: Run layout regression tests | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --script res://tests/test_layout_math.gd > layout-tests.log 2>&1 | |
| LAYOUT_EXIT=$? | |
| cat layout-tests.log | |
| if [ $LAYOUT_EXIT -ne 0 ]; then | |
| echo "::error::Layout regression tests failed (exit code $LAYOUT_EXIT)" | |
| exit 1 | |
| fi | |
| - name: Run reservation tests (issue #143) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| ./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --script res://tests/test_reservations.gd > reservation-tests.log 2>&1 | |
| RES_EXIT=$? | |
| cat reservation-tests.log | |
| if [ $RES_EXIT -ne 0 ]; then | |
| echo "::error::Reservation tests failed (exit code $RES_EXIT)" | |
| exit 1 | |
| fi | |
| macos-validation: | |
| name: macOS validation | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - uses: ./.github/actions/load-godot-toolchain | |
| id: godot-config | |
| - name: Download Godot | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p .tools/macos | |
| curl -fsSL "${{ steps.godot-config.outputs.macos_url }}" -o /tmp/godot_macos.zip | |
| printf '%s %s\n' "${{ steps.godot-config.outputs.macos_sha256 }}" /tmp/godot_macos.zip | shasum -a 256 -c - | |
| unzip -oq /tmp/godot_macos.zip -d .tools/macos | |
| GODOT_MAC_APP=$(find .tools/macos -maxdepth 2 -name 'Godot.app' -print -quit) | |
| if [ -z "$GODOT_MAC_APP" ]; then | |
| echo "::error::Godot.app not found after unzip" | |
| find .tools/macos -maxdepth 3 -print | |
| exit 1 | |
| fi | |
| echo "GODOT_MAC_APP=$GODOT_MAC_APP" >> "$GITHUB_ENV" | |
| chmod +x "$GODOT_MAC_APP/Contents/MacOS/Godot" | |
| - name: Verify Godot binary | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| "$GODOT_MAC_APP/Contents/MacOS/Godot" --version | |
| - name: Run headless smoke test | |
| shell: bash | |
| continue-on-error: true | |
| run: | | |
| set -euo pipefail | |
| set +e | |
| python3 - "$GODOT_MAC_APP/Contents/MacOS/Godot" <<'PY' | |
| import subprocess | |
| import sys | |
| godot = sys.argv[1] | |
| with open("smoke.log", "w") as log: | |
| try: | |
| result = subprocess.run( | |
| [godot, "--headless", "--path", ".", "--fixed-fps", 60, "--quit-after", 300], | |
| stdout=log, | |
| stderr=subprocess.STDOUT, | |
| timeout=15, | |
| check=False, | |
| ) | |
| except subprocess.TimeoutExpired: | |
| print("Smoke test timed out after 15 seconds", file=sys.stderr) | |
| sys.exit(124) | |
| sys.exit(result.returncode) | |
| PY | |
| SMOKE_EXIT=$? | |
| set -e | |
| if [ -f smoke.log ]; then | |
| cat smoke.log | |
| fi | |
| if [ $SMOKE_EXIT -ne 0 ]; then | |
| echo "Smoke test exited with code $SMOKE_EXIT on macOS runner; keeping script tests as the hard validation gate for this job." >&2 | |
| fi | |
| - name: Run script tests | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| "$GODOT_MAC_APP/Contents/MacOS/Godot" --headless --path . --script res://tests/test_runner.gd > tests.log 2>&1 | |
| TEST_EXIT=$? | |
| cat tests.log | |
| if [ $TEST_EXIT -ne 0 ]; then | |
| echo "::error::Script tests failed (exit code $TEST_EXIT)" | |
| exit 1 | |
| fi | |
| PASS_COUNT=$(grep -c ": PASS" tests.log || true) | |
| FAIL_COUNT=$(grep -c ": FAIL" tests.log || true) | |
| echo "test_runner: $PASS_COUNT passed, $FAIL_COUNT failed" | |
| - name: Run E2E gameplay flow tests | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| "$GODOT_MAC_APP/Contents/MacOS/Godot" --headless --path . --script res://tests/test_e2e.gd > e2e-tests.log 2>&1 | |
| E2E_EXIT=$? | |
| cat e2e-tests.log | |
| if [ $E2E_EXIT -ne 0 ]; then | |
| echo "::error::E2E tests failed (exit code $E2E_EXIT)" | |
| exit 1 | |
| fi | |
| - name: Run layout regression tests | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| "$GODOT_MAC_APP/Contents/MacOS/Godot" --headless --path . --script res://tests/test_layout_math.gd > layout-tests.log 2>&1 | |
| LAYOUT_EXIT=$? | |
| cat layout-tests.log | |
| if [ $LAYOUT_EXIT -ne 0 ]; then | |
| echo "::error::Layout regression tests failed (exit code $LAYOUT_EXIT)" | |
| exit 1 | |
| fi | |
| export-validation: | |
| name: Export validation (Linux) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| - uses: ./.github/actions/load-godot-toolchain | |
| id: godot-config | |
| - name: Download Godot | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p .tools | |
| curl -fsSL "${{ steps.godot-config.outputs.linux_url }}" -o /tmp/godot_linux.zip | |
| printf '%s %s\n' "${{ steps.godot-config.outputs.linux_sha256 }}" /tmp/godot_linux.zip | shasum -a 256 -c - | |
| unzip -oq /tmp/godot_linux.zip -d .tools/ | |
| chmod +x .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 | |
| - name: Install export templates | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p ~/.local/share/godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }} | |
| curl -fsSL "${{ steps.godot-config.outputs.templates_url }}" -o /tmp/godot_export_templates.tpz | |
| printf '%s %s\n' "${{ steps.godot-config.outputs.templates_sha256 }}" /tmp/godot_export_templates.tpz | shasum -a 256 -c - | |
| unzip -oq /tmp/godot_export_templates.tpz -d /tmp/godot_export_templates | |
| cp -f /tmp/godot_export_templates/templates/* ~/.local/share/godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }}/ | |
| - name: Export Linux build | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p build/export-validation/linux | |
| .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --export-release "Linux/X11" ./build/export-validation/linux/windowstead.x86_64 | |
| - name: Verify export output | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| BINARY="build/export-validation/linux/windowstead.x86_64" | |
| PCK="build/export-validation/linux/windowstead.pck" | |
| if [ ! -s "$BINARY" ]; then | |
| echo "::error::Export binary not found or empty: $BINARY" | |
| exit 1 | |
| fi | |
| if [ ! -s "$PCK" ]; then | |
| echo "::error::Export PCK not found or empty: $PCK" | |
| exit 1 | |
| fi | |
| echo "Export validation passed — binary and PCK present" |