Skip to content

ci: re-enable template builds#16880

Merged
denolfe merged 3 commits into
mainfrom
ci/re-enable-template-builds
Jun 4, 2026
Merged

ci: re-enable template builds#16880
denolfe merged 3 commits into
mainfrom
ci/re-enable-template-builds

Conversation

@denolfe

@denolfe denolfe commented Jun 4, 2026

Copy link
Copy Markdown
Member

Overview

Re-enables the build-and-test-templates CI job, disabled in #16371 while it required a published 4.x release of the workspace packages on npm.

The job now builds templates against fully local packages and runs non-blocking, so it surfaces template breakage on 4.x without gating PRs.

Key Changes

  • Re-enabled the job, non-blocking

    • Restored if: needs.changes.outputs.needs_build == 'true' (was if: false) and added continue-on-error: true, matching the existing tests-content-api pattern. Failures show up in CI but do not fail the all-green gate until templates are updated for 4.x breaking changes.
  • Made the local package install hermetic

    • The build now packs all workspace packages (script:pack --all) and rewrites build-template-with-local-pkgs to point every @payloadcms/* (and payload) dependency at its local file: tarball, in both the dependency entries and pnpm.overrides, before a single install.

Design Decisions

The previous flow ran pnpm add ./*.tgz before setting overrides. That first install resolved the tarballs' internal cross-dependencies (@payloadcms/translations, @payloadcms/plugin-cloud-storage, and others) from npm at the in-repo version, which during 4.x beta is unpublished, so it failed with ERR_PNPM_NO_MATCHING_VERSION. That is what kept the job disabled.

Setting file: overrides for the full set of packed packages up front forces every workspace dependency, direct and transitive, to resolve to a local tarball. The install no longer touches npm for any @payloadcms package, so the job works regardless of what is published. This mirrors the approach already used by test/setupProd.ts for the prod E2E job.

Templates still pin the 3.x config API (for example, storage adapters passed to plugins rather than the 4.x storage array), so the builds currently fail once packages resolve. Running the job non-blocking surfaces that work without holding up merges; the continue-on-error flag comes off once the templates are migrated.

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

📦 esbuild Bundle Analysis for payload

This analysis was generated by esbuild-bundle-analyzer. 🤖
This PR introduced no changes to the esbuild bundle! 🙌

@denolfe denolfe marked this pull request as ready for review June 4, 2026 19:32
@denolfe denolfe merged commit 1f33cc8 into main Jun 4, 2026
163 of 169 checks passed
@denolfe denolfe deleted the ci/re-enable-template-builds branch June 4, 2026 19:46
denolfe added a commit that referenced this pull request Jun 5, 2026
# Overview

The `build-and-test-templates` CI job was disabled while 4.x breaking
changes landed, so the templates drifted and no longer build against
current core packages. This updates each template to the new 4.x APIs so
they build again.

CI for the re-enabled job:
[#16880](#16880).

## Key Changes

- **Storage adapters moved from `plugins` to `storage`**
- 4.x initializes storage adapters from a top-level `storage` array
instead of `plugins` (#16596). `vercelBlobStorage` / `r2Storage` calls
were relocated in `with-vercel-mongodb`, `with-vercel-postgres`,
`with-vercel-website`, and `with-cloudflare-d1`. This was the source of
the `TypeError: plugin is not a function` failures. Applied with
`@payloadcms/codemod`'s `migrate-storage-adapters-to-config`.

- **Import maps point at `@payloadcms/ui` instead of removed
`@payloadcms/next` subpaths**
- The `@payloadcms/next/rsc` and `@payloadcms/next/client` subpaths were
removed; generated import maps now reference `@payloadcms/ui/rsc` and
`@payloadcms/ui`. Applied with `@payloadcms/codemod`'s
`migrate-next-subpath-exports` across all templates.

- **Bare `src/` imports replaced with the `@/` path alias**
- Website-based templates imported from `src/...`, which no longer
resolves under Turbopack. Switched to the configured `@/` alias (maps to
`./src/*`).

- **Slug generic dropped on `Pages` / `Posts` (TypeScript 6 regression
workaround)**
- The documented `CollectionConfig<'pages'>` + `defaultPopulate` pattern
compiled under TypeScript 5.7 (3.x) but not under TypeScript 6.0.3 (the
#16692 bump): the generated select interface is no longer assignable to
the `SelectType` that the `collections` array element expects. Dropping
the generic lets `defaultPopulate` fall back to `SelectType` so the
templates build, at the cost of field-name checking on
`defaultPopulate`. This is a core type regression that affects any 4.x
project using the pattern under TS 6, so the real fix belongs in core;
the templates carry a commented workaround to be reverted once that
lands.

## Design Decisions

Most changes were applied with `@payloadcms/codemod` rather than by
hand, so the same transforms users will run produce the same result.
Import maps are left as the minimal subpath rewrite rather than a full
local regeneration, since `payload build` regenerates them during the
build.

Scope is template builds. All six matrix templates build with packed
local packages, verified locally via `script:pack --all` +
`build-template-with-local-pkgs`.

The remaining E2E failures on `blank` and `website`
(`chunk.reason.enqueueModel is not a function` when loading the admin
under `next dev`) are a pre-existing runtime issue, present before this
change and unrelated to the build fixes. Only the workspace templates
(`blank`, `website`, `ecommerce`) run E2E in this job; `pnpm --filter`
does not match the non-workspace templates, so their E2E and int steps
currently no-op.


---
- To see the specific tasks where the Asana app for GitHub is being
used, see below:
  - https://app.asana.com/0/0/1215426886664378
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants