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

Change the performance job folder structure to avoid nested node_modules #37775

Merged
merged 1 commit into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ async function runPerformanceTests( branches, options ) {
log( '\n>> Preparing the tests directories' );
log( ' >> Cloning the repository' );
const baseDirectory = await git.clone( config.gitRepositoryURL );
const performanceTestDirectory = getRandomTemporaryPath();
const rootDirectory = getRandomTemporaryPath();
const performanceTestDirectory = rootDirectory + '/tests';
await runShellScript( 'mkdir -p ' + rootDirectory );
await runShellScript(
'cp -R ' + baseDirectory + ' ' + performanceTestDirectory
);
Expand All @@ -237,15 +239,15 @@ async function runPerformanceTests( branches, options ) {
performanceTestDirectory
);
log( ' >> Creating the environment folders' );
await runShellScript( 'mkdir perf-envs', performanceTestDirectory );
await runShellScript( 'mkdir -p ' + rootDirectory + '/envs' );

// 2- Preparing the environment directories per branch.
log( '\n>> Preparing an environment directory per branch' );
const branchDirectories = {};
for ( const branch of branches ) {
log( ' >> Branch: ' + branch );
const environmentDirectory =
performanceTestDirectory + '/perf-envs/' + kebabCase( branch );
rootDirectory + '/envs/' + kebabCase( branch );
// @ts-ignore
branchDirectories[ branch ] = environmentDirectory;
await runShellScript( 'mkdir ' + environmentDirectory );
Expand Down Expand Up @@ -330,7 +332,7 @@ async function runPerformanceTests( branches, options ) {
log( ' >> Branch: ' + branch + ', Suite: ' + testSuite );
log( ' >> Starting the environment.' );
await runShellScript(
'../../node_modules/.bin/wp-env start',
'../../tests/node_modules/.bin/wp-env start',
environmentDirectory
);
log( ' >> Running the test.' );
Expand All @@ -340,7 +342,7 @@ async function runPerformanceTests( branches, options ) {
);
log( ' >> Stopping the environment' );
await runShellScript(
'../../node_modules/.bin/wp-env stop',
'../../tests/node_modules/.bin/wp-env stop',
environmentDirectory
);
}
Expand Down
6 changes: 3 additions & 3 deletions bin/plugin/utils/.wp-env.performance.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"core": "WordPress/WordPress",
"plugins": [ "./plugin" ],
"themes": [ "../../test/emptytheme" ],
"themes": [ "../../tests/test/emptytheme" ],
"env": {
"tests": {
"mappings": {
"wp-content/mu-plugins": "../../packages/e2e-tests/mu-plugins",
"wp-content/plugins/gutenberg-test-plugins": "../../packages/e2e-tests/plugins"
"wp-content/mu-plugins": "../../tests/packages/e2e-tests/mu-plugins",
"wp-content/plugins/gutenberg-test-plugins": "../../tests/packages/e2e-tests/plugins"
}
}
}
Expand Down
15 changes: 6 additions & 9 deletions docs/explanations/architecture/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,19 @@ To get the most accurate results, it's is important to use the exact same versio
To achieve that the command first prepares the following folder structure:

├── packages/e2e-tests/specs/performance/*
├── tests/packages/e2e-tests/specs/performance/*
| The actual performance tests to run
├── test/emptytheme
├── tests/test/emptytheme
| The theme used for the tests environment. (site editor)
│── perf-envs/branch1/.wp-env.json
│── envs/branch1/.wp-env.json
│ The wp-env config file for branch1 (similar to all other branches except the plugin folder).
│── perf-envs/branch1/plugin
│── envs/branch1/plugin
│ A built clone of the Gutenberg plugin for branch1 (git checkout branch1)
├── perf-envs/branchX
│ The structure of perf-envs/branch1 is duplicated for all other branches.
└── ...
The remaining files of the Gutenberg repository (packages..., all what's necessary to actually run the performance tests job)
└── envs/branchX
The structure of perf-envs/branch1 is duplicated for all other branches.

Once the directory above is in place, the performance command loop over the performance test suites (post editor and site editor) and does the following:

Expand Down