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

Allow Symfony 4. Fix Travis build #749

Merged
merged 3 commits into from
Dec 13, 2017
Merged

Allow Symfony 4. Fix Travis build #749

merged 3 commits into from
Dec 13, 2017

Conversation

dunglas
Copy link
Contributor

@dunglas dunglas commented Nov 24, 2017

Alternative to #747.

@dunglas dunglas changed the title Alternative to #747. Allow Symfony 4. Fix Travis build. Nov 24, 2017
@dunglas
Copy link
Contributor Author

dunglas commented Nov 24, 2017

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]
Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aik099 yes I know ;).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dunglas , not fixed.

Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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

@dunglas
Copy link
Contributor Author

dunglas commented Nov 24, 2017

@stof all comments fixed

@sroze
Copy link

sroze commented Dec 4, 2017

ping @stof :)

@ruudk
Copy link

ruudk commented Dec 10, 2017

Any news on this? I feel like this is the last step to get Symfony2Extension compatible with SF 4 🙏

@sroze
Copy link

sroze commented Dec 13, 2017

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
Copy link
Member

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?

Copy link
Contributor Author

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).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for you @dunglas

Copy link
Member

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.

Copy link
Member

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)

Copy link
Member

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)

@aik099
Copy link
Member

aik099 commented Dec 13, 2017

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.

@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 composer.json and that's it? This is the way how it was done for other projects. In that case PR could be merged right away (as long as all tests pass of course).

@sroze
Copy link

sroze commented Dec 13, 2017

@aik099
Copy link
Member

aik099 commented Dec 13, 2017

@sroze , understood. Now all we're waiting for @dunglas to fix issues reported by @stof .

@sroze
Copy link

sroze commented Dec 13, 2017

He fixed them already 😉

#749 (comment)

@aik099
Copy link
Member

aik099 commented Dec 13, 2017

@sroze , not the one where PHP 5.3 was removed from the build.

@dunglas
Copy link
Contributor Author

dunglas commented Dec 13, 2017

@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
Copy link
Member

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?

Copy link
Contributor Author

@dunglas dunglas Dec 13, 2017

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).

@aik099
Copy link
Member

aik099 commented Dec 13, 2017

... it is actually fixed: https://travis-ci.org/minkphp/Mink/jobs/306878662

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 simple-phpunit (see relevant comment) and we're done.

@aik099 aik099 changed the title Allow Symfony 4. Fix Travis build. Allow Symfony 4. Fix Travis build Dec 13, 2017
@dunglas
Copy link
Contributor Author

dunglas commented Dec 13, 2017

@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"
Copy link
Member

@aik099 aik099 Dec 13, 2017

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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
Copy link
Member

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).

Copy link
Member

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.

Copy link
Member

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.

@aik099
Copy link
Member

aik099 commented Dec 13, 2017

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.

@stof
Copy link
Member

stof commented Dec 13, 2017

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.

@dunglas
Copy link
Contributor Author

dunglas commented Dec 13, 2017

@stof can I do that in another PR (I'll drop the last commit for now)?

@stof
Copy link
Member

stof commented Dec 13, 2017

@dunglas yes, sure

@dunglas
Copy link
Contributor Author

dunglas commented Dec 13, 2017

done

@aik099 aik099 merged commit 808702d into minkphp:master Dec 13, 2017
@aik099
Copy link
Member

aik099 commented Dec 13, 2017

Merging, thanks @dunglas .

@dunglas dunglas deleted the sf4 branch December 13, 2017 13:34
@sroze sroze mentioned this pull request Dec 13, 2017
@sroze
Copy link

sroze commented Dec 13, 2017

A release would be 🎆

@aik099
Copy link
Member

aik099 commented Dec 13, 2017

I thought, that this could not be as easy as just merging the PR.

@sroze , shouldn't you be using something like "behat/mink": "~1.7@dev", in your composer.json. This way you'll be getting latest dev code for testing.

This is how all drivers are connected to Mink.

mxr576 pushed a commit to tamasd/Mink that referenced this pull request May 3, 2019
Allow Symfony 4. Fix Travis build.
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.

None yet

5 participants