Skip to content

ci: skip build steps for docs-only pull requests - #74

Merged
biobo-bot[bot] merged 1 commit into
mainfrom
ci/skip-docs-only-jobs
Oct 30, 2026
Merged

biobo-bot[bot] merged 1 commit into
mainfrom
ci/skip-docs-only-jobs

Conversation

@sentomk

@sentomk sentomk commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Summary

Docs-only pull requests (for example #66, #68, #70) ran the full compiler matrix, clang-tidy, fuzzing and a roughly 15 minute benchmark comparison. This adds change detection so those pull requests skip the expensive work, while the required check names keep being reported.

Changes

  • scripts/ci_changes.py: classifies the files a pull request changes. code=false only when every file is documentation, agent instructions (ai/, .claude/) or packaging metadata (packaging/); perf=true when a file that can move benchmark numbers changed. Unknown files count as code; pushes, schedules and manual runs always run everything.
  • ci.yml, ci-pr.yml, ci-full.yml, clang-format-check.yml: a changes job, and every step of the required jobs gets if: needs.changes.outputs.code == 'true'. The jobs still run (a few seconds each), so check names, including the expanded matrix names such as gcc-13 C++23, are unchanged. Branch protection does not need to change.
  • clang-tidy.yml, fuzz.yml: not required, so the whole job is skipped for docs-only changes.
  • ci-pr.yml benchmark comparison: runs only when perf is true, so test-only and CI-only pull requests skip it too.
  • scripts/README.md: documents the script and the rules.

Testing

  • The script classified sample path sets as expected (docs and packaging only: code=false; any test, header or workflow file: code=true; headers: perf=true), and gave the right answer on a simulated pull_request merge checkout, where the base moving does not leak into the file list.
  • All workflow files parse as YAML.
  • Not exercised: the skipping itself. This pull request changes workflows, so it runs every job. The first docs-only pull request after merge is the real test, and I will check its checks list.

biobo-bot[bot]
biobo-bot Bot previously approved these changes Oct 30, 2026

@biobo-bot biobo-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change. Keeping the required jobs alive and turning off only their steps is the right way around the PR #45 problem, since a skipped matrix job would otherwise report under its unexpanded name and never satisfy branch protection. The classifier also fails safe in the right places: unknown paths count as code, non-pull_request events run everything, and a failed git diff falls back to running everything.

I checked:

  • All six workflows gate every step of the required jobs (build-and-test, the full matrix, coverage, Ubuntu / Clang / Debug, the compile-time bench build, clang-format), and only the non-required ones (clang-tidy, fuzz, the benchmark comparison) are skipped whole.
  • Report build time uses needs.changes.outputs.code == 'true' && always(), which keeps the always() semantics, so it's fine.
  • fetch-depth: 2 with HEAD^1 on the default pull_request merge checkout gives exactly the PR's files.
  • The perf set covers include/, bench/, cmake/, the bench scripts, the top-level CMakeLists.txt and ci-pr.yml itself, which matches what the benchmark job builds.

There's one small hole, noted inline: rename detection can hide a moved code file. It's a one-flag fix. Approving, since it's an edge case, but please pick it up before merging.

Non-blocking nit: the changes job is copied into six workflows. If it ever grows, a reusable workflow or a composite action would keep them from drifting apart. That's fine to leave as is for now.

Comment thread scripts/ci_changes.py Resolved
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark comparison (informational)

Base 03ed8dc vs PR 6761e52, run one after the other on the same GitHub-hosted runner. This does not block merging.

Noise estimate: the 20 control rows below do not run Patternia code, so they should not change between base and PR. As a group they moved by a median of +0.0% (run order and machine drift); that offset is divided out of the Patternia deltas (Adjusted). The controls then scatter by a median of 0.2%. Adjusted differences under 5.0% are treated as noise.

Patternia: 8 benchmarks, 0 slower, 0 faster, 8 within noise.

Benchmark Base (ns) PR (ns) Delta Adjusted Verdict
PatterniaPipe CommandParser 1.776 1.777 +0.0% -0.0% within noise
PatterniaPipe PacketMixed 1.628 1.624 -0.2% -0.3% within noise
PatterniaPipe PacketMixedHeavyBind 1.689 1.691 +0.1% +0.1% within noise
PatterniaPipe ProtocolRouter 1.629 1.628 -0.1% -0.1% within noise
PatterniaPipe VariantAltHot 1.561 1.559 -0.1% -0.1% within noise
PatterniaPipe VariantAltHotGuarded 1.728 1.715 -0.8% -0.8% within noise
PatterniaPipe VariantMixed 2.000 2.004 +0.2% +0.2% within noise
PatterniaPipe VariantMixedGuarded 2.002 2.001 -0.0% -0.1% within noise
Control rows (not Patternia code)
Benchmark Base (ns) PR (ns) Delta
IfElse CommandParser 2.200 2.209 +0.4%
IfElse ProtocolRouter 1.872 1.878 +0.3%
Sequential VariantAltHot 1.713 2.181 +27.3%
Sequential VariantAltHotGuarded 1.874 1.872 -0.1%
Sequential VariantMixed 1.169 1.170 +0.1%
Sequential VariantMixedGuarded 1.435 1.435 -0.0%
StdVisit CommandParser 1.392 1.391 -0.1%
StdVisit ProtocolRouter 1.525 1.522 -0.2%
StdVisit VariantAltHot 1.562 1.562 +0.0%
StdVisit VariantAltHotGuarded 1.718 1.715 -0.2%
StdVisit VariantMixed 1.999 1.994 -0.3%
StdVisit VariantMixedGuarded 2.155 2.160 +0.3%
SwitchIndex VariantAltHot 1.721 2.092 +21.6%
SwitchIndex VariantAltHotGuarded 1.873 2.078 +10.9%
SwitchIndex VariantMixed 0.999 1.001 +0.2%
SwitchIndex VariantMixedGuarded 1.408 1.411 +0.2%
Switch CommandParser 2.256 2.251 -0.2%
Switch PacketMixed 1.435 1.436 +0.1%
Switch PacketMixedHeavyBind 1.502 1.498 -0.3%
Switch ProtocolRouter 1.599 1.594 -0.3%

Raw results and the comparison chart are attached to this workflow run as an artifact. Shared runners are noisy, so use this as a trend, not a measurement.

Problem
- Every pull request ran the whole matrix, clang-tidy, fuzzing and a
  15 minute benchmark comparison, even when it only touched docs, agent
  instructions or packaging metadata.
- The workflows cannot use paths-ignore: branch protection requires
  their checks, and a skipped workflow leaves them unreported.

Implementation
- Add scripts/ci_changes.py, which classifies the files a pull request
  changes and reports code and perf outputs. Anything it cannot
  classify counts as code, and non-pull_request events always run.
- Add a changes job to ci, ci-pr, ci-full, clang-format, clang-tidy
  and fuzz.
- Required jobs keep running and skip their steps, so the check names
  stay unchanged, including the expanded matrix names. clang-tidy,
  fuzz and the benchmark comparison are skipped as whole jobs, and the
  benchmark runs only when a file that can move its numbers changed.

Tests
- Classified sample path sets, and a simulated pull_request merge
  checkout, with the script.
- Workflow YAML parses. The skipping itself cannot run here: this
  pull request changes workflows, so it runs every job.
@biobo-bot
biobo-bot Bot force-pushed the ci/skip-docs-only-jobs branch from 34b9c2e to 6761e52 Compare October 30, 2026 06:27

@biobo-bot biobo-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-checked the diff at 6761e52: the only change since 34b9c2e is --no-renames in scripts/ci_changes.py, which closes the rename gap. LGTM.

@biobo-bot biobo-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed 6761e52 against the previously reviewed 34b9c2e (same base, amended commit). The only change is in scripts/ci_changes.py: changed_files() now runs git diff --no-renames --name-only HEAD^1 HEAD, which addresses the earlier rename comment. I checked that a moved header (include/a.hpp and docs/a.hpp) classifies as code=true, and a docs-only set still gives code=false. No other files changed. LGTM.

@biobo-bot
biobo-bot Bot merged commit e6b0e62 into main Oct 30, 2026
30 checks passed
@biobo-bot
biobo-bot Bot deleted the ci/skip-docs-only-jobs branch October 30, 2026 06:43
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