Repository navigation
Conversation
sccache with the GitHub backend uploads one cache entry for each compiled crate. GitHub allows 200 uploads per minute for a repository, so sccache stored almost nothing. sccache now writes to a local folder that actions/cache saves once for each job and Cargo.lock, only on main. The registry caches follow the same rule. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
There was a problem hiding this comment.
Devin Review found 1 potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | ||
| with: | ||
| path: ${{ runner.temp }}/sccache | ||
| key: sccache-builds-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }} |
There was a problem hiding this comment.
🟡 Unrelated lockfiles invalidate compiler caches
When a standalone workspace updates its lockfile, hashFiles changes every build and test compiler cache key. Neither the API generator nor the fuzz workspace participates in these jobs. The next main run recompiles unchanged dependencies and uploads replacement archives.
Learn more
The build and test jobs compile the root SDK workspace. The API generator and fuzz project each declare a separate workspace and keep their own lockfiles. hashFiles('**/Cargo.lock', 'rust-toolchain.toml') includes those lockfiles in both compiler archive keys, including the test restore key. Main does not use a fallback key, so changing either independent lockfile discards all existing compiler cache hits even when the SDK's inputs are identical.
Example: A dependency update changes the API generator's Cargo.lock but leaves the root lockfile and Rust toolchain untouched. After merge, main restores none of the compiler archives from the preceding run.
Recommended fix: Use hashFiles('Cargo.lock', 'rust-toolchain.toml') in both compiler cache keys so they track only the lockfile and toolchain those jobs consume.
Was this helpful? React with 👍 or 👎 to provide feedback.
The folders of all 14 jobs are 9.0 GiB, measured in run 46877828990. A repository can keep 10 GB. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
sccache stores almost nothing in CI. In a Linux build job after #1760 and #1761, it failed to write 861 of 861 objects. The hit rate was 0% to 21% in the build jobs.
The cause: sccache with the GitHub backend uploads one cache entry for each compiled crate. A build job compiles about 860 units, and 14 jobs with sccache run at the same time. GitHub allows 200 cache uploads per minute for a repository and answers the rest with
429 Too Many Requests.Change
sccache writes to a local folder.
builds.ymlandtests.ymlno longer setSCCACHE_GHA_ENABLED.SCCACHE_DIRis a folder in the temp directory of the runner.actions/cache/restorerestores the folder before the build.actions/cache/savesaves it after the build, only onmainand only if the exact key did not exist.Cargo.lockandrust-toolchain.toml.mainrestores only the exact key. After a change ofCargo.lock, it builds from zero and saves a folder without the objects of older locks.Only 7 jobs keep a folder: the 3 test jobs and the 4 macOS and iOS build jobs. The folders of all 14 jobs are 9.0 GiB (see "Measured"), and a repository can keep 10 GB. The test jobs are the critical path of a run. The macOS jobs are the slowest build jobs. The other 7 build jobs use sccache only inside one run.
That is 7 uploads for each
Cargo.lockonmain, and none for a PR.The probe step is gone. It started the sccache server to test the GitHub backend. A local folder has no such failure.
The registry caches follow the same rule.
builds.yml,tests.ymlandfeature-combinations-curated.ymlsave the cargo registry only onmain. Before, each Renovate PR saved its own copies, 4.4 GB in 66 entries.A size report. Each job writes the size of its sccache folder to the job summary.
Measured
Run 46877828990 of this PR, before the limit to 7 jobs. sccache had 0 write errors and 0 read errors in all 14 jobs.
The 7 saved folders are 5.2 GiB.
Verified
actionlintpasses on the three workflows.Not done yet
main.main.mainthen saves a folder with fewer objects, and the key stays until the next change ofCargo.lock.main. The dependencies stay valid. The crates of this repository compile again in each PR.🤖 Generated with Claude Code