-
Notifications
You must be signed in to change notification settings - Fork 806
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
Dev: Only one WordPress #41057
base: trunk
Are you sure you want to change the base?
Dev: Only one WordPress #41057
Conversation
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Follow this PR Review Process:
Still unsure? Reach out in #jetpack-developers for guidance! Beta plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Backup plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Boost plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Search plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Social plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Starter Plugin plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Protect plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Videopress plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Mu Wpcom plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Inspect plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Wpcomsh plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Automattic For agencies client plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. Classic Theme helper plugin plugin:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
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.
Saw this in a list and the title piqued my curiosity 😀
I wonder if the packages/test-environment
package is really needed. It seems to do about the same thing as just sticking something like this in each consumer's bootstrap.php would.
require dirname( __DIR__, 5 ) . '/tools/php-test-env/vendor/autoload.php';
\WorDBless\Load::load();
(vary the 5
as needed based on the directory structure). The one added require
seems less boilerplate than a whole extra package that in the end does the same thing.
If you still want the additional error handling, make a tools/php-test-env/load.php
file to require instead. 🤷
echo "::group::Composer" | ||
composer install --working-dir=tools/php-test-env | ||
echo "::endgroup::" |
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.
This probably needs to go after the bit just below that's clearing the Composer cache if we want WorDBless nightlies.
You'll probably also need to put code like this before this bit too for that case.
jetpack/.github/workflows/tests.yml
Lines 199 to 209 in d1a3fa1
if [[ "$WP_BRANCH" == 'trunk' || "$WP_BRANCH" == 'previous' ]]; then | |
VER=$(composer --format=json --working-dir="$DIR" show | jq -r '.installed[] | select( .name == "roots/wordpress" ) | .version') | |
if [[ -n "$VER" ]]; then | |
INSVER=$WORDPRESS_TAG | |
[[ "$WORDPRESS_TAG" == 'trunk' ]] && INSVER="dev-main as $VER" | |
echo "Supposed to run tests against WordPress $WORDPRESS_TAG, so setting roots/wordpress and roots/wordpress-no-content to \"$INSVER\"" | |
# Composer seems to sometimes have issues with deleting the wordpress dir on its own, so do it manually first. | |
rm -rf "$DIR/wordpress" | |
composer --working-dir="$DIR" require --dev roots/wordpress="$INSVER" roots/wordpress-no-content="$INSVER" | |
fi | |
fi |
(and could probably get rid of it there then)
For unit testing, we often use WorDBless, a variant of WordPress that does not require database setup. Except, we include it a lot so there are a lot of copies of WordPress within the repo when fully installed.
Before and after the changes proposed below (conducted in clean directories on my M1 with composer's cache cleared)
Before:
1st run of
jetpack install --all
: Between 2m 57s and 3m 17s2nd run: 56s
Size: (du of monorepo with du of .git subtracted): 5.1 GB
After:
1st run: Between 1m 20s and 1m 52s
2nd run: 55s
Size: 2.7 GB
Proposed changes:
test-environment
package to serve as the WorDBless loader for monorepo projects.jetpack install --all, -r
will cover it.In short, this changes the packages consumed by individual projects to use the internal test-environment. This ensure it is easy to modify all in the future and required little change to each individual package.
The test-environment loads a class that loads the test-php-env autoloader and loads WorDBless.
The test-php-env quasi-package does a singular install of WorDBless.
Other solution investigated was having the
test-environment
package directly require WorDBless, but that meant it would be re-installed every timetest-environment
was installed. No gain (at least) to install time, but it would have ended up with only one copy of WP.Other information:
Jetpack product discussion
None yet.
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
jetpack install -r
(at least) andjetpack install
a package that uses worDBLess, likepackages/admin-ui
jetpack test phh packages/admin-ui
Does it still run the test successfully?