Skip to content

IBX-11919: Build CI assets with yarn encore prod - #143

Open
micszo wants to merge 2 commits into
mainfrom
IBX-11919-encore-prod-on-ci
Open

IBX-11919: Build CI assets with yarn encore prod#143
micszo wants to merge 2 commits into
mainfrom
IBX-11919-encore-prod-on-ci

Conversation

@micszo

@micszo micszo commented Aug 25, 2026

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-11919

Related PRs:

ibexa/gh-workflows#112 — companion PR, updates the equivalent composer run post-install-cmd call sites in the shared browser-tests.yml reusable workflow with the same two-step approach.
Regression run: ibexa/oss#290

Description:

Browser-tests CI (used by ibexa/oss, ibexa/headless, ibexa/experience, ibexa/commerce via ibexa/gh-workflows) runs the whole app under APP_ENV=behat. ibexa:encore:compile (see Ibexa\Bundle\AdminUi\Command\CompileAssetsCommand) only runs yarn encore prod when the console's ambient --env option equals prod; that option defaults to APP_ENV. Since CI never sets APP_ENV=prod, every asset build triggered by composer run post-install-cmd on CI silently compiled with yarn encore dev, on every edition and version.

Initial approach (superseded): overriding APP_ENV=prod on the whole composer run post-install-cmd exec call. A regression run (ibexa/oss#290) caught that this breaks Behat: composer run post-install-cmd also runs cache:clear first (via @auto-scripts), and forcing that to boot the Symfony kernel under prod excludes IbexaBehatBundle (registered only for the behat env in config/bundles.php) from kernel.bundles_metadata. That silently drops ibexa/behat's encore config (transition-listener.js) from the generated var/encore/*.js manifest, so the compiled admin-ui bundle never adds the ibexa-selenium-transition-* marker classes that Behat's transition-wait conditions poll for — every scenario using ElementTransitionHasEndedCondition (e.g. IbexaDropdown::verifyIsLoaded()) then fails with TimeoutException: Transition has not started at all.

Current approach: leave composer run post-install-cmd unmodified, so cache:clear keeps booting under the existing behat env and the generated var/encore/*.js manifest stays correct (includes ibexa/behat's contribution). Immediately after, run the production asset build as a separate, plain yarn encore prod --config-name app && yarn encore prod call — this never boots the Symfony kernel, so it can't re-trigger the bundle-discovery bug, while still producing a genuine yarn encore prod build (mirrors the exact two-step ibexa:encore:compile --config-name app + ibexa:encore:compile sequence composer's @auto-scripts already runs).

Scoped to the currently active version scripts: 4.6.x-dev, 5.0.x-dev, 6.0.x-dev, stable. Left 4.0.x-dev through 4.5.x-dev and ^3.3.x-dev untouched (EOL).

For QA:

  • Trigger a browser-tests regression run ([TMP] Run regression oss#290) against this branch's ci-scripts ref and confirm assets are built with yarn encore prod (not dev).
  • First regression run (all 3 oss setups against the initial -e APP_ENV=prod approach) failed with isIbexaDropdownVisible/ibexa-dropdown-popover transition timeouts across every job — root-caused to the IbexaBehatBundle/var/encore issue above.
  • Re-run the regression (currently scoped to regression-oss-setup3 — PHP 8.4/Node 22/MySQL 8.4/Solr 8/Redis latest — in oss#290) against the updated two-step approach and confirm Behat tests pass with prod-built assets.
  • Confirm APP_ENV=behat is unaffected at runtime (unchanged from the original approach).

Browser-tests CI runs the whole app under APP_ENV=behat, and
ibexa:encore:compile picks yarn encore dev/prod based on the ambient
--env, which defaults to APP_ENV. As a result every CI asset build
was silently compiled in dev mode, never prod, regardless of edition.

Override APP_ENV=prod for just the composer run post-install-cmd exec
call that triggers ibexa:encore:compile, so encore compiles a
production build while the app itself still runs under APP_ENV=behat
for the actual Behat test execution.
Overriding APP_ENV=prod for the whole `composer run post-install-cmd`
call also switches the Symfony kernel env used by cache:clear, which
excludes IbexaBehatBundle (registered only for 'behat') from
kernel.bundles_metadata. That silently drops ibexa/behat's encore
config (transition-listener.js) from var/encore/*.js, so the compiled
admin-ui bundle never adds the ibexa-selenium-transition-*
marker classes Behat's transition-wait conditions poll for.

Run post-install-cmd unmodified (still under the behat env, so the
generated var/encore manifest stays correct), then rebuild assets in
production mode via a separate, plain `yarn encore prod` call that
never touches the Symfony kernel/env.
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant