Files
Matt Mastracci f98a3f1101 [turbopack] Rust dependency caching via sccache (#91873)
## What

Use sccache, backed by the Vercel artifact cache, when compiling Rust
code.

## Why

Each CI runner compiles ~960 external Rust crates from scratch (~5 min)
on binary cache misses, even though `Cargo.lock` rarely changes between
commits. Some workflows don't cache and always build from scratch.

## Notes

Builds will use a local cache on each runner, but we've got a lot of
these runners and they'll take some time to populate that local, fastest
level of cache.

Windows builds are currently hitting ~68% of cached compilations for a
reason that isn't totally clear. Linux builds are caching correctly,
however. A follow-up pass at this work will use an incremental turborepo
caching strategy to improve this, and another pass will experiment with
cross-compiling Windows from Linux which will likely also help.

Linux builds that don't change Rust files at all are nearly
instantaneous (as before), and Linux builds that change Rust files will
complete in approximately 1/2 the time. `check` builds are ~1min faster
(~25% faster).

LTO-heavy runs like the benchmark builders are currently still slow
(approx unchanged), needs further investigation (may be related to git
hash embedding?).
2026-04-09 18:42:03 +00:00

16 lines
479 B
JavaScript

const { execFileSync } = require('child_process')
const path = require('path')
const fs = require('fs')
const isPost = !!process.env.STATE_isPost
// Signal to the post phase that main ran
fs.appendFileSync(process.env.GITHUB_STATE, 'isPost=true\n')
const script = path.join(__dirname, isPost ? 'stop.sh' : 'start.sh')
try {
execFileSync('bash', [script], { stdio: 'inherit', env: process.env })
} catch (e) {
if (isPost) return // don't fail the job on cleanup
throw e
}