Skip to content

Commit e523961

Browse files
committed
Refactor CI workflow for Symfony dependency management
- Updated the CI workflow to ensure proper handling of Symfony components across different PHP versions. - Replaced partial composer updates with full dependency updates to maintain compatibility and prevent conflicts. - Enhanced the installation commands for Symfony packages to include all necessary components, ensuring alignment with the specified Symfony version in the matrix.
1 parent 464ffb7 commit e523961

1 file changed

Lines changed: 48 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,38 @@ jobs:
5858
5959
- name: Install dependencies with Symfony ${{ matrix.symfony }}
6060
run: |
61-
# DBAL 4 needs PHP ^8.2; PHP 8.1 jobs must downgrade the lock before any other update (even if the
62-
# following composer update lists doctrine/dbal, Composer may still fail while the lock says 4.x).
63-
if [ "${{ matrix.php }}" = "8.1" ]; then
64-
composer update doctrine/dbal:3.10.5 --no-interaction --prefer-dist --no-progress
65-
fi
61+
# Do not run a partial `composer update` on PHP 8.1 before the steps below: if composer.lock was built
62+
# on PHP 8.2+ (e.g. Symfony 7.4), Composer validates the whole lock against PHP 8.1 and aborts before any
63+
# package can be downgraded. The require + full symfony/* update realigns the lock for this matrix.
6664
# Pin browser-kit + dom-crawler to the matrix Symfony: they are require-dev with ^6.1||^7||^8 and could
6765
# otherwise stay on 7.x while http-kernel is 6.4, breaking HttpKernelBrowser::doRequest vs AbstractBrowser.
6866
# var-exporter must match the matrix Symfony major: ORM 3.6+ needs ProxyHelper::generateLazyGhost when native
6967
# lazy objects are off; that method was removed in symfony/var-exporter 8.x, so a 7.x stack must not pull 8.x here.
70-
composer require symfony/config:^${{ matrix.symfony }} symfony/dependency-injection:^${{ matrix.symfony }} symfony/http-kernel:^${{ matrix.symfony }} symfony/yaml:^${{ matrix.symfony }} symfony/var-exporter:^${{ matrix.symfony }} symfony/browser-kit:^${{ matrix.symfony }} symfony/dom-crawler:^${{ matrix.symfony }} --no-interaction --no-update
71-
# Refresh Symfony + Doctrine together: Symfony 8 needs doctrine-bundle ^3 + DBAL ^4; other matrices keep DBAL 3 on PHP 8.1.
72-
composer update symfony/* doctrine/doctrine-bundle doctrine/dbal --with-all-dependencies --no-interaction --prefer-dist --no-progress
68+
# Pin every Symfony component used by the bundle (and symfony/console, which is only transitive): otherwise the
69+
# lock can keep console 7.x while yaml/http-kernel are 6.4 → PHP fatal: Command::configure(): void vs LintCommand.
70+
composer require \
71+
symfony/config:^${{ matrix.symfony }} \
72+
symfony/console:^${{ matrix.symfony }} \
73+
symfony/dependency-injection:^${{ matrix.symfony }} \
74+
symfony/framework-bundle:^${{ matrix.symfony }} \
75+
symfony/form:^${{ matrix.symfony }} \
76+
symfony/http-kernel:^${{ matrix.symfony }} \
77+
symfony/yaml:^${{ matrix.symfony }} \
78+
symfony/security-bundle:^${{ matrix.symfony }} \
79+
symfony/stopwatch:^${{ matrix.symfony }} \
80+
symfony/translation:^${{ matrix.symfony }} \
81+
symfony/twig-bundle:^${{ matrix.symfony }} \
82+
symfony/var-exporter:^${{ matrix.symfony }} \
83+
symfony/browser-kit:^${{ matrix.symfony }} \
84+
symfony/dom-crawler:^${{ matrix.symfony }} \
85+
symfony/http-client:^${{ matrix.symfony }} \
86+
symfony/mailer:^${{ matrix.symfony }} \
87+
symfony/mime:^${{ matrix.symfony }} \
88+
--no-interaction --no-update
89+
# Quote 'symfony/*' so the shell never glob-expands it (with nullglob, symfony/* can vanish and Composer would
90+
# skip all Symfony packages — leaving e.g. console 7.x with yaml 6.4 → fatal Command::configure(): void).
91+
# Full update reconciles require-dev (php-cs-fixer, rector, …) with the pinned Symfony major.
92+
composer update --with-all-dependencies --no-interaction --prefer-dist --no-progress
7393
7494
- name: Validate translation YAML files
7595
run: php scripts/validate-translations-yaml.php src/Resources/translations
@@ -180,8 +200,26 @@ jobs:
180200

181201
- name: Install dependencies (Symfony 7.0)
182202
run: |
183-
composer require symfony/config:^7.0 symfony/dependency-injection:^7.0 symfony/http-kernel:^7.0 symfony/yaml:^7.0 symfony/var-exporter:^7.0 symfony/browser-kit:^7.0 symfony/dom-crawler:^7.0 --no-interaction --no-update
184-
composer update symfony/* doctrine/doctrine-bundle doctrine/dbal --with-all-dependencies --no-interaction --prefer-dist --no-progress
203+
composer require \
204+
symfony/config:^7.0 \
205+
symfony/console:^7.0 \
206+
symfony/dependency-injection:^7.0 \
207+
symfony/framework-bundle:^7.0 \
208+
symfony/form:^7.0 \
209+
symfony/http-kernel:^7.0 \
210+
symfony/yaml:^7.0 \
211+
symfony/security-bundle:^7.0 \
212+
symfony/stopwatch:^7.0 \
213+
symfony/translation:^7.0 \
214+
symfony/twig-bundle:^7.0 \
215+
symfony/var-exporter:^7.0 \
216+
symfony/browser-kit:^7.0 \
217+
symfony/dom-crawler:^7.0 \
218+
symfony/http-client:^7.0 \
219+
symfony/mailer:^7.0 \
220+
symfony/mime:^7.0 \
221+
--no-interaction --no-update
222+
composer update --with-all-dependencies --no-interaction --prefer-dist --no-progress
185223
186224
- name: Run tests with coverage
187225
run: |

0 commit comments

Comments
 (0)