[ci-jobs] Trigger test jobs for any dependency change (#47271)
This commit is contained in:
parent
082719b0fd
commit
90b190d93b
File diff suppressed because one or more lines are too long
|
@ -35,8 +35,6 @@
|
||||||
|
|
||||||
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
|
||||||
|
|
||||||
/*! fromentries. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
||||||
|
|
||||||
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
||||||
|
|
||||||
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */
|
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */
|
||||||
|
|
|
@ -178,7 +178,6 @@ async function createTestJob(
|
||||||
shardNumber: number
|
shardNumber: number
|
||||||
): Promise< TestJob | null > {
|
): Promise< TestJob | null > {
|
||||||
let triggered = false;
|
let triggered = false;
|
||||||
|
|
||||||
// When we're forcing changes for all projects we don't need to check
|
// When we're forcing changes for all projects we don't need to check
|
||||||
// for any changed files before triggering the job.
|
// for any changed files before triggering the job.
|
||||||
if ( changes === true ) {
|
if ( changes === true ) {
|
||||||
|
@ -272,6 +271,9 @@ async function createJobsForProject(
|
||||||
// In order to simplify the way that cascades work we're going to recurse depth-first and check our dependencies
|
// In order to simplify the way that cascades work we're going to recurse depth-first and check our dependencies
|
||||||
// for jobs before ourselves. This lets any cascade keys created in dependencies cascade to dependents.
|
// for jobs before ourselves. This lets any cascade keys created in dependencies cascade to dependents.
|
||||||
const newCascadeKeys = [];
|
const newCascadeKeys = [];
|
||||||
|
|
||||||
|
let dependencyChanges = false;
|
||||||
|
|
||||||
for ( const dependency of node.dependencies ) {
|
for ( const dependency of node.dependencies ) {
|
||||||
// Each dependency needs to have its own cascade keys so that they don't cross-contaminate.
|
// Each dependency needs to have its own cascade keys so that they don't cross-contaminate.
|
||||||
|
|
||||||
|
@ -287,6 +289,16 @@ async function createJobsForProject(
|
||||||
options,
|
options,
|
||||||
dependencyCascade
|
dependencyCascade
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
dependencyChanges === false &&
|
||||||
|
Object.values( dependencyJobs ).some(
|
||||||
|
( array ) => array.length > 0
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
dependencyChanges = true;
|
||||||
|
}
|
||||||
|
|
||||||
newJobs.lint.push( ...dependencyJobs.lint );
|
newJobs.lint.push( ...dependencyJobs.lint );
|
||||||
|
|
||||||
testTypes.forEach( ( type ) => {
|
testTypes.forEach( ( type ) => {
|
||||||
|
@ -365,8 +377,12 @@ async function createJobsForProject(
|
||||||
newJobs.lint.push( created );
|
newJobs.lint.push( created );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case JobType.Test: {
|
case JobType.Test: {
|
||||||
|
// If there are dependency changes, we need to trigger the job
|
||||||
|
if ( dependencyChanges ) {
|
||||||
|
projectChanges = true;
|
||||||
|
}
|
||||||
|
|
||||||
const created = await createTestJob(
|
const created = await createTestJob(
|
||||||
node.name,
|
node.name,
|
||||||
node.path,
|
node.path,
|
||||||
|
|
Loading…
Reference in New Issue