@@ -136,7 +136,87 @@ jobs:
136136 cache : ' yarn'
137137 cache-dependency-path : |
138138 yarn.lock
139- **/package.json
139+ package.json
140+ src/**/package.json
140141 - run : yarn --immutable
141142 - run : yarn playwright install
142143 - run : yarn test
144+
145+ test-app-encore-app :
146+ name : " Test Apps / Encore (${{ matrix.name}})"
147+ runs-on : ubuntu-latest
148+ strategy :
149+ fail-fast : false
150+ matrix :
151+ include :
152+ - name : Internal (from "vendor/")
153+ ux-packages-source : php-vendor
154+ - name : External (from "yarn add")
155+ ux-packages-source : js-packages
156+ steps :
157+ # Setup
158+ - uses : actions/checkout@v4
159+
160+ - run : corepack enable
161+
162+ - uses : actions/setup-node@v4
163+ with :
164+ cache : ' yarn'
165+ cache-dependency-path : |
166+ yarn.lock
167+ package.json
168+ src/**/package.json
169+ test_apps/encore-app/package.json
170+
171+ - uses : shivammathur/setup-php@v2
172+
173+ - name : Install root dependencies
174+ uses : ramsey/composer-install@v3
175+ with :
176+ working-directory : ${{ github.workspace }}
177+
178+ - name : Build root packages
179+ run : php .github/build-packages.php
180+ working-directory : ${{ github.workspace }}
181+
182+ - uses : ramsey/composer-install@v3
183+ with :
184+ working-directory : test_apps/encore-app
185+
186+ - if : matrix.ux-packages-source == 'js-packages'
187+ working-directory : test_apps/encore-app
188+ run : |
189+ PACKAGES_TO_INSTALL=''
190+ for PACKAGE in $(cd ../..; yarn workspaces list --no-private --json); do
191+ PACKAGE_DIR=../../$(echo $PACKAGE | jq -r '.location')
192+ PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $PACKAGE_DIR"
193+ done
194+ echo "Installing packages: $PACKAGES_TO_INSTALL"
195+ yarn add --dev $PACKAGES_TO_INSTALL
196+
197+ # Validations
198+ - name : Ensure UX packages are installed from "${{ matrix.ux-packages-source == 'php-vendor' && 'vendor/symfony/ux-...' || '../../../src/**/assets' }}"
199+ working-directory : test_apps/encore-app
200+ run : |
201+ for PACKAGE in $(cat package.json | jq -c '(.dependencies // {}) + (.devDependencies // {}) | to_entries[] | select(.key | startswith("@symfony/ux-")) | {name: .key, version: .value}'); do
202+ PACKAGE_NAME=$(echo $PACKAGE | jq -r '.name')
203+ PACKAGE_VERSION=$(echo $PACKAGE | jq -r '.version')
204+
205+ echo -n "Checking $PACKAGE_NAME@$PACKAGE_VERSION..."
206+ if [[ $PACKAGE_VERSION == $EXPECTED_PATTERN* ]]; then
207+ echo " OK"
208+ else
209+ echo " KO"
210+ echo "The package version of $PACKAGE_NAME must starts with the pattern (e.g.: $EXPECTED_PATTERN), got $PACKAGE_VERSION instead."
211+ exit 1
212+ fi
213+ done;
214+ env :
215+ EXPECTED_PATTERN : ${{ matrix.ux-packages-source == 'php-vendor' && 'file:vendor/symfony/*' || '../../src/*' }}
216+
217+ - name : Run Encore
218+ working-directory : test_apps/encore-app
219+ run : |
220+ yarn || (echo "Unable to install Yarn dependencies" && exit 1)
221+ yarn encore dev || (echo "Unable to build Encore assets (dev)" && exit 1)
222+ yarn encore production || (echo "Unable to build Encore assets (production)" && exit 1)
0 commit comments