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 enabling required PHP extensions only instead of disabling a long list of unwanted PHP extensions #487

Closed
1 task done
localheinz opened this issue Aug 24, 2021 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@localheinz
Copy link
Contributor

Describe the feature

In sebastianbergmann/phpunit#4747, @sebastianbergmann suggests enabling only required PHP extensions for GitHub Actions, in order to have a clear sense of which PHP extensions are required. By default, shivammathur/setup-php has a wide range of PHP extensions enabled, and while it is possible to disable and enable extensions at will, disabling extensions can become quite tedious.

For an example, see sebastianbergmann/phpunit#4759.

Can you think of a way that would keep everything as it is right now (for users who currently use shivammathur/setup-php while implicitly depending on PHP extensions), and adding an option of some kind that

  • disables all PHP extensions as far as possible
  • allows specifying required PHP extensions only

?

Version

  • I have checked releases, and the feature is missing in the latest patch version of v2.

Underlying issue

This would solve the problem where a project has hidden dependencies on PHP extensions in a specific GitHub Actions workflow.

Describe alternatives

We could specify a list of extensions, in the hope that it is exhaustive, and disable and enable at will (see sebastianbergmann/phpunit#4759).

Additional context

n/a

Are you willing to submit a PR?

I might try!

Alternatively, I am happy to send some some money your way, if it helps!

@localheinz localheinz added the enhancement New feature or request label Aug 24, 2021
@localheinz localheinz changed the title Allow enabling Allow enabling required PHP extensions only instead of disabling a long list of unwanted PHP extensions Aug 24, 2021
@shivammathur
Copy link
Owner

shivammathur commented Aug 24, 2021

@localheinz
Currently while removing extensions it does not consider that extensions can depend on other extensions, this somehow skipped my mind while implementing this.

  • I will try to fix this - when an extension on which other extensions depend has to be removed, it will be removed along with all the dependent extensions.

  • Your suggestion about removing all extensions except ones specified is also good. Specifying none in extensions input followed by the extensions you need. This will remove all shared extensions before adding those after none.

Let me know your thoughts.

Alternatively, I am happy to send some some money your way, if it helps!

That always helps 😀

@localheinz
Copy link
Contributor Author

@shivammathur

Sounds like a perfect solution for us!

@shivammathur
Copy link
Owner

@localheinz

I have implemented both, please test it with the develop branch and let me know if there are any bugs.

  1. If x is a shared extension, this should disable all extensions which depend on x along with it.
    So your existing workflow will not break. (Test workflow)
extensions: :x
  1. This will disable all shared extensions and then install/enable x, y, and z. (Test workflow)
extensions: none, x, y, z

@localheinz
Copy link
Contributor Author

@shivammathur

This works great!

Currently testing it in sebastianbergmann/phpunit#4759, and already discovered implicit dependencies on PHP extensions in other projects, see vimeo/psalm#6368!

@mfn
Copy link
Contributor

mfn commented Aug 27, 2021

Oh wow.

@shivammathur would it be an option to consider making this a kind of default behaviour for the next major version?

@shivammathur
Copy link
Owner

@mfn
I would like to keep none as an option in extensions input and not a default as It will complicate the upgrade path of many users which expect the action to just work for running their tests and not deal with extensions.

Also, it is very simple to add none in extensions input if required.

@williamdes
Copy link

I was thinking none was released 😄
https://github.com/phpmyadmin/sql-parser/runs/3519242419#step:4:15
Early tester it will be ^^

@shivammathur
Copy link
Owner

@williamdes I was a bit busy. Will release this week.

@shivammathur
Copy link
Owner

Released in 2.14.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants