Unverified Commit 9c1c1b1c authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[lts-maintenance][ci] Wire preview builds variables consistently (#99325)

Backports https://github.com/vercel/next.js/pull/99323

## test plan

- [x] [test_e2e_deploy_release
run](https://github.com/vercel/next.js/actions/runs/36347199201)
Co-authored-by: 's avatarClaude Code (kimi-k3[1m]) <noreply@anthropic.com>
parent def7eff9
......@@ -630,8 +630,7 @@ jobs:
node scripts/test-new-tests.mjs \
--flake-detection \
--mode dev \
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
--group ${{ matrix.group }}
stepName: 'test-new-tests-dev-${{matrix.group}}'
timeout_minutes: 60 # Increase the default timeout as tests are intentionally run multiple times to detect flakes
......@@ -656,8 +655,7 @@ jobs:
node scripts/test-new-tests.mjs \
--flake-detection \
--mode start \
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
--group ${{ matrix.group }}
stepName: 'test-new-tests-start-${{matrix.group}}'
timeout_minutes: 60 # Increase the default timeout as tests are intentionally run multiple times to detect flakes
secrets: inherit
......@@ -684,8 +682,7 @@ jobs:
export GH_PR_NUMBER=${{ github.event.pull_request && github.event.pull_request.number || '' }}
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }} \
--preview-builds-base-url "${{ vars.PREVIEW_BUILDS_BASE_URL }}"
--group ${{ matrix.group }}
stepName: 'test-new-tests-deploy-${{matrix.group}}'
secrets: inherit
......
......@@ -105,6 +105,7 @@ env:
NEXT_TEST_PREFER_OFFLINE: 1
NEXT_CI_RUNNER: ${{ inputs.runs_on_labels }}
PREVIEW_BUILDS_ACCESS: ${{ vars.PREVIEW_BUILDS_ACCESS }}
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: ${{ vars.PREVIEW_BUILDS_BASE_URL }}
jobs:
build:
......
......@@ -103,7 +103,7 @@ jobs:
matrix:
group: [1/6, 2/6, 3/6, 4/6, 5/6, 6/6]
with:
afterBuild: npm i -g vercel@latest && NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=deploy NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" NEXT_TEST_VERSION="${{ needs.setup.outputs.next-version }}" VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" NEXT_TEST_PREVIEW_BUILDS_BASE_URL="${{ vars.PREVIEW_BUILDS_BASE_URL }}" node run-tests.js --timings -g ${{ matrix.group }} -c 2 --type e2e
afterBuild: npm i -g vercel@latest && NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_MODE=deploy NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" NEXT_TEST_VERSION="${{ needs.setup.outputs.next-version }}" VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" node run-tests.js --timings -g ${{ matrix.group }} -c 2 --type e2e
skipNativeBuild: 'yes'
skipNativeInstall: 'no'
stepName: 'test-deploy-${{ matrix.group }}'
......
......@@ -46,14 +46,14 @@ async function main() {
let argv = await yargs(process.argv.slice(2))
.string('mode')
.string('group')
.string('preview-builds-base-url')
.boolean('flake-detection').argv
let testMode = argv.mode
const isFlakeDetectionMode = argv['flake-detection']
const attempts = isFlakeDetectionMode ? 3 : 1
const previewBuildsBaseUrl =
argv['preview-builds-base-url'] || 'https://vercel-packages.vercel.app/next'
process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL ||
'https://vercel-packages.vercel.app/next'
if (testMode && !['dev', 'deploy', 'start'].includes(testMode)) {
throw new Error(
......@@ -194,7 +194,6 @@ async function main() {
env: {
...process.env,
NEXT_TEST_MODE: testMode,
NEXT_TEST_PREVIEW_BUILDS_BASE_URL: previewBuildsBaseUrl,
NEXT_TEST_VERSION: nextTestVersion,
IS_TURBOPACK_TEST: '1',
TURBOPACK_BUILD: testMode === 'start' ? '1' : undefined,
......
import { nextTestSetup } from 'e2e-utils'
// increment to trigger deploy tests: v1
describe('hello-world', () => {
const { next } = nextTestSetup({
files: __dirname,
......
......@@ -186,9 +186,15 @@ export class NextDeployInstance extends NextInstance {
const baseUrlRaw = process.env.NEXT_TEST_PREVIEW_BUILDS_BASE_URL
const access = process.env.PREVIEW_BUILDS_ACCESS
if (!baseUrlRaw || access !== 'private') {
if (access !== 'private') {
require('console').log(
`Skipping .npmrc write for preview-builds mirror: missing base URL or preview builds are public`
`Skipping .npmrc write for preview-builds mirror: preview builds are public`
)
return
}
if (!baseUrlRaw) {
require('console').warn(
`Skipping .npmrc write for preview-builds mirror: PREVIEW_BUILDS_ACCESS=private but NEXT_TEST_PREVIEW_BUILDS_BASE_URL is not set, so the remote build cannot authenticate to the mirror`
)
return
}
......
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