Skip to content

chore: strip redundant CI steps for self-hosted runner#31

Open
27Bslash6 wants to merge 1 commit intomainfrom
chore/lean-ci-for-self-hosted
Open

chore: strip redundant CI steps for self-hosted runner#31
27Bslash6 wants to merge 1 commit intomainfrom
chore/lean-ci-for-self-hosted

Conversation

@27Bslash6
Copy link
Copy Markdown
Contributor

@27Bslash6 27Bslash6 commented May 2, 2026

Summary

  • Remove toolchain install, cache, and cargo install steps from jobs running on cachekit self-hosted runner (image has Rust stable, cargo-audit, cargo-deny, cargo-fuzz baked in)
  • Skip toolchain install on self-hosted unless MSRV (1.85) needed
  • Keep toolchain + cache for GitHub-hosted runners (macOS, Windows)
  • Add cargo generate-lockfile before cargo vet (fixes fix: generate lockfile before cargo vet #30 — library has no committed Cargo.lock)
  • Use rustup default nightly for fuzz jobs instead of dtolnay action

Net: -134 lines, faster CI (no redundant installs on every run).

Summary by CodeRabbit

  • Chores
    • Streamlined CI/CD workflows by simplifying Rust toolchain setup and making toolchain installation conditional where needed.
    • Removed redundant dependency caching and installation steps across CI, code scanning, release, and security pipelines.
    • Standardized fuzzing jobs to use a unified nightly toolchain approach.
    • Added a lockfile generation step to improve vetting checks; security scan steps remain intact.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 2, 2026

📝 Walkthrough

Walkthrough

Workflows were simplified across CI, CodeQL, release, and security configs by removing or guarding explicit Rust toolchain installs and cargo registry caching; CI gains conditionals for the cachekit runner and 1.85 rust matrix case; cargo generate-lockfile was added before cargo-vet.

Changes

Workflow Simplification

Layer / File(s) Summary
Core Removals
.github/workflows/codeql.yml, .github/workflows/release.yml, .github/workflows/security.yml
Removed explicit Rust toolchain installation steps and Cargo registry caching from multiple jobs; subsequent build/test/analyze steps left unchanged to rely on runner-provided toolchains.
Conditional Toolchain Setup
.github/workflows/ci.yml
test job: added `if: matrix.runner != 'cachekit'
Security Job Refactoring
.github/workflows/ci.yml (security job), .github/workflows/security.yml
Removed toolchain/cache/install steps from security job in ci.yml; in security.yml removed stable/nightly installs and caches from fast-security, kani, cargo-vet, sbom, quick-fuzz, and deep-fuzz, replacing nightly installs with rustup default nightly in fuzz jobs.
Lockfile Generation
.github/workflows/security.yml
Added cargo generate-lockfile immediately before running cargo-vet to ensure a lockfile exists for vet and to fix cache key behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through workflows, pruning every chain,
Toolchains now assumed, less setup to maintain.
I generated a lockfile so vet can take flight,
Nightly’s set with a word, caches kept out of sight.
CI breathes easier — a tidy little feat.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: removing redundant CI steps designed for self-hosted runners with pre-installed tooling.
Linked Issues check ✅ Passed The PR fulfills issue #30's requirement by adding 'cargo generate-lockfile' before 'cargo vet', and addresses the broader objective of optimizing CI for self-hosted runners.
Out of Scope Changes check ✅ Passed All changes are directly scoped to CI workflows and self-hosted runner optimization; no unrelated changes to codebase or functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/lean-ci-for-self-hosted

Review rate limit: 3/5 reviews remaining, refill in 20 minutes and 52 seconds.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 43-47: The step that uses dtolnay/rust-toolchain is skipped on the
cachekit runner except for rust '1.85' because the if condition is "if:
matrix.runner != 'cachekit' || matrix.rust == '1.85'", which causes the beta
matrix entry to run with the runner default toolchain; update the condition so
the toolchain setup runs on cachekit when matrix.rust == 'beta' (for example add
"|| matrix.rust == 'beta'" or remove the cachekit exclusion), ensuring the uses:
dtolnay/rust-toolchain step actually installs the beta toolchain for the
cachekit runner.

In @.github/workflows/security.yml:
- Around line 70-71: Replace the step that runs the shell command "rustup
default nightly" (the job step named "Use nightly toolchain" that currently
mutates the host-global toolchain) with invocations that prefix cargo commands
with +nightly (for example use "cargo +nightly fuzz build ..." and "cargo
+nightly fuzz run ..." where relevant) so the workflow uses the nightly
toolchain only for those cargo actions without changing the runner's default
toolchain; update both occurrences that currently call "rustup default nightly"
to the targeted "cargo +nightly ..." variants and remove the global rustup
default change.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 399213ee-bedc-49e8-9299-6e8010904446

📥 Commits

Reviewing files that changed from the base of the PR and between b90d14c and c1e77f8.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/release.yml
  • .github/workflows/security.yml
💤 Files with no reviewable changes (2)
  • .github/workflows/release.yml
  • .github/workflows/codeql.yml

Comment thread .github/workflows/ci.yml
Comment on lines +43 to 47
if: matrix.runner != 'cachekit' || matrix.rust == '1.85'
uses: dtolnay/rust-toolchain@3c5f7ea28cd621ae0bf5283f0e981fb97b8a7af9 # master
with:
toolchain: ${{ matrix.rust }}
components: ${{ matrix.rust != '1.85' && 'rustfmt, clippy' || '' }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/ci.yml | head -60

Repository: cachekit-io/cachekit-core

Length of output: 2329


Install the beta toolchain on cachekit to preserve real beta coverage.

At Line 43, the condition if: matrix.runner != 'cachekit' || matrix.rust == '1.85' skips setup for beta on cachekit. This causes the beta matrix entry to run with the runner's default toolchain instead of beta, making the beta coverage misleading.

Suggested change
-        if: matrix.runner != 'cachekit' || matrix.rust == '1.85'
+        if: matrix.runner != 'cachekit' || matrix.rust != 'stable'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/ci.yml around lines 43 - 47, The step that uses
dtolnay/rust-toolchain is skipped on the cachekit runner except for rust '1.85'
because the if condition is "if: matrix.runner != 'cachekit' || matrix.rust ==
'1.85'", which causes the beta matrix entry to run with the runner default
toolchain; update the condition so the toolchain setup runs on cachekit when
matrix.rust == 'beta' (for example add "|| matrix.rust == 'beta'" or remove the
cachekit exclusion), ensuring the uses: dtolnay/rust-toolchain step actually
installs the beta toolchain for the cachekit runner.

Comment on lines +70 to +71
- name: Use nightly toolchain
run: rustup default nightly
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/security.yml | head -120

Repository: cachekit-io/cachekit-core

Length of output: 4566


🏁 Script executed:

wc -l .github/workflows/security.yml

Repository: cachekit-io/cachekit-core

Length of output: 104


🏁 Script executed:

cat -n .github/workflows/security.yml | tail -64

Repository: cachekit-io/cachekit-core

Length of output: 2590


🏁 Script executed:

cat -n .github/workflows/ci.yml | head -80

Repository: cachekit-io/cachekit-core

Length of output: 3018


🏁 Script executed:

fd -type f -name "*.yml" -o -name "*.yaml" | grep -E "(runner|setup)" | head -20

Repository: cachekit-io/cachekit-core

Length of output: 240


🏁 Script executed:

fd -type f "runner|setup" .github/ 2>/dev/null || find .github -type f \( -name "*runner*" -o -name "*setup*" \)

Repository: cachekit-io/cachekit-core

Length of output: 51


🏁 Script executed:

ls -la .github/

Repository: cachekit-io/cachekit-core

Length of output: 239


🏁 Script executed:

rg "cargo fuzz" .github/workflows/ -A 3 -B 3

Repository: cachekit-io/cachekit-core

Length of output: 1382


🏁 Script executed:

rg "rustup" .github/workflows/ -B 2 -A 2

Repository: cachekit-io/cachekit-core

Length of output: 625


Use cargo +nightly instead of rustup default nightly to avoid host-global state mutation on persistent self-hosted runners.

At Lines 70–71 and 109–110, rustup default nightly changes the runner's global toolchain default. On the cachekit self-hosted runner, this persists across job boundaries and can cause subsequent jobs (e.g., kani, cargo-vet) to unexpectedly use nightly instead of the stable toolchain they assume.

Replace with: cargo +nightly fuzz build ... and cargo +nightly fuzz run ...

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/security.yml around lines 70 - 71, Replace the step that
runs the shell command "rustup default nightly" (the job step named "Use nightly
toolchain" that currently mutates the host-global toolchain) with invocations
that prefix cargo commands with +nightly (for example use "cargo +nightly fuzz
build ..." and "cargo +nightly fuzz run ..." where relevant) so the workflow
uses the nightly toolchain only for those cargo actions without changing the
runner's default toolchain; update both occurrences that currently call "rustup
default nightly" to the targeted "cargo +nightly ..." variants and remove the
global rustup default change.

…d in

The cachekit ARC runner image (ghcr.io/cachekit-io/runner) includes
Rust stable, rustfmt, clippy, cargo-audit, cargo-deny, and cargo-fuzz.

- Remove dtolnay/rust-toolchain steps from cachekit jobs (already installed)
- Remove actions/cache steps from cachekit jobs (host cache mounted at /cache)
- Remove cargo install steps for tools baked into the image
- Skip toolchain install on self-hosted unless MSRV (1.85) is needed
- Keep toolchain/cache for GitHub-hosted runners (macos, windows)
- Add cargo generate-lockfile before cargo vet (library has no Cargo.lock)
- Use rustup default nightly for fuzz jobs (simpler than dtolnay action)
@27Bslash6 27Bslash6 force-pushed the chore/lean-ci-for-self-hosted branch from c1e77f8 to 2a458d9 Compare May 2, 2026 11:45
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
.github/workflows/security.yml (1)

70-71: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use per-command nightly instead of rustup default nightly in fuzz jobs.

rustup default nightly mutates host-global toolchain state on self-hosted runners, which can leak into later jobs. Prefer cargo +nightly ... for fuzz commands in both jobs.

Suggested patch
-      - name: Use nightly toolchain
-        run: rustup default nightly
-
       - name: Run quick fuzz (corpus only)
         run: |
           cd fuzz
           # Build first - fail fast on compile errors
-          cargo fuzz build ${{ matrix.target }}
+          cargo +nightly fuzz build ${{ matrix.target }}
           # Run corpus - timeout exit code 124 is acceptable (means it ran)
-          timeout 120 cargo fuzz run ${{ matrix.target }} -- -runs=0 -max_total_time=120 || [ $? -eq 124 ]
+          timeout 120 cargo +nightly fuzz run ${{ matrix.target }} -- -runs=0 -max_total_time=120 || [ $? -eq 124 ]
@@
-      - name: Use nightly toolchain
-        run: rustup default nightly
-
       - name: Run deep fuzz (30 minutes per target)
         run: |
           cd fuzz
           # Build first - fail fast on compile errors
-          cargo fuzz build ${{ matrix.target }}
+          cargo +nightly fuzz build ${{ matrix.target }}
           # Run fuzz - timeout exit code 124 is acceptable (means it ran the full duration)
-          timeout 1800 cargo fuzz run ${{ matrix.target }} -- -max_total_time=1800 || [ $? -eq 124 ]
+          timeout 1800 cargo +nightly fuzz run ${{ matrix.target }} -- -max_total_time=1800 || [ $? -eq 124 ]
#!/bin/bash
# Verify there are no runner-global nightly mutations and fuzz commands are toolchain-scoped.
rg -n -C2 'rustup default nightly|cargo(\s+\+nightly)?\s+fuzz\s+(build|run)' .github/workflows/security.yml

Also applies to: 77-79, 109-110, 116-118

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/security.yml around lines 70 - 71, Replace any global
toolchain mutation using the command "rustup default nightly" in the fuzz job
steps with per-command scoped invocations; remove the "rustup default nightly"
step and change fuzz invocations to use the nightly toolchain prefix (e.g.,
invoke "cargo +nightly fuzz build" and "cargo +nightly fuzz run" wherever fuzz
commands appear) so runner-global state is not mutated and all fuzz commands are
toolchain-scoped.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/security.yml:
- Around line 70-71: Replace any global toolchain mutation using the command
"rustup default nightly" in the fuzz job steps with per-command scoped
invocations; remove the "rustup default nightly" step and change fuzz
invocations to use the nightly toolchain prefix (e.g., invoke "cargo +nightly
fuzz build" and "cargo +nightly fuzz run" wherever fuzz commands appear) so
runner-global state is not mutated and all fuzz commands are toolchain-scoped.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bfdde1b0-e1ab-400b-9122-2c77507b597f

📥 Commits

Reviewing files that changed from the base of the PR and between c1e77f8 and 2a458d9.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • .github/workflows/release.yml
  • .github/workflows/security.yml
💤 Files with no reviewable changes (2)
  • .github/workflows/release.yml
  • .github/workflows/codeql.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml

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