ci: add PR-gate workflow running pytest on every PR#16
Conversation
Existing main.yml only fires on workflow_dispatch (release path), so unit tests never ran on PRs. Add a workflow that runs pytest on every PR (and pushes to main) across Python 3.11 and 3.12. Lint is left as a follow-up — src/ currently has 10 pre-existing E501 violations that would block any gate; cleaning those up is a separate change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
| Filename | Overview |
|---|---|
| .github/workflows/test.yml | New PR-gate CI workflow running pytest across Python 3.11 and 3.12; job is named lint-and-test but contains no lint step, and no job-level timeout is set. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[PR opened / push to main] --> B{Branch filter}
B -->|targets main, feat/**, fix/**| C[lint-and-test matrix]
B -->|other base branches| Z[workflow skipped]
C --> D[Python 3.11]
C --> E[Python 3.12]
D --> F[checkout + setup-python + setup-uv]
E --> F
F --> G[uv sync --dev --all-extras]
G --> H[cp tests/sample.env tests/.env]
H --> I[uv run pytest tests/ -v]
I -->|pass| J[✅ Green check]
I -->|fail| K[❌ PR blocked]
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
.github/workflows/test.yml:9-14
**No job-level timeout set**
Without `timeout-minutes`, a hung test (e.g. a socket that never resolves against the placeholder `API_URL`) will block the runner until GitHub's default 6-hour hard limit. Because the matrix spawns two jobs per run, a single stuck test can hold two runners for hours. Adding `timeout-minutes: 10` (or a value appropriate to your 167-test suite) on the job keeps failures fast.
### Issue 2 of 3
.github/workflows/test.yml:1-3
The job is named `lint-and-test` and the workflow is called "Lint and Test", but there is no lint step. The PR description explicitly defers lint, but the names will be misleading for any required check configuration or status badge. Consider renaming to `test` / "Test" to match what the workflow actually does, then rename again when lint is added.
```suggestion
name: Test
on:
```
### Issue 3 of 3
.github/workflows/test.yml:29-30
The `uv sync` command here uses `--all-extras`, but `main.yml` (the release pipeline) uses `uv sync --dev` without `--all-extras`. If the package has optional extras, the test environment will include dependencies that the release build does not, potentially hiding missing-dependency failures that real users would hit.
```suggestion
- name: Install dependencies
run: uv sync --dev
```
Reviews (1): Last reviewed commit: "ci: install --all-extras so clone CLI te..." | Re-trigger Greptile
| jobs: | ||
| lint-and-test: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: |
There was a problem hiding this comment.
Without timeout-minutes, a hung test (e.g. a socket that never resolves against the placeholder API_URL) will block the runner until GitHub's default 6-hour hard limit. Because the matrix spawns two jobs per run, a single stuck test can hold two runners for hours. Adding timeout-minutes: 10 (or a value appropriate to your 167-test suite) on the job keeps failures fast.
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/test.yml
Line: 9-14
Comment:
**No job-level timeout set**
Without `timeout-minutes`, a hung test (e.g. a socket that never resolves against the placeholder `API_URL`) will block the runner until GitHub's default 6-hour hard limit. Because the matrix spawns two jobs per run, a single stuck test can hold two runners for hours. Adding `timeout-minutes: 10` (or a value appropriate to your 167-test suite) on the job keeps failures fast.
How can I resolve this? If you propose a fix, please make it concise.| name: Lint and Test | ||
|
|
||
| on: |
There was a problem hiding this comment.
The job is named
lint-and-test and the workflow is called "Lint and Test", but there is no lint step. The PR description explicitly defers lint, but the names will be misleading for any required check configuration or status badge. Consider renaming to test / "Test" to match what the workflow actually does, then rename again when lint is added.
| name: Lint and Test | |
| on: | |
| name: Test | |
| on: |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/test.yml
Line: 1-3
Comment:
The job is named `lint-and-test` and the workflow is called "Lint and Test", but there is no lint step. The PR description explicitly defers lint, but the names will be misleading for any required check configuration or status badge. Consider renaming to `test` / "Test" to match what the workflow actually does, then rename again when lint is added.
```suggestion
name: Test
on:
```
How can I resolve this? If you propose a fix, please make it concise.| - name: Install dependencies | ||
| run: uv sync --dev --all-extras |
There was a problem hiding this comment.
The
uv sync command here uses --all-extras, but main.yml (the release pipeline) uses uv sync --dev without --all-extras. If the package has optional extras, the test environment will include dependencies that the release build does not, potentially hiding missing-dependency failures that real users would hit.
| - name: Install dependencies | |
| run: uv sync --dev --all-extras | |
| - name: Install dependencies | |
| run: uv sync --dev |
Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/test.yml
Line: 29-30
Comment:
The `uv sync` command here uses `--all-extras`, but `main.yml` (the release pipeline) uses `uv sync --dev` without `--all-extras`. If the package has optional extras, the test environment will include dependencies that the release build does not, potentially hiding missing-dependency failures that real users would hit.
```suggestion
- name: Install dependencies
run: uv sync --dev
```
How can I resolve this? If you propose a fix, please make it concise.
Summary
Stacked on top of #15. Adds a CI workflow that runs
pytest tests/on every PR and push tomain, across Python 3.11 and 3.12.Existing
main.ymlonly fires onworkflow_dispatch(the release path), so unit tests never ran on PRs — the 167-test suite landed via #15 was only validated locally.Why a new workflow rather than extending
main.yml?main.ymlis the release pipeline: bumps version, tags, publishes to PyPI. Adding PR triggers there would entangle gate behaviour with release behaviour. Separate file keeps each one auditable in isolation.Lint deliberately deferred
uv run ruff check src/currently reports 10 pre-existing E501 violations onmain. Turning lint on here would make this PR fail before it could merge. Cleaning those up + flipping lint on is a follow-up PR (small footprint, line-wraps only).Test plan
Lint and Test / lint-and-test (3.11)and(3.12)show up as required checksuv run pytest tests/and report green (167 passed locally)🤖 Generated with Claude Code