Skip to content

Commit

Permalink
Performance Test: Reuse tests-branch build if possible
Browse files Browse the repository at this point in the history
When running the performance test suite we currently build three copies
of the plugin: one for each branch under test and also one for the branch
which provides the actual test suite.

In this patch we're checking first if one of the branches under test is
the same as that tests branch, and if so, re-using the built files from
that to avoid the additional approximately five minutes of building.
  • Loading branch information
dmsnell committed Nov 14, 2022
1 parent 36b6a19 commit 8c2b03d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions bin/plugin/commands/performance.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,23 @@ async function runPerformanceTests( branches, options ) {
await runShellScript( 'mkdir ' + environmentDirectory );
await runShellScript( `cp -R ${ baseDirectory } ${ buildPath }` );

log( ` >> Fetching the ${ formats.success( branch ) } branch` );
// @ts-ignore
await SimpleGit( buildPath ).reset( 'hard' ).checkout( branch );
const fancyBranch = formats.success( branch );

log( ` >> Building the ${ formats.success( branch ) } branch` );
await runShellScript( 'npm ci && npm run build', buildPath );
if ( branch === options.testsBranch ) {
log(
` >> Re-using the testing branch for ${ fancyBranch }`
);
await runShellScript(
`cp -R ${ performanceTestDirectory } ${ buildPath }`
);
} else {
log( ` >> Fetching the ${ fancyBranch } branch` );
// @ts-ignore
await SimpleGit( buildPath ).reset( 'hard' ).checkout( branch );

log( ` >> Building the ${ fancyBranch } branch` );
await runShellScript( 'npm ci && npm run build', buildPath );
}

await runShellScript(
'cp ' +
Expand Down

0 comments on commit 8c2b03d

Please sign in to comment.