-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Refactor performance tests setup #49238
Changes from all commits
8326525
0a2195b
79ea0b0
f6464ea
f66c711
18d7449
b9da0d3
3a1259e
0484374
072a7bb
2638476
fd35da9
1e1563b
53cf2a1
62f5d99
abb3df1
166091c
0affd72
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ jobs: | |
|
||
- name: Compare performance with trunk | ||
if: github.event_name == 'pull_request' | ||
run: ./bin/plugin/cli.js perf $GITHUB_SHA trunk --tests-branch $GITHUB_SHA | ||
run: ./bin/plugin/cli.js perf trunk | ||
|
||
- name: Compare performance with current WordPress Core and previous Gutenberg versions | ||
if: github.event_name == 'release' | ||
|
@@ -48,32 +48,31 @@ jobs: | |
shell: bash | ||
run: | | ||
IFS=. read -ra PLUGIN_VERSION_ARRAY <<< "$PLUGIN_VERSION" | ||
CURRENT_RELEASE_BRANCH="release/${PLUGIN_VERSION_ARRAY[0]}.${PLUGIN_VERSION_ARRAY[1]}" | ||
PREVIOUS_VERSION_BASE_10=$((PLUGIN_VERSION_ARRAY[0] * 10 + PLUGIN_VERSION_ARRAY[1] - 1)) | ||
PREVIOUS_RELEASE_BRANCH="release/$((PREVIOUS_VERSION_BASE_10 / 10)).$((PREVIOUS_VERSION_BASE_10 % 10))" | ||
WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' readme.txt) | ||
IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION" | ||
WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" | ||
./bin/plugin/cli.js perf "wp/$WP_MAJOR" "$PREVIOUS_RELEASE_BRANCH" "$CURRENT_RELEASE_BRANCH" --wp-version "$WP_MAJOR" | ||
./bin/plugin/cli.js perf "$PREVIOUS_RELEASE_BRANCH" "wp/$WP_MAJOR" --wp-version "$WP_MAJOR" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did we remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we certain here that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
- name: Compare performance with base branch | ||
if: github.event_name == 'push' | ||
# The base hash used here need to be a commit that is compatible with the current WP version | ||
# The base hash used here need to be a commit that is compatible with the current WP version. | ||
# The current one is debd225d007f4e441ceec80fbd6fa96653f94737 and it needs to be updated every WP major release. | ||
# It is used as a base comparison point to avoid fluctuation in the performance metrics. | ||
run: | | ||
WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' readme.txt) | ||
IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION" | ||
WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}" | ||
./bin/plugin/cli.js perf $GITHUB_SHA debd225d007f4e441ceec80fbd6fa96653f94737 --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR" | ||
./bin/plugin/cli.js perf debd225d007f4e441ceec80fbd6fa96653f94737 --wp-version "$WP_MAJOR" | ||
|
||
- name: Compare performance with custom branches | ||
if: github.event_name == 'workflow_dispatch' | ||
env: | ||
BRANCHES: ${{ github.event.inputs.branches }} | ||
WP_VERSION: ${{ github.event.inputs.wpversion }} | ||
run: | | ||
./bin/plugin/cli.js perf $(echo $BRANCHES | tr ',' ' ') --tests-branch $GITHUB_SHA --wp-version "$WP_VERSION" | ||
./bin/plugin/cli.js perf $(echo $BRANCHES | tr ',' ' ') --wp-version "$WP_VERSION" | ||
|
||
- name: Archive performance results | ||
if: success() | ||
|
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.
How do we ensure that we run the performance tests that are on the PR. For instance when we make changes to the tests themselves?
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.
Oh If I'm reading this, there's now an assumption that the perf cli.js is included within a Gutenberg plugin and that we need we compare with the current git hash automatically and use it also as tests branch.
One of the initial goal of the cli is to actually be "independent", while it lives in the Gutenberg plugin, it doesn't have any requirement in the sense that the current branch could be broken, have edits to Gutenberg code... it doesn't matter, the tool would always perform a clone. In fact one goal was to make it independent of Gutenberg entirely and be a tool any plugin can use. It seems the current PR goes into the opposite direction.
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.
For the general direction of this PR, see my answer here.
I'm struggling to visualize the full picture of how the perf tests CLI runner, as an independent tool, would be utilized by other plugins. Would it not be running from the local gutenberg repo then, but would still be comparing gutenberg branches? It would be really helpful if you could give an example of a plugin development scenario where this tool is used 🙏
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, the initial goal was to be an independent tool, something like so:
The goal was also for the cli to include more than just perf command, maintaining changeling, releasing to SVN/Github was also a command that was part of the same tool, I see that it was removed now in favor of all the git workflows. I'm kind of sad that it didn't remain as a command to be used by the workflows instead of writing it within the workflow files like we do now.
Anyway, given that the previous direction is also to move away from the goal of being an independent tool, one more step away won't be that harmful here, so I guess feel free to make that change if you think it's a good idea.
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.
Oh, so by independent, you meant from Gutenberg entirely, which would run perf comparisons for any plugin?
If yes, I think we can still assume and leverage the fact that it will always be running from SOME plugin repo root and that the current branch will be a primary subject of the test. The CLI will still need to run the current plugin's dedicated perf tests, right? So it will be easier to develop/debug those tests with the CLI, and also utilize it by the target plugin's CI, where the current branch is always a primary reference.
Now that I think about it, we can replace
Gutenberg
with a genericplugin
in this refactored script, and it would be all that's needed to make this PR not tie it any further to Gutenberg. There's no check that the current repo is actually Gutenberg.Also, as I mentioned earlier, we can implement the
--from-origin
and build everything from GH if we don't want to use the local code.How does that sound?
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.
Sounds good to me 👍