Skip to content

Commit d23661c

Browse files
committed
add workflows
1 parent ab63a36 commit d23661c

90 files changed

Lines changed: 7243 additions & 1533 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/skills/ataxx-python-engineering/SKILL.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ Do not finish with failing lint/type/tests.
4848
- `src/ui`: pygame client
4949
- `src/api`: backend service
5050

51+
## Educational Commenting Policy
52+
53+
This repository is educational, so comments must teach intent, not restate syntax.
54+
55+
- Add minimal, high-signal comments in non-trivial code paths.
56+
- Prefer short comments that answer:
57+
- why this logic exists,
58+
- what invariant/assumption must hold,
59+
- what failure mode is being prevented.
60+
- Do not add noise comments for obvious lines (e.g., "assign variable", "loop over list").
61+
- Favor one good comment before a dense block over many inline comments.
62+
- Keep comments resilient to refactors:
63+
- avoid mentioning transient details unless they are required constraints.
64+
- When implementing algorithms (MCTS, training targets, replay shaping, serialization constraints),
65+
add at least one pedagogical comment describing the perspective/sign convention or invariant.
66+
- For bug fixes, include a brief comment near the fix explaining the original failure mode.
67+
5168
## UI Contract (Web)
5269

5370
When changing `web/`, enforce a consistent design system and interaction model.

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.git
22
.gitignore
33
.venv
4+
web/node_modules
5+
web/dist
46
__pycache__/
57
*.pyc
68
*.pyo

.env.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ SUPABASE_SERVICE_ROLE_KEY=""
3939

4040
# Inference defaults
4141
MODEL_CHECKPOINT_PATH="checkpoints/last.ckpt"
42+
MODEL_ONNX_PATH="" # optional: checkpoints/last.onnx
43+
INFERENCE_PREFER_ONNX=true # if true, fast mode tries ONNX first
4244
INFERENCE_MODE_DEFAULT="fast" # fast | strong
4345
INFERENCE_DEVICE="auto" # auto | cpu | cuda
4446
INFERENCE_MCTS_SIMS=160
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Build App Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
paths:
9+
- "Dockerfile"
10+
- ".dockerignore"
11+
- "web/**"
12+
- "src/api/**"
13+
- "src/inference/**"
14+
- "src/game/**"
15+
- "src/data/**"
16+
- "alembic/**"
17+
- "alembic.ini"
18+
- "pyproject.toml"
19+
- "uv.lock"
20+
- ".github/workflows/build-app-image.yml"
21+
pull_request:
22+
paths:
23+
- "Dockerfile"
24+
- ".dockerignore"
25+
- "web/**"
26+
- "src/api/**"
27+
- "src/inference/**"
28+
- "src/game/**"
29+
- "src/data/**"
30+
- "alembic/**"
31+
- "alembic.ini"
32+
- "pyproject.toml"
33+
- "uv.lock"
34+
- ".github/workflows/build-app-image.yml"
35+
workflow_dispatch:
36+
37+
concurrency:
38+
group: build-app-image-${{ github.ref }}
39+
cancel-in-progress: true
40+
41+
jobs:
42+
docker:
43+
runs-on: ubuntu-latest
44+
permissions:
45+
contents: read
46+
packages: write
47+
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Set up Docker Buildx
53+
uses: docker/setup-buildx-action@v3
54+
55+
- name: Log in to GHCR
56+
if: github.event_name != 'pull_request'
57+
uses: docker/login-action@v3
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.actor }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Extract Docker metadata
64+
id: meta
65+
uses: docker/metadata-action@v5
66+
with:
67+
images: ghcr.io/${{ github.repository_owner }}/ataxx-app
68+
tags: |
69+
type=sha,format=long
70+
type=ref,event=branch
71+
type=raw,value=latest,enable={{is_default_branch}}
72+
73+
- name: Build and (optionally) push
74+
uses: docker/build-push-action@v6
75+
with:
76+
context: .
77+
file: Dockerfile
78+
push: ${{ github.event_name != 'pull_request' }}
79+
tags: ${{ steps.meta.outputs.tags }}
80+
labels: ${{ steps.meta.outputs.labels }}
81+
cache-from: type=gha
82+
cache-to: type=gha,mode=max
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Build Train Image
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
paths:
9+
- "Dockerfile.train"
10+
- ".dockerignore"
11+
- "train.py"
12+
- "train_improved.py"
13+
- "src/engine/**"
14+
- "src/model/**"
15+
- "src/game/**"
16+
- "src/data/**"
17+
- "pyproject.toml"
18+
- "uv.lock"
19+
- ".github/workflows/build-train-image.yml"
20+
pull_request:
21+
paths:
22+
- "Dockerfile.train"
23+
- ".dockerignore"
24+
- "train.py"
25+
- "train_improved.py"
26+
- "src/engine/**"
27+
- "src/model/**"
28+
- "src/game/**"
29+
- "src/data/**"
30+
- "pyproject.toml"
31+
- "uv.lock"
32+
- ".github/workflows/build-train-image.yml"
33+
workflow_dispatch:
34+
35+
concurrency:
36+
group: build-train-image-${{ github.ref }}
37+
cancel-in-progress: true
38+
39+
jobs:
40+
docker:
41+
runs-on: ubuntu-latest
42+
permissions:
43+
contents: read
44+
packages: write
45+
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v4
49+
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v3
52+
53+
- name: Log in to GHCR
54+
if: github.event_name != 'pull_request'
55+
uses: docker/login-action@v3
56+
with:
57+
registry: ghcr.io
58+
username: ${{ github.actor }}
59+
password: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Extract Docker metadata
62+
id: meta
63+
uses: docker/metadata-action@v5
64+
with:
65+
images: ghcr.io/${{ github.repository_owner }}/ataxx-train
66+
tags: |
67+
type=sha,format=long
68+
type=ref,event=branch
69+
type=raw,value=latest,enable={{is_default_branch}}
70+
71+
- name: Build and (optionally) push
72+
uses: docker/build-push-action@v6
73+
with:
74+
context: .
75+
file: Dockerfile.train
76+
push: ${{ github.event_name != 'pull_request' }}
77+
tags: ${{ steps.meta.outputs.tags }}
78+
labels: ${{ steps.meta.outputs.labels }}
79+
cache-from: type=gha
80+
cache-to: type=gha,mode=max

.github/workflows/ci-api.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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 .

.github/workflows/ci-train.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: CI Train
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
paths:
9+
- "train.py"
10+
- "train_improved.py"
11+
- "src/engine/**"
12+
- "src/model/**"
13+
- "src/game/**"
14+
- "src/data/**"
15+
- "scripts/**"
16+
- "tests/test_mcts_numerics.py"
17+
- "tests/test_training_step_numerics.py"
18+
- "pyproject.toml"
19+
- "uv.lock"
20+
- "pyrefly.toml"
21+
- ".github/workflows/ci-train.yml"
22+
pull_request:
23+
paths:
24+
- "train.py"
25+
- "train_improved.py"
26+
- "src/engine/**"
27+
- "src/model/**"
28+
- "src/game/**"
29+
- "src/data/**"
30+
- "scripts/**"
31+
- "tests/test_mcts_numerics.py"
32+
- "tests/test_training_step_numerics.py"
33+
- "pyproject.toml"
34+
- "uv.lock"
35+
- "pyrefly.toml"
36+
- ".github/workflows/ci-train.yml"
37+
workflow_dispatch:
38+
39+
concurrency:
40+
group: ci-train-${{ github.ref }}
41+
cancel-in-progress: true
42+
43+
jobs:
44+
train-quality:
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 35
47+
env:
48+
PYTHONUNBUFFERED: "1"
49+
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
54+
- name: Setup Python
55+
uses: actions/setup-python@v5
56+
with:
57+
python-version: "3.10"
58+
59+
- name: Setup uv
60+
uses: astral-sh/setup-uv@v4
61+
with:
62+
enable-cache: true
63+
64+
- name: Sync dependencies (dev + train + export)
65+
run: uv sync --frozen --group dev --group train --group export
66+
67+
- name: Compatibility shim for pyrefly interpreter path
68+
run: |
69+
mkdir -p .venv/Scripts
70+
ln -sf ../bin/python .venv/Scripts/python.exe
71+
72+
- name: Python file length policy
73+
run: uv run python scripts/check_python_max_lines.py --max-lines 500 --path train.py --path src --path tests --path scripts
74+
75+
- name: Ruff (train scope)
76+
run: uv run ruff check train.py src/engine src/model src/game src/data tests scripts
77+
78+
- name: Pyrefly (train scope)
79+
run: uv run pyrefly check train.py src tests
80+
81+
- name: Pytest (train scope)
82+
run: uv run pytest -q tests/test_mcts_numerics.py tests/test_training_step_numerics.py

0 commit comments

Comments
 (0)