Skip to content

ci: skip build/test on non-code changes - #111

Merged
getappz merged 2 commits into
masterfrom
ci/gate-build-on-code-changes
Jul 9, 2026
Merged

ci: skip build/test on non-code changes#111
getappz merged 2 commits into
masterfrom
ci/gate-build-on-code-changes

Conversation

@getappz

@getappz getappz commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a changes job (dorny/paths-filter) that detects whether Cargo.toml/Cargo.lock/build.rs/crates//src/ actually changed
  • The build matrix job still always runs (required status check, so it must always report), but the checkout/rust-cache/sccache/build/test steps are now individually gated on that result — a docs-only PR gets a fast green check instead of a full 3-OS compile

Why

  • This directly reduces the Actions cache churn discussed in ci: auto-delete PR-branch Actions caches on close #110: the ~7.8GB of rust-build-* caches get regenerated on every push regardless of whether source changed
  • Non-code PRs (docs, README, etc.) currently burn a full ubuntu+macos+windows build+test cycle for nothing

Not touched (intentionally)

  • security-check.yml (cargo audit) — also a required check, but its own comment already documents why it stays ungated (cheap with warm cache, and path-filtering a required check risks it never reporting)
  • CodeQL — not an in-repo workflow file; it runs via GitHub's Default Setup (Settings → Code security), which isn't configurable from this repo's files

Test plan

  • Open a docs-only PR and confirm build (*) goes green quickly without a real build
  • Open a source PR and confirm the full build/test still runs

Summary by CodeRabbit

  • Chores
    • Improved continuous integration to run build and test steps only when Rust/workspace-related changes are detected.
    • Reduced CI time for docs-only updates by skipping unnecessary compilation and test runs.
    • Made CI behavior more reliable by ensuring required steps aren’t accidentally skipped if change detection fails or is interrupted.

build (ubuntu/macos/windows) is a required status check, so the job
still runs and reports on every PR - only the checkout/build/test
steps are skipped on docs-only diffs, saving the runner minutes and
the sccache/rust-cache churn that was filling the Actions cache.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ae420a4-31b3-46c6-a470-9f4233d1b90b

📥 Commits

Reviewing files that changed from the base of the PR and between e1bd663 and 1986da5.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

📝 Walkthrough

Walkthrough

The CI workflow adds a changes job using dorny/paths-filter to detect Rust/workspace-related file changes. The build job now depends on that job, and its checkout, caching, sccache, build, and test steps run only when change detection succeeds or code changes are present.

Changes

CI Workflow Change Detection

Layer / File(s) Summary
Change detection
.github/workflows/ci.yml
Adds a changes job that sets a code output from path filters and makes the build job depend on it while remaining if: always().
Conditional build steps
.github/workflows/ci.yml
Adds per-step conditions so checkout, cache setup, sccache, cargo build, and cargo test run when change detection succeeds or when it reports code changes.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: skipping build/test work on non-code changes.
Description check ✅ Passed The description covers summary, motivation, test plan, and reviewer notes, with only minor template deviations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/gate-build-on-code-changes

Comment @coderabbitai help to get the list of available commands.

Comment thread .github/workflows/ci.yml Fixed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 13-19: The build workflow is still being skipped when the changes
job fails or is canceled because the build job only depends on needs: changes.
Update the build job in the CI workflow to use if: ${{ always() }} so it still
starts, and adjust the step-level guards in the build matrix job to also
consider needs.changes.result alongside the existing outputs so a failed or
inconclusive diff falls back to the full build/test path instead of skipping the
required check.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fbb2f10b-714d-4a9d-a91b-c028911d81fa

📥 Commits

Reviewing files that changed from the base of the PR and between 1419480 and e1bd663.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml

Comment thread .github/workflows/ci.yml
build depended on changes implicitly, so a failed/cancelled changes
job would skip build entirely - still a passing required check, but
no code ever got compiled or tested. Now the job always starts and
falls back to a full build/test whenever changes.result isn't a
clean success.
Comment thread .github/workflows/ci.yml Outdated
Comment on lines 36 to 66
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.

2 participants