perf(ci): cache Rust compilation with sccache#6617
Conversation
📝 WalkthroughWalkthroughThe CI workflow installs and enables sccache in the Rust lint, Rust test, and card-data gate jobs by configuring GitHub Actions caching and Rust compiler wrapper environment variables. ChangesCI compilation caching
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
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 49-55: Update the three sccache-enabled Rust jobs around the
“Enable sccache” steps to set CARGO_INCREMENTAL=0 in each job’s environment,
ensuring incremental compilation is disabled while preserving the existing
sccache configuration.
🪄 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: d2a10795-a0c7-456e-b054-a6efbac8550d
📒 Files selected for processing (1)
.github/workflows/ci.yml
| - uses: mozilla-actions/sccache-action@v0.0.10 | ||
|
|
||
| - name: Enable sccache | ||
| run: | | ||
| echo "SCCACHE_GHA_ENABLED=true" >> "$GITHUB_ENV" | ||
| echo "RUSTC_WRAPPER=sccache" >> "$GITHUB_ENV" | ||
|
|
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
while IFS= read -r file; do
echo "== $file =="
rg -n '^\[profile|^\s*incremental\s*=' "$file" || true
done < <(fd -t f '^Cargo\.toml$')
echo "== Workflow overrides =="
rg -n 'CARGO_INCREMENTAL|RUSTC_WRAPPER|SCCACHE_GHA_ENABLED' .github/workflows/ci.ymlRepository: phase-rs/phase
Length of output: 204
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
echo "== workflow =="
cat -n .github/workflows/ci.yml | sed -n '1,260p'
echo "== cargo tomls =="
find . -name Cargo.toml -print | sort | while IFS= read -r file; do
echo "== $file =="
cat -n "$file" | sed -n '1,220p'
doneRepository: phase-rs/phase
Length of output: 34951
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
echo "== config files =="
find . -path '*/.cargo/config.toml' -o -path './.cargo/config.toml' -o -path './Cargo.toml' | sort
echo "== incremental/profile search =="
rg -n 'incremental\s*=|\[profile\.ci\]|\[profile\.test\]|\[profile\.dev\]|CARGO_INCREMENTAL|profile ci' . \
--glob '!.git' \
--glob '!**/target/**' \
--glob '!**/node_modules/**' || true
echo "== .cargo/config.toml =="
if [ -f .cargo/config.toml ]; then
cat -n .cargo/config.toml
fiRepository: phase-rs/phase
Length of output: 3531
Disable incremental compilation for the sccache jobs
These Rust jobs don’t set CARGO_INCREMENTAL=0 or override incremental in the active Cargo profiles, so sccache may miss the main workspace compiles. Set CARGO_INCREMENTAL=0 for the three sccache-enabled jobs.
🤖 Prompt for 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.
In @.github/workflows/ci.yml around lines 49 - 55, Update the three
sccache-enabled Rust jobs around the “Enable sccache” steps to set
CARGO_INCREMENTAL=0 in each job’s environment, ensuring incremental compilation
is disabled while preserving the existing sccache configuration.
Source: MCP tools
Summary by CodeRabbit