Skip to content

ci: cache sccache local disk via actions/cache for hosted runners#376

Merged
streamer45 merged 1 commit intomainfrom
devin/1777128800-sccache-local-cache
Apr 25, 2026
Merged

ci: cache sccache local disk via actions/cache for hosted runners#376
streamer45 merged 1 commit intomainfrom
devin/1777128800-sccache-local-cache

Conversation

@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor

Summary

Cache sccache's local disk directory (~/.cache/sccache) as a single GitHub Actions cache entry, giving hosted runners compilation-level cache hits without the per-artifact entry explosion caused by SCCACHE_GHA_ENABLED (reverted in #373).

How it works:

  • actions/cache/restore runs before sccache-action — pre-populates the local sccache directory from a prior main-branch run
  • sccache finds cached compilation artifacts on disk → cache hits for unchanged crates
  • actions/cache/save runs at end of job, main-branch only (if: always() && github.ref == 'refs/heads/main')
  • Self-hosted GPU jobs are unchanged — they already have persistent disk sccache

Cache key strategy:

  • Main workspace jobs: sccache-{os}-{Cargo.lock hash} with restore-keys: sccache-{os}- for partial matches
  • Plugin jobs: sccache-plugins-{os}-{plugins/**/Cargo.lock hash} to avoid key collision

This creates 1 cache entry (vs ~1000 with SCCACHE_GHA_ENABLED) and complements Swatinem/rust-cache — rust-cache handles the target/ directory (linking artifacts, incremental state), sccache handles individual compilation output.

Closes #374

Review & Testing Checklist for Human

  • Verify the first CI run on this PR shows Cache not found for sccache (expected — no main-branch entry yet) and sccache stats show 0% hit rate
  • After merging to main, verify the main-branch CI run saves the sccache cache entry (check the "Save sccache cache" step)
  • On the next main-branch or PR run, verify sccache stats show >0% hit rate (the Sccache stats post-step from mozilla-actions/sccache-action)
  • Check https://github.com/streamer45/streamkit/actions/caches — should see 1-2 sccache-Linux-* entries (not hundreds)

Notes

  • Release and marketplace workflows save sccache cache unconditionally (no github.ref check) since they only run on tags/dispatch respectively
  • Expected sccache cache size: ~1-3 GiB compressed, fitting comfortably within the 10 GiB repo quota alongside the 3 rust-cache entries

Link to Devin session: https://staging.itsdev.in/sessions/cdf841e834eb419aa04168a565311f10
Requested by: @streamer45

Restore and save ~/.cache/sccache as a single GHA cache entry per
Cargo.lock revision.  This gives hosted runners compilation-level cache
hits without the per-artifact entry explosion caused by
SCCACHE_GHA_ENABLED (reverted in #373).

Strategy:
- actions/cache/restore before sccache-action starts (all hosted jobs)
- actions/cache/save at end of job, main-branch only (if: always())
- Self-hosted GPU jobs skipped — they already have persistent disk cache
- Plugins use a separate cache key prefix (sccache-plugins-*)

Closes #374

Signed-off-by: StreamKit Devin <devin@streamkit.dev>
Co-Authored-By: Claudio Costa <cstcld91@gmail.com>
@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor Author

staging-devin-ai-integration Bot commented Apr 25, 2026

✅ Reviewed on 7a21e12

View review

@staging-devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Contributor Author

@staging-devin-ai-integration staging-devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review (Staging)
Debug

Playground

@streamer45 streamer45 merged commit 4c9105f into main Apr 25, 2026
16 checks passed
@streamer45 streamer45 deleted the devin/1777128800-sccache-local-cache branch April 25, 2026 15:14
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.

ci: investigate sccache with external storage backend (S3/R2) for hosted runners

2 participants