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

Support plugin dependencies #66

Closed
pedro-mendonca opened this issue Apr 3, 2024 · 9 comments · Fixed by #132
Closed

Support plugin dependencies #66

pedro-mendonca opened this issue Apr 3, 2024 · 9 comments · Fixed by #132
Labels
bug Something isn't working

Comments

@pedro-mendonca
Copy link

pedro-mendonca commented Apr 3, 2024

Hi @swissspidy,
With the new WP 6.5 dependencies I'm getting an error of a plugin that depends of another.
Example error here

Warning: Failed to activate plugin. [Plugin Name] requires 1 plugin to be installed and activated: [plugin-dependency]. .
Error: No plugins activated.
Error: Process completed with exit code 1.

And... the test fails.
The current alternative is setting wp-version to 6.4, which doesn't rely on the dependencies and the plugin is correctly activated.

Maybe the action could check the plugin dependencies and activate them also, while wp-cli doesn't directly support install/activate the required dependencies.

As you've pointed out in #61 (comment), this should be fixed upstream on wp-cli.

@swissspidy swissspidy added the bug Something isn't working label Apr 4, 2024
@swissspidy swissspidy changed the title Plugin Check is failing for plugins that depend on other plugins on WP 6.5 Support plugin dependencies Apr 4, 2024
@swissspidy
Copy link
Member

So I just had a brief look at this.

There might be ways to do this already right now without waiting for WP-CLI, but it would be rather hacky. So it's definitely better to wait for WP-CLI support here.

@pedro-mendonca
Copy link
Author

Since wp-cli/extension-command#414 it's now possible to get the plugin dependencies:
wp plugin get foo --field=requires_plugins

I've made some testing, and the current line is failing because of the missing dependencies:
echo "{ \"core\": $WP_VERSION, \"port\": 8880, \"testsPort\": 8881, \"plugins\": [ \"$PLUGIN_DIR\", \"https://downloads.wordpress.org/plugin/plugin-check.latest-stable.zip\" ] }" >> .wp-env.json

I suggest removing the install of \"$PLUGIN_DIR\" on .wp-env.json and add it later on the Run Plugin Check step, using wp-cli to install and activate dependencies before runing the check.

What do you think of this approach @swissspidy ?

@swissspidy
Copy link
Member

That's definitely a step in the right direction, as either way we'd have to move the plugin out of the wp-env config.

Ideally we would wait for proper WP-CLI support, but it could work.

We'd need to turn the commas in wp plugin get foo --field=requires_plugins into spaces and then run wp plugin install --activate for the dependencies (if the string is not empty).

Wanna submit a PR to give it a try? :-)

@pedro-mendonca
Copy link
Author

The current WP-CLI doesn't include the latest wp-cli/extension-command, so the requires_plugins is still unavailable.
Eventually, while WP-CLI doesn't properly support it, there could be an optional input to manually add any desired dependencies, that could later be used by wp-cli.

@swissspidy
Copy link
Member

We can just install WP-CLI nightly in the meantime:

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

-curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
+curl -o wp-cli.phar https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar

@swissspidy
Copy link
Member

Actually, scratch the above, that was incorrect.

WP-CLI is run from within the wp-env container, where it can't really be updated.

I was working on this in #132 but I think I really need to wait for the 2.11.0 release first.

@pedro-mendonca
Copy link
Author

And here it is, no more hacky solutions needed. :)
https://make.wordpress.org/cli/2024/08/08/wp-cli-v2-11-0-release-notes/

@swissspidy
Copy link
Member

The Docker images were just updated too! docker-library/wordpress@f7e3d05

Let's see if they're already available via wp-env... 🤞

@swissspidy
Copy link
Member

Not yet apparently. Maybe only deploying every once in a while :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants