-
Notifications
You must be signed in to change notification settings - Fork 179
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
Use @wordpress/env
(wp-env) for local dev environment
#5612
Conversation
34ebf5c
to
10492f3
Compare
This comment has been minimized.
This comment has been minimized.
Seems like they are using composer v2 in the WordPress container. Related #5083 |
This error keeps happening.
Once this is fixed, I think that it lots more things will start working. |
This comment has been minimized.
This comment has been minimized.
The |
This comment has been minimized.
This comment has been minimized.
We can update this now with 3.0.0 - https://www.npmjs.com/package/@wordpress/env 🎉 |
What is happening with this PR? |
@spacedmonkey Thanks for asking! I think we're getting there, but I'm afraid we can only use it for the E2E tests for now. I was hoping we could use wp-env for more stuff from the beginning, but there are some upstream blockers that need to be fixed first. Fo now, I just need to figure out why the E2E tests are failing, then this should be good to go. PHP unit tests, PHP lints, and more, can then be addressed in future PRs. |
If we are just using it from E2E tests, that I am not sure I see the benefit of using it all. If anything, it makes it hard to replicate if there is an error in e2e, as the envs are even more different from local / GHA. Can you provide more detail on these upstream blockers? Maybe we could work on these together to get the unblocked and so we can start using this package. |
To clarify, we'd be able to use it for local and E2E tests. But not for PHP unit tests or running any composer commands through docker
There's some discussion at WordPress/gutenberg#27783. In WordPress/gutenberg#27783 (comment) I posted a suggestion for a possible solution. Shouldn't be too difficult to implement, and maybe we could even patch it in our repository as well so that we don't have to wait for the fix to be published on npm. |
So the issue seems to be running in PHP 5.6? Is that correct. As much as I don't love this idea, could we not just disable tests running in that version of PHP until we can patch this / get a fix merged? |
It affects anything below 7.2, so 5.6, 7.0, and 7.1. That said, I've now added a patch for the wp-env package to work around this |
@wordpress/env
(wp-env) for local dev environment@wordpress/env
(wp-env) for local dev environment
8573bec
to
c5f6e32
Compare
This comment has been minimized.
This comment has been minimized.
689d1ca
to
b8728c5
Compare
b8728c5
to
cf43d5c
Compare
What's your node & npm version? |
|
And |
Node - v14.15.4 |
"env:start": "./bin/local-env/start.sh", | ||
"env:stop": "./bin/local-env/stop.sh", | ||
"env:reset-site": "./bin/local-env/install-wordpress.sh --reset-site", |
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.
Any chance we could just make these aliases? Means I don't have to change what I try and no learning curve for current devs on the project.
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.
Yeah maybe we can keep them for some time.
So the new setup doesn't create users and import media. Doesn't this break the e2e tests. How does this work if author isn't created? |
This comment has been minimized.
This comment has been minimized.
It still does, but you need to run
That... is strange. Have you perhaps used Which site are you on? http://localhost:8898 is the local development environment, http://localhost:8899 is the test environment |
Both the issues I have am having on linux and mac os are related to nodegit. |
Hmm maybe I accidentally dropped the hotfix for nodegit. I‘ll check |
The issue was my git pull didn't work so I was using an old version of plugin. I deleted the branch and rechecked out. Seemed to fix the problem. It because they are force pushes in the history. |
Worth noting, I started from a completely fresh install on my linux laptop. |
@spacedmonkey So the two main remaining issues I see here are:
Both are quite significant, and require upstream changes. Thus, I feel like we should put this ticket back into the backlog and revisit later. Thoughts? |
Summary
Instead of using a custom Docker setup for our local development environment, this uses the pre-existing
@wordpress/env
package dedicated for this task.This reduces the maintenance burden and simplifies setup for contributors. Over time, more and more things can be moved to run within
wp-env
, eventually removing the need to manually install PHP, Composer, and PHPUnit, for example.Relevant Technical Choices
@wordpress/env
package to allow running PHP unit tests via wp-env (otherwise blocked by wp-env: docker-compose fails on PHP < 7.2 due to Xdebug WordPress/gutenberg#27783)latest
WordPress version (blocked by wp-env with "core: null" installs WP 5.4.2, not the latest version (5.6.0) WordPress/gutenberg#27763)To-do
Upstream blockers
WordPress/gutenberg#27783
WordPress/gutenberg#28703 / WordPress/gutenberg#29430
WordPress/gutenberg#29323
WordPress/gutenberg#28201
WordPress/gutenberg#27763
WordPress/gutenberg#20569
So most of https://github.com/WordPress/gutenberg/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3A%22%5BPackage%5D+Env%22 basically
Additional Context
User-facing changes
N/A
Testing Instructions
npm run wp-env start -- --update --debug
npm run test:e2e:prepare
npm run test:e2e
Fixes #2521