Unverified Commit da06078b authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by GitHub

test: Fix immutable static asset deployment tests for real (#95600)

https://github.com/vercel/next.js/pull/95550 wasn't enough:

-
https://github.com/vercel/next.js/actions/runs/28907225463/job/85769093204
-
https://github.com/vercel/next.js/actions/runs/28907225463/job/85769093252

Because `VERCEL_IMMUTABLE_STATIC_FILES_ENABLED` might be set, but it
still only works when using adapters, so it broke in the non-adapter
deploy test jobs.

Also prepare for when we switch the default of `NEXT_ENABLE_ADAPTER` by
setting it explicitly to `0` for when we want to test the old CLI
builder.
parent b4b909bc
...@@ -124,6 +124,7 @@ jobs: ...@@ -124,6 +124,7 @@ jobs:
NEXT_E2E_TEST_TIMEOUT=240000 \ NEXT_E2E_TEST_TIMEOUT=240000 \
NEXT_TEST_MODE=deploy \ NEXT_TEST_MODE=deploy \
IS_WEBPACK_TEST=1 \ IS_WEBPACK_TEST=1 \
NEXT_ENABLE_ADAPTER=0 \
NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" \ NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" \
NEXT_TEST_VERSION="${{ github.event.inputs.nextVersion || needs.setup.outputs.next-version || 'canary' }}" \ NEXT_TEST_VERSION="${{ github.event.inputs.nextVersion || needs.setup.outputs.next-version || 'canary' }}" \
VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" \ VERCEL_CLI_VERSION="${{ github.event.inputs.vercelCliVersion || 'vercel@latest' }}" \
...@@ -168,6 +169,7 @@ jobs: ...@@ -168,6 +169,7 @@ jobs:
NEXT_E2E_TEST_TIMEOUT=240000 \ NEXT_E2E_TEST_TIMEOUT=240000 \
NEXT_TEST_MODE=deploy \ NEXT_TEST_MODE=deploy \
IS_TURBOPACK_TEST=1 \ IS_TURBOPACK_TEST=1 \
NEXT_ENABLE_ADAPTER=0 \
NEXT_TEST_CONTINUE_ON_ERROR="${{ github.event.inputs.continueOnError || false }}" \ NEXT_TEST_CONTINUE_ON_ERROR="${{ github.event.inputs.continueOnError || false }}" \
NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" \ NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json" \
NEXT_TEST_VERSION="${{ github.event.inputs.nextVersion || needs.setup.outputs.next-version || 'canary' }}" \ NEXT_TEST_VERSION="${{ github.event.inputs.nextVersion || needs.setup.outputs.next-version || 'canary' }}" \
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
const isAdapterTest = Boolean(process.env.NEXT_ENABLE_ADAPTER) const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
describe('not-found-with-pages-i18n', () => { describe('not-found-with-pages-i18n', () => {
const { next, isNextStart, isNextDeploy } = nextTestSetup({ const { next, isNextStart, isNextDeploy } = nextTestSetup({
......
...@@ -2,7 +2,7 @@ import cheerio from 'cheerio' ...@@ -2,7 +2,7 @@ import cheerio from 'cheerio'
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import { splitResponseWithPPRSentinel } from 'e2e-utils/ppr' import { splitResponseWithPPRSentinel } from 'e2e-utils/ppr'
const isAdapterTest = Boolean(process.env.NEXT_ENABLE_ADAPTER) const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
describe('partial-fallback-root-blocking', () => { describe('partial-fallback-root-blocking', () => {
const { next, isNextDev, isNextDeploy } = nextTestSetup({ const { next, isNextDev, isNextDeploy } = nextTestSetup({
......
...@@ -4,7 +4,7 @@ import { splitResponseWithPPRSentinel } from 'e2e-utils/ppr' ...@@ -4,7 +4,7 @@ import { splitResponseWithPPRSentinel } from 'e2e-utils/ppr'
import { retry, waitFor } from 'next-test-utils' import { retry, waitFor } from 'next-test-utils'
import path from 'path' import path from 'path'
const isAdapterTest = Boolean(process.env.NEXT_ENABLE_ADAPTER) const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
type NextInstance = ReturnType<typeof nextTestSetup>['next'] type NextInstance = ReturnType<typeof nextTestSetup>['next']
......
...@@ -3,7 +3,7 @@ import * as cheerio from 'cheerio' ...@@ -3,7 +3,7 @@ import * as cheerio from 'cheerio'
import { getCacheHeader, retry } from 'next-test-utils' import { getCacheHeader, retry } from 'next-test-utils'
import { computeCacheBustingSearchParam } from 'next/dist/shared/lib/router/utils/cache-busting-search-param' import { computeCacheBustingSearchParam } from 'next/dist/shared/lib/router/utils/cache-busting-search-param'
const isAdapterTest = Boolean(process.env.NEXT_ENABLE_ADAPTER) const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
describe('middleware-static-rewrite', () => { describe('middleware-static-rewrite', () => {
const { next, isNextDeploy, isNextDev } = nextTestSetup({ const { next, isNextDeploy, isNextDev } = nextTestSetup({
......
import { nextTestSetup } from 'e2e-utils' import { nextTestSetup } from 'e2e-utils'
import * as cheerio from 'cheerio' import * as cheerio from 'cheerio'
const isAdapterTest = Boolean(process.env.NEXT_ENABLE_ADAPTER) const isAdapterTest = process.env.NEXT_ENABLE_ADAPTER === '1'
describe('sub-shell-generation', () => { describe('sub-shell-generation', () => {
const { next, isNextDev, isNextDeploy } = nextTestSetup({ const { next, isNextDev, isNextDeploy } = nextTestSetup({
......
...@@ -310,7 +310,7 @@ export class NextInstance { ...@@ -310,7 +310,7 @@ export class NextInstance {
? // since we can't get the build id as a build artifact, ? // since we can't get the build id as a build artifact,
// add it in build logs // add it in build logs
{ {
'post-build': `node -e 'console.log("BUILD" + "_ID: " + fs.readFileSync("${this.distDir}/BUILD_ID") + "\\nDEPLOYMENT" + "_ID: " + process.env.NEXT_DEPLOYMENT_ID + "\\nNEXT_SUPPORTS_IMMUTABLE" + "_ASSETS: " + (process.env.VERCEL_IMMUTABLE_STATIC_FILES_ENABLED ? 1 : 0))'`, 'post-build': `node -e 'console.log("BUILD" + "_ID: " + fs.readFileSync("${this.distDir}/BUILD_ID") + "\\nDEPLOYMENT" + "_ID: " + process.env.NEXT_DEPLOYMENT_ID + "\\nNEXT_SUPPORTS_IMMUTABLE" + "_ASSETS: " + ((process.env.VERCEL_IMMUTABLE_STATIC_FILES_ENABLED && process.env.NEXT_ENABLE_ADAPTER==="1") ? 1 : 0))'`,
} }
: {}), : {}),
...pkgScripts, ...pkgScripts,
......
...@@ -325,7 +325,7 @@ export class NextDeployInstance extends NextInstance { ...@@ -325,7 +325,7 @@ export class NextDeployInstance extends NextInstance {
} }
const vercelFlags: string[] = [] const vercelFlags: string[] = []
const NEXT_ENABLE_ADAPTER = process.env.NEXT_ENABLE_ADAPTER const NEXT_ENABLE_ADAPTER = process.env.NEXT_ENABLE_ADAPTER === '1'
const IS_TURBOPACK_TEST = process.env.IS_TURBOPACK_TEST const IS_TURBOPACK_TEST = process.env.IS_TURBOPACK_TEST
const TEST_TEAM_NAME = NEXT_ENABLE_ADAPTER const TEST_TEAM_NAME = NEXT_ENABLE_ADAPTER
...@@ -432,7 +432,7 @@ export class NextDeployInstance extends NextInstance { ...@@ -432,7 +432,7 @@ export class NextDeployInstance extends NextInstance {
if (process.env.IS_WEBPACK_TEST) { if (process.env.IS_WEBPACK_TEST) {
additionalEnv.push(`IS_WEBPACK_TEST=1`) additionalEnv.push(`IS_WEBPACK_TEST=1`)
} }
if (process.env.NEXT_ENABLE_ADAPTER) { if (NEXT_ENABLE_ADAPTER) {
additionalEnv.push(`NEXT_ENABLE_ADAPTER=1`) additionalEnv.push(`NEXT_ENABLE_ADAPTER=1`)
} else { } else {
additionalEnv.push(`NEXT_ENABLE_ADAPTER=0`) additionalEnv.push(`NEXT_ENABLE_ADAPTER=0`)
......
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