-
Notifications
You must be signed in to change notification settings - Fork 276
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
Allow Symfony 4. Fix Travis build #749
Conversation
17d7109
to
f1d4b02
Compare
And Travis is happy! |
@@ -2,28 +2,27 @@ language: php | |||
|
|||
sudo: false | |||
|
|||
php: [5.3, 5.4, 5.5, 5.6, 7.0, hhvm] | |||
php: [5.4, 5.5, 5.6, 7.0, 7.1, hhvm] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing CI on 5.3 without dropping support is a no-go. This is the best way to drop support without telling it to Composer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a trick to force it to keep running on 5.3 precise for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you prefer @stof? Using the trick for Travis (I know which one) or dropping the support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fix PHP 5.3 build you need to move it from general config to matrix, that uses precise
OS version for that PHP version specifically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aik099 yes I know ;).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dunglas , not fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add PHP 7.2 in this list.
And I would remove HHVM, as they decided to not care about PHP parity anymore.
.travis.yml
Outdated
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' SYMFONY_DEPRECATIONS_HELPER=weak | ||
- php: 5.6 | ||
- php: 5.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not good. This would not test against a dev version of SF for instance, because they dropped support for 5.4. This job should run on the highest stable PHP version instead
env: DEPENDENCIES=dev | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache/files | ||
|
||
before_install: | ||
- composer self-update | ||
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; | ||
- if [ "$DEPENDENCIES" = "dev" ]; then composer config minimum-stability dev; fi; | ||
|
||
install: | ||
- composer update $COMPOSER_FLAGS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please also add vendor/bin/simple-phpunit install
here, so that installation does not get mixed in the test output
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' SYMFONY_DEPRECATIONS_HELPER=weak | ||
- php: 5.6 | ||
- php: 5.4 | ||
env: DEPENDENCIES=dev | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache/files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should also ensure that the PHPUnit install performed by the bridge is cached whenever possible. See KnpLabs/KnpMenu@170f8d7 for an example
@stof all comments fixed |
ping @stof :) |
Any news on this? I feel like this is the last step to get Symfony2Extension compatible with SF 4 🙏 |
Alright, we can't block Symfony's Behat extension with that for that long. I'll remove Mink from the dependencies for now, do a release and maybe add it back at some point when this is merged. |
|
||
script: phpunit -v --coverage-clover=coverage.clover | ||
script: vendor/bin/simple-phpunit -v --coverage-clover=coverage.clover |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is simple-phpunit
and how it's better than regular phpunit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://symfony.com/doc/current/components/phpunit_bridge.html
Here it is basically used to run tests both on PHP 5 and 7 (not easy with PHPUnit directly).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for you @dunglas
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Never had any issues with this. Just use PHPUnit version that Travis CI gives you (the code you've changed was doing that) and PHPUnit version compatible with used PHP version would be picked automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aik099 Travis CI gives you a version of PHPUnit compatible with the PHP runtime. but when it gives you PHPUnit 4.8, it might give you a version older than 4.8.35, and so without the new namespaced class names for TestCase, making hard to have a testsuite compatible with PHPUnit 6 as well (which is used by default on Travis for PHP 7.2 for instance)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a phpunit version installed through composer could also be working. But the drawback is that it would install an old unmaintained version of phpunit when using --prefer-lowest
. And this does not make sense (we want to test the lowest versions of our deps, but we can still use an uptodate testing tool for that, avoiding to be hit by old PHPUnit bugs)
@sroze , is Mink a dependency of Behat? I thought that only MinkExtension needs it. If you plan to release new version of MinkExtension without Mink listed as dependency, then it would be very confusing. @dunglas , I wonder why we just can't add Symfony 4 in |
@aik099 it's a dev dependency (through the mink extension), because of things like that: |
He fixed them already 😉 |
@sroze , not the one where PHP 5.3 was removed from the build. |
@aik099 it is actually fixed: https://travis-ci.org/minkphp/Mink/jobs/306878662 |
|
||
after_script: | ||
- if [[ "7.0" != "$TRAVIS_PHP_VERSION" && "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi | ||
- wget https://scrutinizer-ci.com/ocular.phar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dunglas , any idea why these 2 lines now can be performed for all PHP versions, but before for all but PHP7 and HHVM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because now ocular supports PHP 7 (it wasn't the case when the initial PHP 7 support has been added to .travis.yml
I guess).
Ups. When discussion happens on one code line, but changes related to it are added to another code line it's hard to trace. That's fixed good. Now only my last concern about need to use |
@aik099 I replied to that, it's the only reliable way to run tests on both PHP versions. |
}, | ||
|
||
"require-dev": { | ||
"symfony/phpunit-bridge": "~2.7|~3.0" | ||
"symfony/phpunit-bridge": "^3.3|^4.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've increased 2.1
to 2.7
for symfony/css-selector
. Why not doing something similar for symfony/phpunit-bridge
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature allowing to run both PHPUnit major versions has been added in 3.3, it doesn't work with earlier versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess Symfony 3.x works fine on PHP 5.3 it Travis CI is happy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the PHPUnit bridge is special. We kept PHP 5.3 support in it (allowing Symfony 2.7 to use the latest bridge version for its own testing, instead of having to backport nice changes all the time).
env: COMPOSER_FLAGS='--prefer-lowest --prefer-stable' SYMFONY_DEPRECATIONS_HELPER=weak | ||
- php: 5.6 | ||
- php: 7.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it needed to specify -php 7.1
several times? You can combine multiple env vars into single line as well (above COMPOSER_FLAGS
and SYMFONY_DEPRECATIONS_HELPER
are combined into single line).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we want separate jobs for the lowest deps and the unstable deps (these cannot be combined together, as they are about different versions of deps).
and if you don't specify the PHP version for a job, Travis defaults to 5.5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. So that was on purpose. Thanks for explaining.
Now it seems PR is ready for mering. I can merge as well, but I need a confirmation, that there is all done what should be done. |
hmm, the Symfony PHPUnit Bridge installs PHPunit 6 on PHP 7.2 (as previous versions are triggering PHP deprecations on it). So it requires switching to namespaced PHPunit TestCase class. |
@stof can I do that in another PR (I'll drop the last commit for now)? |
@dunglas yes, sure |
done |
Merging, thanks @dunglas . |
A release would be 🎆 |
I thought, that this could not be as easy as just merging the PR. @sroze , shouldn't you be using something like This is how all drivers are connected to Mink. |
Allow Symfony 4. Fix Travis build.
Alternative to #747.