Code-analyzer: Perform build between checkouts to avoid failures (#34438)
Fixes #34196
This commit is contained in:
parent
b2c3ef8f29
commit
7f5f47247c
|
@ -126,11 +126,16 @@ export default class Analyzer extends Command {
|
|||
|
||||
const pluginPath = join( tmpRepoPath, 'plugins/woocommerce' );
|
||||
|
||||
// Note doing the minimal work to get a DB scan to work, avoiding full build for speed.
|
||||
execSync( 'composer install', { cwd: pluginPath, stdio: [] } );
|
||||
execSync( 'pnpm run build:feature-config --filter=woocommerce', {
|
||||
cwd: pluginPath,
|
||||
} );
|
||||
const build = () => {
|
||||
// Note doing the minimal work to get a DB scan to work, avoiding full build for speed.
|
||||
execSync( 'composer install', { cwd: pluginPath, stdio: [] } );
|
||||
execSync(
|
||||
'pnpm run build:feature-config --filter=woocommerce',
|
||||
{
|
||||
cwd: pluginPath,
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
CliUx.ux.action.stop();
|
||||
CliUx.ux.action.start(
|
||||
|
@ -141,6 +146,7 @@ export default class Analyzer extends Command {
|
|||
tmpRepoPath,
|
||||
compare,
|
||||
base,
|
||||
build,
|
||||
( e: string ): void => this.error( e )
|
||||
);
|
||||
|
||||
|
|
|
@ -215,6 +215,7 @@ export const getSchema = async (
|
|||
* @param {string} tmpRepoPath Path to repository used to generate schema diff.
|
||||
* @param {string} compare Branch/commit hash to compare against the base.
|
||||
* @param {string} base Base branch/commit hash.
|
||||
* @param build Build to perform between checkouts.
|
||||
* @param {Function} error error print method.
|
||||
* @return {Object|void} diff object.
|
||||
*/
|
||||
|
@ -222,6 +223,7 @@ export const generateSchemaDiff = async (
|
|||
tmpRepoPath: string,
|
||||
compare: string,
|
||||
base: string,
|
||||
build: () => void,
|
||||
error: ( s: string ) => void
|
||||
): Promise< {
|
||||
[ key: string ]: {
|
||||
|
@ -241,6 +243,7 @@ export const generateSchemaDiff = async (
|
|||
|
||||
// Force checkout because sometimes a build will generate a lockfile change.
|
||||
await git.checkout( base, [ '--force' ] );
|
||||
build();
|
||||
const baseSchema = await getSchema(
|
||||
tmpRepoPath,
|
||||
( errorMessage: string ) => {
|
||||
|
@ -255,6 +258,7 @@ export const generateSchemaDiff = async (
|
|||
|
||||
// Force checkout because sometimes a build will generate a lockfile change.
|
||||
await git.checkout( compare, [ '--force' ] );
|
||||
build();
|
||||
const compareSchema = await getSchema(
|
||||
tmpRepoPath,
|
||||
( errorMessage: string ) => {
|
||||
|
|
Loading…
Reference in New Issue