|
| 1 | +name: CI API |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - master |
| 8 | + paths: |
| 9 | + - "src/api/**" |
| 10 | + - "src/inference/**" |
| 11 | + - "src/game/**" |
| 12 | + - "src/data/**" |
| 13 | + - "tests/test_api_*.py" |
| 14 | + - "tests/test_inference_service.py" |
| 15 | + - "scripts/**" |
| 16 | + - "alembic/**" |
| 17 | + - "alembic.ini" |
| 18 | + - "Dockerfile" |
| 19 | + - "pyproject.toml" |
| 20 | + - "uv.lock" |
| 21 | + - "pyrefly.toml" |
| 22 | + - ".github/workflows/ci-api.yml" |
| 23 | + pull_request: |
| 24 | + paths: |
| 25 | + - "src/api/**" |
| 26 | + - "src/inference/**" |
| 27 | + - "src/game/**" |
| 28 | + - "src/data/**" |
| 29 | + - "tests/test_api_*.py" |
| 30 | + - "tests/test_inference_service.py" |
| 31 | + - "scripts/**" |
| 32 | + - "alembic/**" |
| 33 | + - "alembic.ini" |
| 34 | + - "Dockerfile" |
| 35 | + - "pyproject.toml" |
| 36 | + - "uv.lock" |
| 37 | + - "pyrefly.toml" |
| 38 | + - ".github/workflows/ci-api.yml" |
| 39 | + workflow_dispatch: |
| 40 | + |
| 41 | +concurrency: |
| 42 | + group: ci-api-${{ github.ref }} |
| 43 | + cancel-in-progress: true |
| 44 | + |
| 45 | +jobs: |
| 46 | + api-quality: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + timeout-minutes: 45 |
| 49 | + env: |
| 50 | + PYTHONUNBUFFERED: "1" |
| 51 | + |
| 52 | + steps: |
| 53 | + - name: Checkout |
| 54 | + uses: actions/checkout@v4 |
| 55 | + |
| 56 | + - name: Setup Python |
| 57 | + uses: actions/setup-python@v5 |
| 58 | + with: |
| 59 | + python-version: "3.10" |
| 60 | + |
| 61 | + - name: Setup uv |
| 62 | + uses: astral-sh/setup-uv@v4 |
| 63 | + with: |
| 64 | + enable-cache: true |
| 65 | + |
| 66 | + - name: Sync dependencies (api + dev + train + export) |
| 67 | + run: uv sync --frozen --group api --group dev --group train --group export |
| 68 | + |
| 69 | + - name: Compatibility shim for pyrefly interpreter path |
| 70 | + run: | |
| 71 | + mkdir -p .venv/Scripts |
| 72 | + ln -sf ../bin/python .venv/Scripts/python.exe |
| 73 | +
|
| 74 | + - name: Python file length policy |
| 75 | + run: uv run python scripts/check_python_max_lines.py --max-lines 500 --path src --path tests --path scripts --path train.py |
| 76 | + |
| 77 | + - name: Ruff (API scope) |
| 78 | + run: uv run ruff check src tests scripts |
| 79 | + |
| 80 | + - name: Pyrefly (API scope) |
| 81 | + run: uv run pyrefly check src tests |
| 82 | + |
| 83 | + - name: Pytest (API scope) |
| 84 | + run: uv run pytest -q tests/test_api_* tests/test_inference_service.py |
| 85 | + |
| 86 | + - name: Alembic heads (single head) |
| 87 | + run: | |
| 88 | + HEADS_COUNT="$(uv run alembic heads | wc -l)" |
| 89 | + echo "Heads: ${HEADS_COUNT}" |
| 90 | + test "${HEADS_COUNT}" -eq 1 |
| 91 | +
|
| 92 | + - name: Alembic SQL render sanity check |
| 93 | + run: uv run alembic upgrade head --sql > /tmp/alembic_upgrade.sql |
| 94 | + |
| 95 | + - name: Docker build (production image sanity check) |
| 96 | + run: docker build -t ataxx-zero:ci . |
0 commit comments