Skip to content

Make 6.x branch compatible with PHP 8#3189

Merged
antonmedv merged 8 commits into
deployphp:6.xfrom
rutgerrademaker:6.x
Aug 3, 2022
Merged

Make 6.x branch compatible with PHP 8#3189
antonmedv merged 8 commits into
deployphp:6.xfrom
rutgerrademaker:6.x

Conversation

@rutgerrademaker
Copy link
Copy Markdown

@rutgerrademaker rutgerrademaker commented Jul 7, 2022

I am not sure how to run the included tests, I am aware that there is a .travis.yml file and that php 8.0 and 8.1 could be added but I would not now how to actually run the included tests

This PR is only serving those who want to postpone the migration to deployer 7 until it has a stable release
Just wanted to see if it could be done.

N.B. I was able to build a new phar file, which did not throw any errors when using it for a deploy
N.B.2 I also want to move on to Deployer 7 now, but please consider merging this PR

@kiropowered
Copy link
Copy Markdown

@rutgerrademaker Hi, not sure but I think #[\ReturnTypeWillChange] was introduced in php 8.1 therefore in order to be compatible with php7 also code should not use attributes

@rutgerrademaker
Copy link
Copy Markdown
Author

@kiropowered #[\ReturnTypeWillChange] is technically just a comment, see also https://wiki.php.net/rfc/internal_method_return_types

@antonmedv In my latest commit I added a new lock file created with PHP 7.4, I think this should do the trick for making it compatible with both 7 and 8

@antonmedv
Copy link
Copy Markdown
Member

What about deps? Symfony deps also only php7 in v6 branch.

@rutgerrademaker rutgerrademaker changed the title 6.x Make 6.x branch compatible with PHP 8 Jul 14, 2022
@rutgerrademaker
Copy link
Copy Markdown
Author

@antonmedv not sure what you mean there
The latest lock file I committed will install for both php 7.4 and php 8.1, or am I missing something?
If I missed something and it would not be feasible to support both php 7 and 8 in 1 branch, could it maybe be an option to start a v6.9.x branch that will only support PHP 8 instead?

@antonmedv
Copy link
Copy Markdown
Member

Please, create a example project with php8 and using this branch as deps. I'd like to take a look how it's working with it.

@tdgroot
Copy link
Copy Markdown

tdgroot commented Jul 26, 2022

I would really like to see ^8.0 supported for the 6.x branch!

tdgroot added a commit to ByteInternet/hypernode-deploy that referenced this pull request Jul 26, 2022
This is still a WIP, as we run into dependency problems caused by
Deployer 6.x not having support for PHP ^8.0, see for example
deployphp/deployer#3189.
I think it would be wise to fork Deployer and make the 6.x branch
compatible with PHP ^8.0. When Deployer 7 is released, we can start
making use of that version for the PHP ^8.0 variant and fall back to
Deployer 6.x for PHP 7.x.

Changes that have been made:
- Install box without Composer. With this change we didn't need the
`build/` directory anymore, so it was deleted.
- Just use one PHP image for both build and runtime
- Install Node.js and NPM using nodesource rather than the Node.js Docker image
- Removed dep sentry (in the future we need to implement our own APM)
- Removed dep deployer/recipes, this packages is deprecated and we
should make use of the recipes within the deployer/deployer package.
@Nelrann
Copy link
Copy Markdown

Nelrann commented Jul 28, 2022

+1

@antonmedv
Copy link
Copy Markdown
Member

Now we have v7 release. We can close this one)

@kiropowered
Copy link
Copy Markdown

awesome

@rutgerrademaker
Copy link
Copy Markdown
Author

@antonmedv still love to see this merged, as a migration to v7 is far from straight forward
About the "example project" you asked for, not entirely sure what you mean but these both work:

cd ~
mkdir php7
cd php7
composer init --name=test/php7 -q
composer config minimum-stability dev
composer config allow-plugins true
composer config repositories.rutger-deployer vcs [email protected]:rutgerrademaker/deployer.git
composer require php:^7.4
composer require deployer/deployer:6.x-dev#a47c061 --prefer-source
composer show deployer/deployer


cd ~
mkdir php8
cd php8
composer init --name=test/php8 -q
composer config minimum-stability dev
composer config allow-plugins true
composer config repositories.rutger-deployer vcs [email protected]:rutgerrademaker/deployer.git
composer require php:^8
composer require deployer/deployer:6.x-dev#a47c061 --prefer-source
composer show deployer/deployer

@leonhelmus
Copy link
Copy Markdown

@antonmedv I also like to get this merged if possible :). Then we can have some more time before we migrate to deployer 7.x.
Since that requires a lot of refactor.

@antonmedv
Copy link
Copy Markdown
Member

Since that requires a lot of refactor.

Not that much)

@leonhelmus
Copy link
Copy Markdown

leonhelmus commented Aug 2, 2022

:( @antonmedv It's up to you of course, but i would appreciate it if you did merged it.

@cafferata
Copy link
Copy Markdown
Contributor

What objections do you see @antonmedv? If you want, I can perform the tests that @rutgerrademaker has made available. So we can relieve you. For us (@JCID) it would also be also an added value. 🙏 Many of our client projects are on the latest version of Deployer 6.x and PHP 7.4. The PHP 8.x upgrade is, if you ask me, unnecessarily complicated by needing to upgrade Deployer 6.x to Deployer 7.x first. For us, merging this merge request would be helpful to make the PHP 8.x upgrade possible. After upgrading to PHP 8.x we can gradually migrate the different Deployer set-ups to Deployer 7.x.

I look forward to hearing your counter-arguments, thank you in advance for taking the time.

@antonmedv
Copy link
Copy Markdown
Member

Well, ok. Let’s try to give it a go. Third time!)

@cafferata
Copy link
Copy Markdown
Contributor

Thanks! I'll also test tomorrow (first thing in the morning) the branch/merge request of @rutgerrademaker. 👌

@cafferata
Copy link
Copy Markdown
Contributor

composer remove --dev deployer/deployer
composer remove --dev jcid/deployer-recipe
echo "8.0" > .php-version
composer require php:~8.0.0
composer config repositories.rutger-deployer vcs [email protected]:rutgerrademaker/deployer.git
composer require --dev deployer/deployer:6.x-dev#a47c061 --prefer-source

Gitlab CI tells me: Successfully deployed! 🚀

Screenshot 2022-08-03 at 07 55 43

I also don't see any particularities in the submitted merge request from @rutgerradermaker. I say, ready for a new tag 👍

@cafferata
Copy link
Copy Markdown
Contributor

cafferata commented Aug 3, 2022

Just updated composer.json with PHP 8.1 and also successfully released. 🚀 😄

cho "8.1" > .php-version
composer require php:~8.1.0

@antonmedv antonmedv merged commit c4380ef into deployphp:6.x Aug 3, 2022
@rutgerrademaker
Copy link
Copy Markdown
Author

Thanks!

Does this mean we will also get a new release/tag ? or should we install it straight from the 6.x branch now?
(sorry if I'm being impatient ;))

@antonmedv
Copy link
Copy Markdown
Member

antonmedv commented Aug 4, 2022

Will release v6 after I’m gonna get $100 in donations))

@rutgerrademaker
Copy link
Copy Markdown
Author

@antonmedv fair point!

I pulled some strings over here, money should be on it's way :)

@leonhelmus
Copy link
Copy Markdown

@antonmedv I believe the donation should be their did you receive it?

@antonmedv
Copy link
Copy Markdown
Member

Nope.

@leonhelmus
Copy link
Copy Markdown

@antonmedv than i will look at our side if somebody already send it.

@leonhelmus
Copy link
Copy Markdown

leonhelmus commented Aug 15, 2022

@antonmedv we have mnow made the donation.
image

@antonmedv
Copy link
Copy Markdown
Member

Just received a email! Thanks 😊 will work on release tonight.

@antonmedv
Copy link
Copy Markdown
Member

Released. Please check it out.

@bpolaszek
Copy link
Copy Markdown
Contributor

Very good job @rutgerrademaker 🚀
We've been waiting for this for almost 2 years! 🙏

@jonnott
Copy link
Copy Markdown

jonnott commented Aug 17, 2022

@antonmedv Currently, dep --self-update doesn't pick up this new v6.9.0 release. Is there something that can be done to make that work?

@antonmedv
Copy link
Copy Markdown
Member

Yes, I need to check what is going own with CI pipeline. Probably manifest isn’t updated.

Also, I’m thinking to completely remove self-update command from v6 and v7 as well. What is your use case with self-update command?

@jonnott
Copy link
Copy Markdown

jonnott commented Aug 17, 2022

Also, I’m thinking to completely remove self-update command from v6 and v7 as well. What is your use case with self-update command?

To be on the latest version. Isn't that a pretty good reason - to stay current with the latest features, bugfixes etc?

It's great that it works just like composer self-update (which is also a .phar)

I don't understand why you'd remove this?!

@antonmedv
Copy link
Copy Markdown
Member

I don't understand why you'd remove this?!

Looks like most of the people using Deployer via composer require.

@jonnott
Copy link
Copy Markdown

jonnott commented Aug 17, 2022

I don't understand why you'd remove this?!

Looks like most of the people using Deployer via composer require.

I really don't think this is the case. You may have some actual stats on this somehow .. but certainly the development outfit that I'm part of, we use deployer (v6) across dozens of projects, and always via the globally-installed .phar on our local computers.

@rutgerrademaker rutgerrademaker deleted the 6.x branch August 17, 2022 14:52
@rutgerrademaker
Copy link
Copy Markdown
Author

First of all thanks for merging this!

I don't understand why you'd remove this?!

Looks like most of the people using Deployer via composer require.

That said... We'd love to be able to do have
A) have phar + the source (!) Installabe on a given version via composer
B) have a phar-only package (so you do not run into composer dependeny issues)

For B composer would do for us, (we had some issues with deployer/dist though, so stopped using that) It seems https://phar.io/ is also getting some traction for distribution of versioned phars (deployer looks not available there though)

Can only guess quite some people just wget their phar + self-update, (I do this for other phars also)

Maybe open a new topic/discussion on the future of this?

@antonmedv
Copy link
Copy Markdown
Member

Deployer v7 actually is distributed via composer as phar. Source is also available.

@cafferata
Copy link
Copy Markdown
Contributor

Released. Please check it out.

Successfully performed the Deployer upgrade to ^6.9. Thanks! ☺️

@jonnott
Copy link
Copy Markdown

jonnott commented Aug 24, 2022

Yes, I need to check what is going own with CI pipeline. Probably manifest isn’t updated.

Hi @antonmedv .. did you get anywhere with looking at this, so that self-update works to move from v6.8 to v6.9?

@mattmcdev
Copy link
Copy Markdown

I'm having issues when installing 6.9 with PHP 8.0 (not 8.1).

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires deployer/deployer 6.9.0 -> satisfiable by deployer/deployer[v6.9.0].
    - deployer/deployer v6.9.0 requires symfony/console ~2.7|~3.0|~4.0|~5.0 -> found symfony/console[v2.7.0-BETA1, ..., 2.8.x-dev, v3.0.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev, v5.0.0-BETA1, ..., 5.4.x-dev] but the package is fixed to v6.0.12 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

@antonmedv
Copy link
Copy Markdown
Member

Deps issues. Well it’s all fixed in v7.

Consider switching to v7 ;)

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.

10 participants