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

Move PL plugin under plugins/performance-lab #1182

Merged
merged 39 commits into from May 22, 2024

Conversation

thelovekesh
Copy link
Member

Summary

Fixes #1165

Relevant technical choices

  • Relocate the plugin to the plugins/performance-lab directory.
  • Create a dummy plugin file in the root directory for wp-env mounting purposes and to display an administrative notification if an attempt is made to install it on a production environment.

@thelovekesh thelovekesh added [Type] Enhancement A suggestion for improvement of an existing feature Infrastructure Issues for the overall performance plugin infrastructure no milestone PRs that do not have a defined milestone for release labels Apr 25, 2024
* Description: The Performance Monorepo is not a plugin rather a collection of performance features as plugins. Download <a href="https://wordpress.org/plugins/performance-lab/" to install performance features instead.
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* Text Domain: performance-lab
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially, I kept it performance but tests have performance-lab text domain so switched it. But keeping it performance-lab doesn't seem right given it's already taken by the PL plugin.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of providing some feedback to anyone who tries to install the whole repo. I think using the performance-lab text domain is likely fine. I wonder if we could even automatically load the root file for the actual Performance Lab plugin if someone ends up in this situation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joemcgill For users utilizing wp-env, it should function as expected. However, for those with custom setups, we should include documentation on how to work with the monorepo. Simply activating the PL plugin isn't sufficient since we need to provide references to other plugins as well. It could also be confusing if one plugin from the /plugins directory is loaded while others are not.

@westonruter Any thoughts here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're currently lacking such documentation for users who want to work on the standalone plugins as well, so I don't see this as a blocker.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've updated notices in 8cbac0c with a link to the handbook page. We can add documentation there for how to handle contributing when not using wp-env.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a good step. Thanks.

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

performance.php Outdated Show resolved Hide resolved
},
1
);
if ( 'performance-lab' === $plugin_name ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the --testsuite need to always be supplied now? If $plugi_bane is empty, shouldn't an error occur?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have set the default test suite to performance-lab. See 7a5dea4

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: thelovekesh <thelovekesh@git.wordpress.org>
Co-authored-by: westonruter <westonruter@git.wordpress.org>
Co-authored-by: joemcgill <joemcgill@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@westonruter
Copy link
Member

Let's prioritize merging this right after the 3.1.0 release.

Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dig this idea and it's looking really good. I've added some feedback inline.

.wp-env.json Show resolved Hide resolved
bin/plugin/commands/readme.js Outdated Show resolved Hide resolved
bin/plugin/commands/since.js Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't test this workflow in debug mode until after this PR is merged, so let's make sure to check that this works once after merging.

* Description: The Performance Monorepo is not a plugin rather a collection of performance features as plugins. Download <a href="https://wordpress.org/plugins/performance-lab/" to install performance features instead.
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* Text Domain: performance-lab
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of providing some feedback to anyone who tries to install the whole repo. I think using the performance-lab text domain is likely fine. I wonder if we could even automatically load the root file for the actual Performance Lab plugin if someone ends up in this situation?

phpcs.xml.dist Outdated Show resolved Hide resolved
plugins/performance-lab/phpcs.xml.dist Outdated Show resolved Hide resolved
@westonruter westonruter added this to the performance-lab n.e.x.t milestone May 20, 2024
@thelovekesh
Copy link
Member Author

thelovekesh commented May 22, 2024

In my opinion, the contents of .gitattributes for ignoring files in the archive are no longer relevant.

@westonruter
Copy link
Member

westonruter commented May 22, 2024

In my opinion, the contents of .gitattributes for ignoring files in the archive are no longer relevant.

@thelovekesh Agreed. Let's eliminate all of these lines:

/.git export-ignore
/.github export-ignore
/.wordpress-org export-ignore
/.husky export-ignore
/node_modules export-ignore
/vendor export-ignore
/bin export-ignore
/docs export-ignore
/tests export-ignore
/plugin-tests export-ignore
/plugins export-ignore
/plugins.json export-ignore
/*.DS_store export-ignore
/.DS_store? export-ignore
/.editorconfig export-ignore
/.eslintrc.js export-ignore
/.nvmrc export-ignore
/.wp-env.json export-ignore
/composer.json export-ignore
/composer.lock export-ignore
/package.json export-ignore
/package-lock.json export-ignore
phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore
/webpack.config.js export-ignore
/CONTRIBUTING.md export-ignore
/SECURITY.md export-ignore
/README.md export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/modules/**/readme.txt export-ignore
/modules/**/.wordpress-org export-ignore
/plugins/**/.wordpress-org export-ignore

- plugins
- tests
- performance.php
- plugins/performance-lab/load.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is redundant since it is already inside the plugins directory now:

Suggested change
- plugins/performance-lab/load.php

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@westonruter If I remove this, I got the following error:

 ------ ------------------------------------------------------------------------------------------------ 
  Line   tests/plugins/performance-lab/load-tests.php                                                    
 ------ ------------------------------------------------------------------------------------------------ 
  :35    Call to method PHPUnit\Framework\Assert::assertFalse() with int will always evaluate to false.  
  :50    Call to method PHPUnit\Framework\Assert::assertFalse() with int will always evaluate to false.  
  :73    Call to method PHPUnit\Framework\Assert::assertFalse() with int will always evaluate to false.  
  :144   Call to method PHPUnit\Framework\Assert::assertFalse() with int will always evaluate to false.  
 ------ ------------------------------------------------------------------------------------------------ 

I think it has something to do with the file loading order.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. I don't get that error with that line removed.

$ npm run phpstan

> phpstan
> composer phpstan

> phpstan analyse --memory-limit=2048M
Note: Using configuration file /home/westonruter/repos/performance/phpstan.neon.dist.
 107/107 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%


                                                                                                                        
 [OK] No errors                                                                                                         
                                                                                                                        

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Which version are you on?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.11.1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try with --debug flag once since it disables the cache? Also, it was failing in CI as well - https://github.com/WordPress/performance/actions/runs/9111313232/job/25048167246

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm. No errors when passing --debug either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

No configs override with phpstan.neon in the root?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No 😞

$ npm run phpstan -- -- --debug

> phpstan
> composer phpstan -- --debug

> phpstan analyse --memory-limit=2048M '--debug'

 ! [NOTE] The Xdebug PHP extension is active, but "--xdebug" is not used.                                               
 !        The process was restarted and it will not halt at breakpoints.                                                
 !        Use "--xdebug" if you want to halt at breakpoints.                                                            

Note: Using configuration file /home/westonruter/repos/performance/phpstan.neon.dist.
/home/westonruter/repos/performance/plugins/optimization-detective/class-od-data-validation-exception.php
...
/home/westonruter/repos/performance/performance.php

                                                                                                                        
 [OK] No errors                                                                                                         
                                                                                                                        

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failing in wp-env as well with and without XDebug.

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work and great changes! 🎉

package.json Outdated Show resolved Hide resolved
thelovekesh and others added 2 commits May 23, 2024 00:31
Co-authored-by: Weston Ruter <westonruter@google.com>
Copy link
Member

@joemcgill joemcgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should go ahead and merge this. I think there's some follow-up work we need to do to make it easier to run PHPUnit locally, but that can be handled in a follow-up issue.

@westonruter westonruter merged commit 8eeaeb6 into trunk May 22, 2024
18 checks passed
@westonruter westonruter deleted the move/pl-plugin-to-plugins branch May 22, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall performance plugin infrastructure no milestone PRs that do not have a defined milestone for release [Type] Enhancement A suggestion for improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move PL plugin under plugins/performance-lab
3 participants