Unverified Commit 324b2972 authored by Tobias Koppers's avatar Tobias Koppers Committed by GitHub

ci: run changed deploy tests with both builders (#100591)

### What?

Run new and changed deploy tests in PR CI for both deploy builders, and
fold the separate cache-components job into the same matrix:

- `builder`: `adapter` (`NEXT_ENABLE_ADAPTER=1`, current behavior) and
`non-adapter` (`NEXT_ENABLE_ADAPTER=0`)
- `cache-components`: `false` / `true` (replaces the separate
`test-new-tests-deploy-cache-components` job)

`test-new-tests-deploy` now runs group (5) × builder (2) × cache
components (2) = 20 entries. Per entry, the env and command are the same
as before:

- cache components off sets
`__NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true`
- cache components on sets `__NEXT_CACHE_COMPONENTS`,
`__NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS` and the combined
`NEXT_EXTERNAL_TESTS_FILTERS`

Adapter entries keep their existing `stepName`s, so their test-report
and Datadog history continues. Non-adapter entries get a `-non-adapter`
suffix. Job names include the variant, builder and group.

### Why?

The release deploy tests run both builders, but PR CI only checked new
and changed deploy tests against the adapter. Changes that behave
differently with the non-adapter builder were only caught after release.
A recent example is a `resume-data-cache.partial-prefetching` failure
that only showed up in the non-adapter Turbopack release shards.

### How?

- Parsed the workflow and expanded the matrix to 20 entries. Each
rendered `afterBuild` script was run in an empty environment with `node`
stubbed out. Every entry exports the same env and runs the same command,
`stepName` and display name as the matching entry from the previous two
jobs. The rest of the workflow is unchanged.
- `prettier --check .github/workflows/build_and_test.yml`

<!-- NEXT_JS_LLM -->


<!-- fleet 115592cd-38e9-4ec3-904b-f1c778e1e1d9 -->

---------
Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
parent 4a31419c
......@@ -894,7 +894,7 @@ jobs:
--timeout-minutes 30
test-new-tests-deploy:
name: Test new and changed tests when deployed
name: Test new and changed tests when deployed (${{ matrix.cache-components && 'cache components, ' || '' }}${{ matrix.builder }}, ${{ matrix.group }})
needs: ['optimize-ci', 'changes', 'wait-for-preview-tarball']
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
......@@ -902,6 +902,12 @@ jobs:
fail-fast: false
matrix:
group: [1/5, 2/5, 3/5, 4/5, 5/5]
# Deploy with the Next.js adapter (NEXT_ENABLE_ADAPTER=1) and with the
# non-adapter builder (NEXT_ENABLE_ADAPTER=0), like the release deploy
# tests do.
builder: [adapter, non-adapter]
# Run without and with cache components (__NEXT_CACHE_COMPONENTS=true).
cache-components: [false, true]
permissions:
contents: read
......@@ -912,42 +918,16 @@ jobs:
with:
# Keep Next.js related env variables in sync with additionalEnv in next-deploy.ts
afterBuild: |
export NEXT_ENABLE_ADAPTER=1
if [ "${{ matrix.cache-components }}" = "true" ]; then
export __NEXT_CACHE_COMPONENTS=true
export __NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true
export NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json,test/cache-components-tests-manifest.json"
else
export __NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true
fi
export NEXT_ENABLE_ADAPTER=${{ matrix.builder == 'adapter' && '1' || '0' }}
export NEXT_TEST_DEPLOY_TARGET_VERCEL=1
export NEXT_E2E_TEST_TIMEOUT=240000
export __NEXT_EXPERIMENTAL_STRICT_ROUTE_TYPES=true
export IS_TURBOPACK_TEST=1
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }}
stepName: 'test-new-tests-deploy-${{matrix.group}}'
secrets: inherit
test-new-tests-deploy-cache-components:
name: Test new and changed tests when deployed (cache components)
needs: ['optimize-ci', 'changes', 'wait-for-preview-tarball']
if: ${{ needs.optimize-ci.outputs.skip == 'false' && needs.changes.outputs.docs-only == 'false' }}
strategy:
fail-fast: false
matrix:
group: [1/5, 2/5, 3/5, 4/5, 5/5]
permissions:
contents: read
# Minting GitHub OIDC tokens to read private preview builds. Dormant in
# this repo since builds here are public.
id-token: write
uses: ./.github/workflows/build_reusable.yml
with:
afterBuild: |
export __NEXT_CACHE_COMPONENTS=true
export __NEXT_EXPERIMENTAL_CACHED_NAVIGATIONS=true
export NEXT_ENABLE_ADAPTER=1
export NEXT_TEST_DEPLOY_TARGET_VERCEL=1
export NEXT_EXTERNAL_TESTS_FILTERS="test/deploy-tests-manifest.json,test/cache-components-tests-manifest.json"
export NEXT_E2E_TEST_TIMEOUT=240000
export IS_TURBOPACK_TEST=1
# revalidatePath/revalidateTag invalidate at project scope, so this
# job deploys into its own project, separate from the plain deploy job.
......@@ -955,7 +935,7 @@ jobs:
node scripts/test-new-tests.mjs \
--mode deploy \
--group ${{ matrix.group }}
stepName: 'test-new-tests-deploy-cache-components-${{matrix.group}}'
stepName: "test-new-tests-deploy${{ matrix.cache-components && '-cache-components' || '' }}${{ matrix.builder == 'non-adapter' && '-non-adapter' || '' }}-${{matrix.group}}"
secrets: inherit
......@@ -1279,7 +1259,6 @@ jobs:
- test-new-tests-start
- wait-for-preview-tarball
- test-new-tests-deploy
- test-new-tests-deploy-cache-components
- test-turbopack-production
- test-unit-windows
- test-dev-windows
......
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