Files
vercel__next.js/.github/workflows/turbopack-benchmark.yml
Sebastian "Sebbie" Silbermann 988a6ab727 [ci] Authenticate Turborepo remote caching with OIDC instead of a static PAT (#97590)
CI authenticated to Vercel Remote Cache with a long-lived Personal
Access Token in the `TURBO_TOKEN` repository secret. That token never
expired, is scoped to a team member rather than the team, and is
readable by every job that inherits secrets.

Each job now mints its own short-lived, cache-only token instead, using
`vercel/setup-turborepo-remote-cache-action` against a Turborepo CLI
OIDC policy configured on the Vercel team following
https://vercel.com/docs/monorepos/remote-caching/external-ci-cd#openid-connect-oidc

Forks skip the step entirely since they won't have access to repository
variables. During outages or any other permission errors, the steps
outcome will simply be ignore and we fall back to uncached behavior.

This could lead to silent regressions or hiding new, incorrect callsites
lacking necessary permissions. A Datadog monitor is not as simple as I'd
like since DD does not track outcome but conclusion (which is always
success for continue-on-error). Adding custom tags via DD CLI feels to
heavy. We'll revisit if this becomes a recurring issue.
2026-08-20 10:16:10 +02:00

152 lines
4.8 KiB
YAML

name: Turbopack Benchmark
on:
workflow_dispatch:
push:
branches:
- canary
pull_request:
types: ['opened', 'reopened', 'synchronize', 'labeled']
paths:
- '**/crates/**'
- '**/Cargo.toml'
- '**/Cargo.lock'
concurrency:
# Limit concurrent runs to 1 per PR, but allow concurrent runs on canary branch
group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow, github.event.pull_request.number) || format('{0}-{1}-{2}', github.workflow, github.ref_name, github.run_id) }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
CI: 1
RUST_LOG: 'off'
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
# Prefer shared remote cache across runs, but keep local cache enabled so jobs
# degrade gracefully if the remote cache or token is unavailable.
TURBO_CACHE: 'local:rw,remote:rw'
permissions:
contents: read
id-token: write
jobs:
benchmark-small-apps:
name: Benchmark Rust Crates (small apps)
runs-on: ubuntu-latest-16-core-oss
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Rust toolchain
uses: ./.github/actions/setup-rust
- name: Install cargo-codspeed
run: cargo binstall --locked --no-confirm cargo-codspeed@3.0.5
- name: Set up Turborepo remote cache
if: ${{ vars.TURBO_TEAM != '' }}
continue-on-error: true
uses: vercel/setup-turborepo-remote-cache-action@135046f5efcadb17337d9b29b8d5b4035ae64b10 # v1.0.0
with:
team: ${{ vars.TURBO_TEAM }}
- name: Start sccache
uses: ./.github/actions/sccache
- name: Install pnpm dependencies
working-directory: turbopack/benchmark-apps
run: |
npm i -g corepack@0.31
corepack enable
pnpm install --loglevel error
- name: Build app build benchmarks
env:
CODSPEED_RUNNER_MODE: instrumentation
run: cargo codspeed build -p turbopack-cli small_apps
- name: Run the benchmarks
uses: CodSpeedHQ/action@1c8ae4843586d3ba879736b7f6b7b0c990757fab # v4.12.1
with:
mode: instrumentation
run: cargo codspeed run -p turbopack-cli small_apps
benchmark-analyzer:
name: Benchmark Rust Crates (analyzer)
runs-on: ubuntu-latest-16-core-oss
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Rust toolchain
uses: ./.github/actions/setup-rust
- name: Install cargo-codspeed
run: cargo binstall --locked --no-confirm cargo-codspeed@3.0.5
- name: Set up Turborepo remote cache
if: ${{ vars.TURBO_TEAM != '' }}
continue-on-error: true
uses: vercel/setup-turborepo-remote-cache-action@135046f5efcadb17337d9b29b8d5b4035ae64b10 # v1.0.0
with:
team: ${{ vars.TURBO_TEAM }}
- name: Start sccache
uses: ./.github/actions/sccache
- name: Install pnpm dependencies
working-directory: turbopack/benchmark-apps
run: |
npm i -g corepack@0.31
corepack enable
pnpm install --loglevel error
- name: Build app build benchmarks
env:
CODSPEED_RUNNER_MODE: instrumentation
run: cargo codspeed build -p turbopack-ecmascript references
- name: Run the benchmarks
uses: CodSpeedHQ/action@1c8ae4843586d3ba879736b7f6b7b0c990757fab # v4.12.1
with:
mode: instrumentation
run: cargo codspeed run -p turbopack-ecmascript references
benchmark-large:
name: Benchmark Rust Crates (large)
if: ${{ github.event.label.name == 'benchmark' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest-16-core-oss
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup Rust toolchain
uses: ./.github/actions/setup-rust
- name: Install cargo-codspeed
run: cargo binstall --locked --no-confirm cargo-codspeed@3.0.5
- name: Set up Turborepo remote cache
if: ${{ vars.TURBO_TEAM != '' }}
continue-on-error: true
uses: vercel/setup-turborepo-remote-cache-action@135046f5efcadb17337d9b29b8d5b4035ae64b10 # v1.0.0
with:
team: ${{ vars.TURBO_TEAM }}
- name: Start sccache
uses: ./.github/actions/sccache
- name: Build the benchmark target(s)
env:
CODSPEED_RUNNER_MODE: instrumentation
run: cargo codspeed build -p turbopack -p turbopack-bench
- name: Run the benchmarks
uses: CodSpeedHQ/action@1c8ae4843586d3ba879736b7f6b7b0c990757fab # v4.12.1
with:
mode: instrumentation
run: cargo codspeed run