Skip to content

Commit

Permalink
Change the performances job folder structure to avoid nested node_mod…
Browse files Browse the repository at this point in the history
…ules (#37775)
  • Loading branch information
youknowriad authored Jan 7, 2022
1 parent bd7f589 commit a22815b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
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

0 comments on commit a22815b

Please sign in to comment.