Files
vercel__next.js/scripts/rust-fingerprint.js
Benjamin Woodruff 3caee03f2a [ci] Reduce usage of turborepo cache in build_and_deploy.yml (#94319)
We're consolidating on `actions/cache` now that we got rid of
self-hosted runners. This doesn't remove all of the uses of turborepo's
cache (notably sccache), but this does eliminate the remote turborepo
cache for the native build cache and the docker image.

These build steps use docker so that we're building against an old
pinned glibc (2.31), and so that we can have access to both `aarch64`
and `x86_64` musl sysroots.

## Testing

**Local Build:** `node scripts/docker-native-build.js` still works (this
script just exists for being able to debug these builds locally)

**CI Build:**
- Run an automated-preview CI job, but cancel it before the native build
succeeds to test writing to the docker cache but not the native cache:
https://github.com/vercel/next.js/actions/runs/26986955366/job/79638633136?pr=94319
- Re-run the job with only the docker image cache, see that we get a
cache hit for the docker image:
https://github.com/vercel/next.js/actions/runs/26986955366/job/79639365126?pr=94319
- Re-run the job again and see that we hit the native build cache hit
and don't touch docker at all:
https://github.com/vercel/next.js/actions/runs/26986955366/job/79647324952?pr=94319
- Manually trigger the job to do a full preview build:
https://github.com/vercel/next.js/actions/runs/26989861549
2026-06-10 14:23:18 -07:00

21 lines
750 B
JavaScript

#!/usr/bin/env node
// Write the turbo-computed TURBO_HASH to a stamp file.
// This is used as a turbo task whose only purpose is to compute
// a fingerprint of all Rust inputs. The build_and_deploy workflow
// reads this stamp to derive the actions/cache key for the compiled
// next-swc native binary without re-hashing everything.
const fs = require('fs')
const path = require('path')
const stamp = path.resolve(__dirname, '..', 'target', '.rust-fingerprint')
if (!process.env.TURBO_HASH) {
console.log('rust-fingerprint: skipping (not running under turbo)')
process.exit(0)
}
fs.mkdirSync(path.dirname(stamp), { recursive: true })
fs.writeFileSync(stamp, process.env.TURBO_HASH)
console.log(`rust-fingerprint: ${process.env.TURBO_HASH}`)