Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force installing the same version for all Symfony components during the CI #480

Merged

Conversation

ste93cry
Copy link
Collaborator

@ste93cry ste93cry commented Apr 9, 2021

While trying to understand why some end-to-end tests recently started to fail during the CI due to deprecation notices coming from some Symfony components, I found out that components from different versions are installed at the same time. For example, let's suppose that we want to test the compatibility of our lib with Symfony 3.4: what the current GitHub Action workflow does is replacing the version of all entries that start with symfony/ in the composer.json with 3.4.x.

sed -ri '/symfony\/(monolog-bundle|phpunit-bridge|messenger|psr-http-message-bridge|polyfill-php80)/! s/"symfony\/(.+)": "(.+)"/"symfony\/\1": "'${{ matrix.symfony_constraint }}'"/' composer.json;

However, this does not guarante at all that the dependencies of those packages are installed at that version too. In fact, Symfony components often declare their compatibility with older or newer versions as well, but there is no guarantee that no deprecation is thrown if you mix two major versions. With this PR, I'm installing Flex globally and then using the SYMFONY_REQUIRE environment variable we force the same version for all components. I also discovered that apparently the 4.0 version of the SDK was uninstallable on Symfony 3.4 in certain cases because we were requiring symfony/psr-http-message:^2.0 which needs some components from Symfony 4.x instead, so I widened the Composer constraint to allow installing an older version of the package: this effectively allows installing our lib on a project that uses only components of the 3.4 version

@ste93cry ste93cry added this to the 4.1 milestone Apr 9, 2021
@ste93cry ste93cry requested a review from Jean85 April 9, 2021 22:12
@ste93cry ste93cry force-pushed the fix/force-same-symfony-version-for-all-components-during-ci branch 2 times, most recently from deee2a0 to 4a56f82 Compare April 9, 2021 22:18
@ste93cry ste93cry force-pushed the fix/force-same-symfony-version-for-all-components-during-ci branch from 4a56f82 to a7c6b3d Compare April 10, 2021 10:55
composer.json Show resolved Hide resolved
@ste93cry ste93cry requested a review from Jean85 April 12, 2021 11:28
@Jean85 Jean85 merged commit 8e6cf4d into develop Apr 12, 2021
@Jean85 Jean85 deleted the fix/force-same-symfony-version-for-all-components-during-ci branch April 12, 2021 13:33
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.

None yet

2 participants