Unverified Commit 36a8f4c2 authored by Benjamin Woodruff's avatar Benjamin Woodruff Committed by GitHub

[ci] Use node-version-file when we already have a repository checkout and reduce…

[ci] Use node-version-file when we already have a repository checkout and reduce hardcoded references to node versions (#94780)

I noticed the `node-version-file` option for `setup-node` while
reviewing https://github.com/vercel/nextjs-react-compiler/pull/2

We should use it in places where we're already checking out the
repository anyways. It should make it easier to keep node versions in
sync.
parent cd1a292c
...@@ -23,7 +23,6 @@ env: ...@@ -23,7 +23,6 @@ env:
# --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default # --env-mode loose is a breaking change required with turbo 2.x since Strict mode is now the default
# TODO: we should add the relevant envs later to to switch to strict mode # TODO: we should add the relevant envs later to to switch to strict mode
TURBO_ARGS: '-v --env-mode loose --remote-cache-timeout 90 --summarize --log-order stream' TURBO_ARGS: '-v --env-mode loose --remote-cache-timeout 90 --summarize --log-order stream'
NODE_LTS_VERSION: 20
TURBO_TEAM: 'vtest314-next-adapter-e2e-tests' TURBO_TEAM: 'vtest314-next-adapter-e2e-tests'
# Prefer shared remote cache across runs, but keep local cache enabled so jobs # Prefer shared remote cache across runs, but keep local cache enabled so jobs
# degrade gracefully if the remote cache or token is unavailable. # degrade gracefully if the remote cache or token is unavailable.
...@@ -55,7 +54,7 @@ jobs: ...@@ -55,7 +54,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
- name: Setup corepack - name: Setup corepack
...@@ -121,10 +120,15 @@ jobs: ...@@ -121,10 +120,15 @@ jobs:
# canary next-swc binaries in the monorepo # canary next-swc binaries in the monorepo
NEXT_SKIP_NATIVE_POSTINSTALL: 1 NEXT_SKIP_NATIVE_POSTINSTALL: 1
steps: steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 25
persist-credentials: false
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
- name: Setup corepack - name: Setup corepack
...@@ -132,11 +136,6 @@ jobs: ...@@ -132,11 +136,6 @@ jobs:
npm i -g corepack@0.31 npm i -g corepack@0.31
corepack enable corepack enable
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 25
persist-credentials: false
- id: get-store-path - id: get-store-path
run: echo STORE_PATH=$(pnpm store path) >> $GITHUB_OUTPUT run: echo STORE_PATH=$(pnpm store path) >> $GITHUB_OUTPUT
...@@ -251,7 +250,7 @@ jobs: ...@@ -251,7 +250,7 @@ jobs:
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
if: ${{ !matrix.docker }} if: ${{ !matrix.docker }}
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
...@@ -472,7 +471,7 @@ jobs: ...@@ -472,7 +471,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
- run: corepack enable - run: corepack enable
...@@ -516,17 +515,6 @@ jobs: ...@@ -516,17 +515,6 @@ jobs:
- build-wasm - build-wasm
- build-native - build-native
steps: 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
# https://github.com/actions/virtual-environments/issues/1187 # https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network - name: tune linux network
run: sudo ethtool -K eth0 tx off rx off run: sudo ethtool -K eth0 tx off rx off
...@@ -543,6 +531,17 @@ jobs: ...@@ -543,6 +531,17 @@ jobs:
build-and-deploy-${{ github.sha }}-${{ github.run_number }} build-and-deploy-${{ github.sha }}-${{ github.run_number }}
build-and-deploy-${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}} build-and-deploy-${{ github.sha }}-${{ github.run_number }}-${{ github.run_attempt}}
- name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: .node-version
check-latest: true
package-manager-cache: false
- name: Setup corepack
run: |
npm i -g corepack@0.31
corepack enable
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with: with:
pattern: next-swc-binaries-* pattern: next-swc-binaries-*
......
...@@ -29,7 +29,7 @@ jobs: ...@@ -29,7 +29,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: 20 node-version: ${{ env.NODE_LTS_VERSION }}
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
- name: Setup corepack - name: Setup corepack
......
...@@ -32,7 +32,7 @@ jobs: ...@@ -32,7 +32,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: 20 node-version: ${{ env.NODE_LTS_VERSION }}
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
......
...@@ -15,7 +15,6 @@ concurrency: ...@@ -15,7 +15,6 @@ concurrency:
env: env:
NAPI_CLI_VERSION: 2.18.4 NAPI_CLI_VERSION: 2.18.4
TURBO_VERSION: 2.9.4 TURBO_VERSION: 2.9.4
NODE_LTS_VERSION: 20
TEST_CONCURRENCY: 6 TEST_CONCURRENCY: 6
TURBO_TEAM: 'vtest314-next-adapter-e2e-tests' TURBO_TEAM: 'vtest314-next-adapter-e2e-tests'
...@@ -159,7 +158,7 @@ jobs: ...@@ -159,7 +158,7 @@ jobs:
if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }} if: ${{ steps.docs-change.outputs.DOCS_CHANGE == 'nope' }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
package-manager-cache: false package-manager-cache: false
- name: Install dependencies - name: Install dependencies
......
...@@ -42,7 +42,7 @@ jobs: ...@@ -42,7 +42,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
...@@ -105,7 +105,7 @@ jobs: ...@@ -105,7 +105,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
......
...@@ -72,7 +72,7 @@ jobs: ...@@ -72,7 +72,7 @@ jobs:
if: steps.precheck.outputs.should_evaluate == 'true' if: steps.precheck.outputs.should_evaluate == 'true'
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: 20 node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
......
...@@ -15,7 +15,6 @@ on: ...@@ -15,7 +15,6 @@ on:
env: env:
TURBOPACK_BENCH_COUNTS: '100' TURBOPACK_BENCH_COUNTS: '100'
TURBOPACK_BENCH_PROGRESS: '1' TURBOPACK_BENCH_PROGRESS: '1'
NODE_LTS_VERSION: 20
TURBO_TEAM: 'vtest314-next-adapter-e2e-tests' TURBO_TEAM: 'vtest314-next-adapter-e2e-tests'
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
...@@ -41,7 +40,7 @@ jobs: ...@@ -41,7 +40,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
- run: corepack enable - run: corepack enable
......
...@@ -51,10 +51,16 @@ jobs: ...@@ -51,10 +51,16 @@ jobs:
outputs: outputs:
next-version: ${{ steps.version.outputs.value }} next-version: ${{ steps.version.outputs.value }}
steps: steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 25
persist-credentials: false
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
...@@ -63,12 +69,6 @@ jobs: ...@@ -63,12 +69,6 @@ jobs:
npm i -g corepack@0.31 npm i -g corepack@0.31
corepack enable corepack enable
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 25
persist-credentials: false
- id: nextPackageInfo - id: nextPackageInfo
name: Get `next` package info name: Get `next` package info
run: | run: |
......
...@@ -12,7 +12,6 @@ env: ...@@ -12,7 +12,6 @@ env:
VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }} VERCEL_TEST_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }}
VERCEL_ADAPTER_TEST_TEAM: vtest314-next-adapter-e2e-tests VERCEL_ADAPTER_TEST_TEAM: vtest314-next-adapter-e2e-tests
VERCEL_ADAPTER_TEST_TOKEN: ${{ secrets.VERCEL_ADAPTER_TEST_TOKEN }} VERCEL_ADAPTER_TEST_TOKEN: ${{ secrets.VERCEL_ADAPTER_TEST_TOKEN }}
NODE_LTS_VERSION: 20
TURBO_TEAM: 'vtest314-next-adapter-e2e-tests' TURBO_TEAM: 'vtest314-next-adapter-e2e-tests'
# Prefer shared remote cache across runs, but keep local cache enabled so jobs # Prefer shared remote cache across runs, but keep local cache enabled so jobs
# degrade gracefully if the remote cache or token is unavailable. # degrade gracefully if the remote cache or token is unavailable.
...@@ -26,10 +25,16 @@ jobs: ...@@ -26,10 +25,16 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.repository_owner == 'vercel' if: github.repository_owner == 'vercel'
steps: steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 25
persist-credentials: false
- name: Setup Node.js - name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
...@@ -38,12 +43,6 @@ jobs: ...@@ -38,12 +43,6 @@ jobs:
npm i -g corepack@0.31 npm i -g corepack@0.31
corepack enable corepack enable
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 25
persist-credentials: false
- name: Install dependencies - name: Install dependencies
run: pnpm install run: pnpm install
......
...@@ -38,7 +38,7 @@ jobs: ...@@ -38,7 +38,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: 20 node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
- name: Setup corepack - name: Setup corepack
......
...@@ -49,7 +49,7 @@ jobs: ...@@ -49,7 +49,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: 20 node-version: ${{ env.NODE_LTS_VERSION }}
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
......
...@@ -42,7 +42,7 @@ jobs: ...@@ -42,7 +42,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
...@@ -101,7 +101,7 @@ jobs: ...@@ -101,7 +101,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
......
...@@ -7,9 +7,6 @@ on: ...@@ -7,9 +7,6 @@ on:
# Allow manual runs # Allow manual runs
workflow_dispatch: workflow_dispatch:
env:
NODE_LTS_VERSION: 20
jobs: jobs:
create-pull-request: create-pull-request:
runs-on: ubuntu-latest runs-on: ubuntu-latest
...@@ -44,7 +41,7 @@ jobs: ...@@ -44,7 +41,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
......
...@@ -14,7 +14,6 @@ on: ...@@ -14,7 +14,6 @@ on:
required: false required: false
env: env:
NODE_LTS_VERSION: 20
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
jobs: jobs:
...@@ -50,7 +49,7 @@ jobs: ...@@ -50,7 +49,7 @@ jobs:
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
......
...@@ -18,18 +18,18 @@ jobs: ...@@ -18,18 +18,18 @@ jobs:
name: Upload test results name: Upload test results
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup node - name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with: with:
node-version: ${{ env.NODE_LTS_VERSION }} node-version-file: .node-version
check-latest: true check-latest: true
package-manager-cache: false package-manager-cache: false
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup corepack - name: Setup corepack
run: | run: |
npm i -g corepack@0.31 npm i -g corepack@0.31
......
...@@ -9,9 +9,6 @@ on: ...@@ -9,9 +9,6 @@ on:
workflows: ['build-and-deploy'] workflows: ['build-and-deploy']
types: [completed] types: [completed]
env:
NODE_LTS_VERSION: 20
permissions: permissions:
actions: read actions: read
contents: read contents: read
...@@ -23,13 +20,6 @@ jobs: ...@@ -23,13 +20,6 @@ jobs:
if: github.event.workflow_run.conclusion == 'success' if: github.event.workflow_run.conclusion == 'success'
environment: preview-builds environment: preview-builds
steps: 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
# Checkout from the default branch (canary) -- workflow_run always uses # Checkout from the default branch (canary) -- workflow_run always uses
# the default branch's version of the workflow file and this checkout # the default branch's version of the workflow file and this checkout
# matches that, ensuring the upload script is trusted. # matches that, ensuring the upload script is trusted.
...@@ -39,6 +29,13 @@ jobs: ...@@ -39,6 +29,13 @@ jobs:
fetch-depth: 1 fetch-depth: 1
persist-credentials: false persist-credentials: false
- name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: .node-version
check-latest: true
package-manager-cache: false
- name: Enable corepack - name: Enable corepack
run: corepack enable run: corepack enable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment