@@ -11,7 +11,10 @@ permissions:
1111 pull-requests : write
1212
1313jobs :
14- # ── Unit tests ─────────────────────────────────────────────────────────
14+ # ── Unit tests (push + PR) ────────────────────────────────────────────
15+ # Only needs the core packages + pytest. We skip llm-mlx/mlx-lm here
16+ # because the default mlx package pulls in mlx-metal which is macOS-only.
17+ # All MLX-touching code paths are mocked in the unit tests anyway.
1518 test :
1619 name : Unit Tests
1720 runs-on : ubuntu-latest
@@ -25,27 +28,62 @@ jobs:
2528 python-version : " 3.13"
2629
2730 - name : Install dependencies
28- run : |
29- pip install pipenv
30- pipenv install --dev --deploy
31+ run : pip install llm requests pytest
3132
3233 - name : Run tests
33- run : pipenv run pytest tests/ -v --ignore=tests/test_integration_mlx.py
34+ run : pytest tests/ -v --ignore=tests/test_integration_mlx.py
3435
35- # ── Dogfood: run git-hygiene on its own commits (local MLX model) ─────
36- lint-commits :
37- name : Git Hygiene (dogfood)
36+ # ── Dogfood on PR: lint PR commits, post comment ───────────────── ─────
37+ lint-pr :
38+ name : Lint PR Commits
3839 runs-on : ubuntu-latest
3940 if : github.event_name == 'pull_request'
40- needs : test # only lint if tests pass
41+ needs : test
4142 steps :
4243 - name : Checkout
4344 uses : actions/checkout@v4
4445
4546 - name : Run Git Hygiene on this PR
46- uses : ./ # use the action from this repo
47+ uses : ./
4748 with :
4849 github-token : ${{ secrets.GITHUB_TOKEN }}
4950 use-local-model : " true"
5051 llm-model : " mlx-community/Qwen2.5-0.5B-Instruct-4bit"
51- fail-on-error : " false" # don't block PRs while we're tuning
52+ fail-on-error : " false"
53+
54+ # ── Dogfood on push to main: lint the merged commits ──────────────────
55+ lint-push :
56+ name : Lint Pushed Commits
57+ runs-on : ubuntu-latest
58+ if : github.event_name == 'push'
59+ needs : test
60+ steps :
61+ - name : Checkout
62+ uses : actions/checkout@v4
63+ with :
64+ # Fetch enough history to cover the pushed commits
65+ fetch-depth : 0
66+
67+ - name : Set up Python
68+ uses : actions/setup-python@v5
69+ with :
70+ python-version : " 3.13"
71+
72+ - name : Install dependencies
73+ run : pip install llm requests "mlx-lm[cpu]" llm-mlx
74+
75+ - name : Lint commits pushed to main
76+ run : |
77+ BEFORE="${{ github.event.before }}"
78+ AFTER="${{ github.sha }}"
79+
80+ # On the very first push (new repo), before is all zeros — lint the last commit
81+ if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
82+ echo "🔍 First push — linting HEAD commit only"
83+ python lint_local.py --last 1 \
84+ --model mlx-community/Qwen2.5-0.5B-Instruct-4bit
85+ else
86+ echo "🔍 Linting commits ${BEFORE:0:8}..${AFTER:0:8}"
87+ python lint_local.py --range "${BEFORE}..${AFTER}" \
88+ --model mlx-community/Qwen2.5-0.5B-Instruct-4bit
89+ fi
0 commit comments