Skip to content

Commit a77ecce

Browse files
skip pytest in ci for docs-only pull requests
Use paths-filter so propose/plans/docs PRs still get a green test check without installing deps or running the full suite; code changes unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 5dad890 commit a77ecce

4 files changed

Lines changed: 43 additions & 10 deletions

File tree

.cursor/skills/plan-prompts/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ Per [`propose/completed/TEST-SUITE-FAST-LOOP-PROPOSE.md`](../../../propose/compl
6363

6464
- Add a markdown section with the **exact heading** `## Tests to run (iteration loop)` inside the fenced **Prompt** block, **immediately after** `## Deliverables` and **before** `## Tests`.
6565
- Content: bullet list of `tests/test_*.py` paths, each with a **one-line rationale** tied to the PR’s code paths.
66-
- **Merge gate:** state that the **full** default suite (`pytest tests`, `JAVA_CODEBASE_RAG_RUN_HEAVY` unset or `0`) is enforced at merge time by CI once the repo workflow exists; the iteration list is for speed only.
67-
- **Docs-only (UC15):** if the PR is documentation-only with no test signal, use an explicit empty pattern, e.g. a single bullet `*(none — docs-only change; full suite still runs in CI.)*` — do not invent a fake file list.
66+
- **Merge gate:** state that CI enforces a green `test` check on every PR; code changes run the full default suite (`pytest tests`, `JAVA_CODEBASE_RAG_RUN_HEAVY` unset or `0`), docs-only PRs skip pytest but still need a green `test` job; the iteration list is for speed only.
67+
- **Docs-only (UC15):** if the PR is documentation-only with no test signal, use an explicit empty pattern, e.g. a single bullet `*(none — docs-only change; CI test job passes but pytest is skipped.)*` — do not invent a fake file list.
6868

6969
This heading must stay verbatim so reviewers (and the repo **`pr-review`** skill in `.cursor/skills/pr-review/`) can grep for it.
7070

@@ -108,12 +108,12 @@ Read the PR-XX section first. The plan is the source of truth.
108108

109109
## Tests to run (iteration loop)
110110

111-
Run only these files during local iteration; full suite is the merge gate (CI on PR + `master`).
111+
Run only these files during local iteration; CI `test` on PR + `master` is the merge gate (full pytest when code changes).
112112

113113
- `tests/test_<file>.py` — <one-line rationale>
114114
- `tests/test_<other>.py` — <one-line rationale>
115115

116-
Docs-only PRs (UC15): use a single bullet such as *(none — docs-only change; full suite still runs in CI.)* instead of inventing paths.
116+
Docs-only PRs (UC15): use a single bullet such as *(none — docs-only change; CI test job passes but pytest is skipped.)* instead of inventing paths.
117117

118118
## Tests
119119
Run: `<command>`

.cursor/skills/pr-review/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ The PR body or thread must include **pasteable proof** that the author ran the f
3131
- A vague “ran pytest” with no file list and no exit code.
3232
- Substituting a different file list than the prompt declared, without explanation.
3333

34-
If the task prompt declared **docs-only** (empty iteration list per UC15), subset evidence is: state that no test files were required for iteration, and still require **full-suite CI green** below.
34+
If the task prompt declared **docs-only** (empty iteration list per UC15), subset evidence is: state that no test files were required for iteration, and still require a **green `test` CI** run below (pytest may be skipped when only documentation paths changed).
3535

36-
**Subset green does not replace the merge gate:** If full-suite CI is red, the PR is not merge-ready even when the declared subset passed locally.
36+
**Subset green does not replace the merge gate:** If the required `test` CI check is red (or missing), the PR is not merge-ready even when the declared subset passed locally.
3737

3838
## 3. Test evidence — full suite / CI (mandatory when repo CI exists)
3939

40-
When this repository has a required GitHub Actions workflow that runs the **full** default suite (e.g. `pytest tests` with `JAVA_CODEBASE_RAG_RUN_HEAVY` unset or `0`):
40+
When this repository has a required GitHub Actions workflow (`.github/workflows/test.yml`):
4141

42-
- [ ] The PR description or review comment includes a **link** to a **green** Actions run for the **full** suite on **this PR** at the **same commit** being reviewed (or the tip the reviewer approves).
42+
- [ ] The PR description or review comment includes a **link** to a **green** `test` Actions run on **this PR** at the **same commit** being reviewed (or the tip the reviewer approves). For code changes, the run must include `pytest tests` with `JAVA_CODEBASE_RAG_RUN_HEAVY` unset or `0`. For docs-only PRs, a green run with pytest skipped is sufficient.
4343

4444
If CI is not yet enabled for the repo, note that in the review; once the workflow exists, **withhold approval** until both §2 and §3 are satisfied.
4545

.github/workflows/test.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,48 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
- uses: dorny/paths-filter@v3
17+
id: changes
18+
with:
19+
filters: |
20+
docs:
21+
- '**/*.md'
22+
- '**/*.mdc'
23+
- 'docs/**'
24+
- 'propose/**'
25+
- 'plans/**'
26+
- 'reports/**'
27+
- '.cursor/**'
28+
- 'AGENTS.md'
29+
- 'README.md'
30+
- 'CODEBASE_REQUIREMENTS.md'
31+
- '.github/CODEOWNERS'
32+
code:
33+
- '**/*.py'
34+
- 'requirements.txt'
35+
- 'pyproject.toml'
36+
- '.github/workflows/**'
37+
- 'tests/**'
38+
- '!tests/**/*.md'
39+
- 'automation/**'
40+
- '!automation/**/*.md'
1441
- uses: actions/setup-python@v5
42+
if: steps.changes.outputs.code == 'true'
1543
with:
1644
python-version: "3.11"
1745
- name: Install dependencies
46+
if: steps.changes.outputs.code == 'true'
1847
run: |
1948
python -m pip install --upgrade pip
2049
pip install -r requirements.txt
2150
pip install -e .
2251
- name: Run tests
52+
if: steps.changes.outputs.code == 'true'
2353
env:
2454
JAVA_CODEBASE_RAG_RUN_HEAVY: "0"
2555
run: pytest tests -v
56+
- name: Skip tests (docs-only)
57+
if: steps.changes.outputs.code != 'true'
58+
run: echo "Docs-only change; pytest skipped."

tests/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ cd /path/to/java-codebase-rag
3333

3434
## CI merge gate and fixture tiers
3535

36-
**Merge gate (mechanical):** [`.github/workflows/test.yml`](../.github/workflows/test.yml) runs `pytest tests` with `JAVA_CODEBASE_RAG_RUN_HEAVY=0` on every pull request and on every push to `master`. Branch protection on `master` requires the `test` status check to pass before merge and disables force-push. Break-glass policy: `enforce_admins: false` so the sole maintainer can bypass for emergency hotfixes — explain the bypass in the merge commit.
36+
**Merge gate (mechanical):** [`.github/workflows/test.yml`](../.github/workflows/test.yml) always runs the `test` job on every pull request and on every push to `master`. When any **source** path changes (Python, deps, workflows, non-markdown under `tests/` or `automation/`), it runs `pytest tests` with `JAVA_CODEBASE_RAG_RUN_HEAVY=0`. Documentation-only changes (`propose/`, `plans/`, `reports/`, `.cursor/`, `docs/`, `**/*.md`, etc.) still produce a green `test` check but skip pytest. Branch protection on `master` requires the `test` status check to pass before merge and disables force-push. Break-glass policy: `enforce_admins: false` so the sole maintainer can bypass for emergency hotfixes — explain the bypass in the merge commit.
3737

38-
**Iteration subset (convention):** During implementation, authors name a `pytest` file subset inside each per-PR execution prompt (for example in `plans/CURSOR-PROMPTS-*.md`). The repo **[`plan-prompts`](../.cursor/skills/plan-prompts/SKILL.md)** skill (`.cursor/skills/plan-prompts/`) requires a **`## Tests to run (iteration loop)`** section in that scaffold, placed **after Deliverables and before Tests**. Reviewers follow the repo **[`pr-review`](../.cursor/skills/pr-review/SKILL.md)** skill (`.cursor/skills/pr-review/`): pasted subset command + exit code, plus a green full-suite CI link from the now-real merge gate documented above. Canonical skill sources live under `.cursor/skills/`; you may copy them into `~/.cursor/skills/` if your Cursor setup loads personal skills only. See [`propose/completed/TEST-SUITE-FAST-LOOP-PROPOSE.md`](../propose/completed/TEST-SUITE-FAST-LOOP-PROPOSE.md) and [`plans/completed/PLAN-TEST-SUITE-FAST-LOOP.md`](../plans/completed/PLAN-TEST-SUITE-FAST-LOOP.md).
38+
**Iteration subset (convention):** During implementation, authors name a `pytest` file subset inside each per-PR execution prompt (for example in `plans/CURSOR-PROMPTS-*.md`). The repo **[`plan-prompts`](../.cursor/skills/plan-prompts/SKILL.md)** skill (`.cursor/skills/plan-prompts/`) requires a **`## Tests to run (iteration loop)`** section in that scaffold, placed **after Deliverables and before Tests**. Reviewers follow the repo **[`pr-review`](../.cursor/skills/pr-review/SKILL.md)** skill (`.cursor/skills/pr-review/`): pasted subset command + exit code, plus a green `test` CI link from the merge gate documented above (full pytest for code changes; pytest skipped for docs-only PRs). Canonical skill sources live under `.cursor/skills/`; you may copy them into `~/.cursor/skills/` if your Cursor setup loads personal skills only. See [`propose/completed/TEST-SUITE-FAST-LOOP-PROPOSE.md`](../propose/completed/TEST-SUITE-FAST-LOOP-PROPOSE.md) and [`plans/completed/PLAN-TEST-SUITE-FAST-LOOP.md`](../plans/completed/PLAN-TEST-SUITE-FAST-LOOP.md).
3939

4040
**Fixture tiers (PR-1):**
4141

0 commit comments

Comments
 (0)