Skip to content

ci: skip the test matrix when no code paths change - #18

Merged
lan496 merged 1 commit into
mainfrom
ci/path-filters
Sep 6, 2026
Merged

ci: skip the test matrix when no code paths change#18
lan496 merged 1 commit into
mainfrom
ci/path-filters

Conversation

@lan496

@lan496 lan496 commented Sep 6, 2026

Copy link
Copy Markdown
Member

Summary

  • Add a changes job to ci.yaml using dorny/paths-filter, mirroring the pattern already in docs.yaml.
  • Run the tests matrix only when code paths change: src/**, tests/**, pyproject.toml, uv.lock, .test_durations, or ci.yaml itself.
  • Teach the ci gate job to accept a skipped tests job.

A docs-only pull request currently runs six test jobs (two Python versions x three splits). After this it runs none of them, while pre-commit still covers the change.

Why pre-commit stays unfiltered

pre-commit/action runs every hook over all files, so it is meaningful for any change including pure documentation. Leaving it ungated also guarantees the ci gate always has at least one real signal behind it rather than passing on an all-skipped workflow.

The gate change is the risky part

ci is the required status check in the repository's branch ruleset, so it must report success on a docs-only PR where tests is skipped. test "skipped" = success would fail and block every docs PR, hence:

case "${{ needs.tests.result }}" in
  success | skipped) ;;
  *) exit 1 ;;
esac

needs.changes.result is asserted separately. Without it, a failure in the changes job would skip tests, and the relaxed check would then read that skip as acceptable and pass the gate.

Test plan

  • This PR touches only .github/workflows/ci.yaml, which is in the filter, so the full matrix should run and ci should pass
  • Confirm on a docs-only PR (chore: rename release config and add CI/dependency sections #17 qualifies once rebased, or any follow-up) that tests is skipped and ci still reports success
  • Confirm the ruleset's required ci check goes green in both cases

[Claude Code] Generated with Claude Code

Docs-only pull requests currently run the full six-job matrix across two
Python versions and three test splits. Gate it behind a paths-filter, the
same approach docs.yaml already uses.

pre-commit stays unfiltered because pre-commit/action runs every hook over
all files, so it is meaningful for any change.

The `ci` gate now tolerates a skipped tests job, since the branch ruleset
requires that check and a skipped dependency would otherwise fail it. It
also asserts that `changes` itself succeeded, so a failure there cannot
pass the gate by silently skipping tests.

Co-Authored-By: Claude <noreply@anthropic.com>
@lan496
lan496 marked this pull request as ready for review September 6, 2026 07:57
@lan496
lan496 enabled auto-merge September 6, 2026 07:57
@lan496
lan496 merged commit 5137b5a into main Sep 6, 2026
12 checks passed
@lan496
lan496 deleted the ci/path-filters branch September 6, 2026 07:58
@github-actions github-actions Bot mentioned this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant