-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Replace wp-scripts env usage with wp-env in CI. #20280
Conversation
What about Lines 215 to 216 in 59b07cc
Line 228 in 59b07cc
@epiqueras - do you have some other open PRs that replace Edit: I see now #20090 from @noahtallen that should remove the need for running PHPUnit tests through |
Mine are all stale but I am pretty sure @noahtallen plans on doing this after he lands #20090. |
Size Change: 0 B Total Size: 1.12 MB ℹ️ View Unchanged
|
@gziolo Still testing the Travis config at the moment. Curiously there are two consistently failing tests indicating an issue with the media modal:
and
Possibly an issue uploading files? |
@talldan, is it using exactly the same version of WordPress to run e2e tests? Does it share the same configuration? I wouldn't be surprised if we discover some subtle differences. |
4ff8b74
to
f816733
Compare
f816733
to
8dd924a
Compare
I've rebased, there are more tests failing because I won't be working for the rest of the week. If this seems like something someone would like to take further feel free to push some commits to this branch or use this as a basic for a separate PR. |
Oh, the issue with uploads may be a permissions issue. The previous implementation had these lines that I abruptly removed:
From what I understand, with wp-env, the WordPress codebase is copied into a folder like What do you think @noisysocks, does it sound like that might be the issue? |
If you wanted to kick that can down the road you could set
Hmm, are you able to see the issue with uploading media when you run E2E tests using
If we aren't able to reproduce this locally, we could explore getting extra debug info using one or more of these methods:
|
Thanks for the info @noisysocks. e2e tests are now passing. |
There is still something wrong with PHPUnit tests. We are getting closer to sunset Great work you all 🥇 |
Using a Gutenberg PR as inspiration: WordPress/gutenberg#20280
I notice there's also #22303 now, which might supersede this. I rebased this anyway, and E2E tests are still passing, though PHP unit tests are still failing, which I found surprising. |
Yeah that’s odd. PHP is already on wp-env and seems to be working on most other PRs! |
|
||
// Ensure the tests uploads folder is writeable for travis, | ||
// creating the folder if necessary. | ||
const testsUploadsPath = path.join( |
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.
Should we chmod more broadly to allow other things to have write access (e.g. chmod all of wp-content
)? See some discussion around #22454 (comment) in which a PHP test doesn't have access to what it wants
This may also remove the need for a different chmod
I added in .travis.yml for the PHP test steps
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.
That seems like a good call. I can put together a separate PR to cover it.
Here's the phpunit error. It's actually something in wp-env:
This sounds awfully similar to this comment dealing with Ubuntu support: #20180 (comment). I think the workaround might just be to start the environment once (i.e. remove |
# Connect Gutenberg to WordPress. | ||
npm run env connect | ||
npm run env cli plugin activate gutenberg | ||
echo '{ "config": { "SCRIPT_DEBUG": false, "WP_PHP_BINARY": "php" } }' > .wp-env.override.json |
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.
I had to also add "WP_PHP_BINARY": "php"
here, as the default config was being overwritten by the .wp-env.override file. Using the override file like this won't be very maintainable.
Perhaps looking into command line options for overriding individual settings could be an option. e.g.:
npm run wp-env start --config SCRIPT_DEBUG=false
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.
we are also looking to add support for setting the config for different environments in .wp-env.json so that we can turn of SCRIPT_DEBUG etc for the tests environment without having to override anything.
Thanks for the troubleshooting @noahtallen, removing the other calls to Tests are passing now 🎉 |
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.
Since the tests are passing, I'm not sure if we need to do anything else for this PR specifically :)
It uncovered some things that would be good for wp-env in the future though:
- fix linux environment issue
- .wp-env.json should handle config for different environments
- need better permissions in the wordpress install so that tests etc have write access to the filesystem
I've made a couple of issues:
#20180 already covers linux env issues. |
Description
Uses
wp-env
for running Travis e2e tests instead ofwp-scripts env
.While the branch is named
deprecate/env
I haven't actually addressed any deprecations in this PR. I think that can be handled separately, I haven't renamed the branch as I think there's some useful history in the PR.