Skip to content

Commit

Permalink
Update the performance job to use the same environment config
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jan 5, 2022
1 parent e733234 commit 695d793
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ coverage
*.log
yarn.lock
/artifacts
/perf-envs

.cache
*.tsbuildinfo
Expand Down
22 changes: 18 additions & 4 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ async function runPerformanceTests( branches, options ) {
}

// 1- Preparing the tests directory.
log( '\n>> Preparing the tests directory' );
log( '\n>> Preparing the tests directories' );
log( ' >> Cloning the repository' );
const baseDirectory = await git.clone( config.gitRepositoryURL );
const performanceTestDirectory = getRandomTemporaryPath();
Expand All @@ -236,19 +236,33 @@ async function runPerformanceTests( branches, options ) {
'npm install && npm run build:packages',
performanceTestDirectory
);
log( ' >> Creating the environment folders' );
await runShellScript( 'mkdir perf-envs', performanceTestDirectory );

// 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 = getRandomTemporaryPath();
const environmentDirectory =
performanceTestDirectory + '/perf-envs/' + branch;
// @ts-ignore
branchDirectories[ branch ] = environmentDirectory;
await runShellScript( 'mkdir ' + environmentDirectory );
await runShellScript(
'cp -R ' + baseDirectory + ' ' + environmentDirectory
'cp -R ' + baseDirectory + ' ' + environmentDirectory + '/plugin'
);
await setUpGitBranch( branch, environmentDirectory + '/plugin' );
await runShellScript(
'cp ' +
path.resolve(
performanceTestDirectory,
'bin/plugin/utils/.wp-env.performance.json'
) +
' ' +
environmentDirectory +
'/.wp-env.json'
);
await setUpGitBranch( branch, environmentDirectory );

if ( options.wpVersion ) {
// In order to match the topology of ZIP files at wp.org, remap .0
Expand Down
12 changes: 12 additions & 0 deletions bin/plugin/utils/.wp-env.performance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"core": "WordPress/WordPress",
"plugins": [ "./plugin" ],
"themes": [ "../../tests/emptytheme" ],
"env": {
"tests": {
"mappings": {
"wp-content/mu-plugins": "../../packages/e2e-tests/mu-plugins"
}
}
}
}

0 comments on commit 695d793

Please sign in to comment.