Code Freeze workflow (vercel/next.js)
The Code Freeze workflow from vercel/next.js, explained and optimized by Latchkey.
- C
- CI health grade
- 69/100
- Health score
- 1
- Job per trigger
- 3
- Fixes in the optimized version
In short
- CI health: C (fair)
- The optimized version below points runs-on at Latchkey managed runners and adds caching and job timeouts.
What it does
This is the Code Freeze workflow from the vercel/next.js repository, a real project running GitHub Actions. It is shown here with attribution under its MIT license.
Below, Latchkey shows a faster, safer version produced by its optimization engine.
The workflow
on:
workflow_dispatch:
inputs:
type:
description: Enable/disable code freeze
required: true
type: choice
options:
- enable
- disable
secrets:
CODE_FREEZE_TOKEN:
required: true
name: Code Freeze
env:
NAPI_CLI_VERSION: 2.18.4
TURBO_VERSION: 2.9.4
NODE_LTS_VERSION: 20
jobs:
start:
runs-on: ubuntu-latest
environment: release-${{ github.event.inputs.releaseType }}
steps:
- name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: ${{ env.NODE_LTS_VERSION }}
check-latest: true
package-manager-cache: false
- name: Setup corepack
run: |
npm i -g corepack@0.31
corepack enable
- run: git clone https://github.com/vercel/next.js.git --depth=1 .
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- run: node ./scripts/code-freeze.js --type "${INPUT_TYPE}"
env:
CODE_FREEZE_TOKEN: ${{ secrets.CODE_FREEZE_TOKEN }}
INPUT_TYPE: ${{ github.event.inputs.type }}The same workflow, on Latchkey
Estimated ~20% faster on cache hits, plus fewer wasted runs and a safer supply chain. Added and changed lines are highlighted.
on:
workflow_dispatch:
inputs:
type:
description: Enable/disable code freeze
required: true
type: choice
options:
- enable
- disable
secrets:
CODE_FREEZE_TOKEN:
required: true
name: Code Freeze
env:
NAPI_CLI_VERSION: 2.18.4
TURBO_VERSION: 2.9.4
NODE_LTS_VERSION: 20
jobs:
start:
runs-on: ubuntu-latest
timeout-minutes: 30
runs-on: latchkey-small
environment: release-${{ github.event.inputs.releaseType }}
steps:
- name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
cache: 'npm'
node-version: ${{ env.NODE_LTS_VERSION }}
check-latest: true
package-manager-cache: false
- name: Setup corepack
run: |
npm i -g corepack@0.31
corepack enable
- run: git clone https://github.com/vercel/next.js.git --depth=1 .
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- run: node ./scripts/code-freeze.js --type "${INPUT_TYPE}"
env:
CODE_FREEZE_TOKEN: ${{ secrets.CODE_FREEZE_TOKEN }}
INPUT_TYPE: ${{ github.event.inputs.type }}
What changed
- Run on Latchkey managed runners with one line (
runs-on), which apply the fixes below automatically and self-heal transient failures. Each Linux x64 job moves to the Latchkey size matching its vCPU count,latchkey-smallfor a standard 2 vCPU runner; macOS, Windows and arm64 jobs stay as written. - Cache dependency installs on the setup step so they are served from cache.
- Add a job timeout so a hung step cannot burn hours of runner time.
This workflow runs 1 job per trigger. It runs on a standard GitHub-hosted Linux x64 runner, which in a private repository bills $0.006 a minute against $0.0025 on latchkey-small, 58% lower; in a public repository like this one it is free. Estimate the monthly difference with your own run counts.
Actions used in this workflow
- actions/setup-node