Configure workflow to expect 55 CI jobs

- Sets expected job count to 55 for faster stabilization

- Only checks for stability once expected count is reached

- Provides better progress tracking (X/55 jobs)
This commit is contained in:
Alexsander Hamir 2026-01-27 13:05:19 -08:00
parent 1f38e82362
commit dab4baa85e

View file

@ -17,11 +17,12 @@ jobs:
async function waitForJobsToStabilize() { async function waitForJobsToStabilize() {
let previousCount = 0; let previousCount = 0;
let stableCount = 0; let stableCount = 0;
const expectedJobCount = 55; // Expected number of CI jobs
const maxWaitMinutes = 5; const maxWaitMinutes = 5;
const checkIntervalSeconds = 30; const checkIntervalSeconds = 30;
const checksNeeded = 3; // Jobs must remain stable for 3 checks const checksNeeded = 3; // Jobs must remain stable for 3 checks
console.log('Waiting for CI jobs to stabilize...'); console.log(`Waiting for CI jobs to stabilize (expecting ~${expectedJobCount} jobs)...`);
for (let i = 0; i < (maxWaitMinutes * 60 / checkIntervalSeconds); i++) { for (let i = 0; i < (maxWaitMinutes * 60 / checkIntervalSeconds); i++) {
const { data: checks } = await github.rest.checks.listForRef({ const { data: checks } = await github.rest.checks.listForRef({
@ -38,17 +39,23 @@ jobs:
const currentCount = checks.check_runs.length + statuses.statuses.length; const currentCount = checks.check_runs.length + statuses.statuses.length;
console.log(`Check ${i + 1}: ${currentCount} total jobs (${checks.check_runs.length} checks + ${statuses.statuses.length} statuses)`); console.log(`Check ${i + 1}: ${currentCount}/${expectedJobCount} total jobs (${checks.check_runs.length} checks + ${statuses.statuses.length} statuses)`);
if (currentCount === previousCount) { // If we've reached expected count, check for stability
stableCount++; if (currentCount >= expectedJobCount) {
if (stableCount >= checksNeeded) { if (currentCount === previousCount) {
console.log(`✅ Job count stabilized at ${currentCount} jobs\n`); stableCount++;
return { checks, statuses }; if (stableCount >= checksNeeded) {
console.log(`✅ Job count stabilized at ${currentCount} jobs (expected ${expectedJobCount})\n`);
return { checks, statuses };
}
} else {
stableCount = 0;
console.log(`Job count changed from ${previousCount} to ${currentCount}, resetting stability counter`);
} }
} else { } else {
stableCount = 0; // Haven't reached expected count yet, just keep waiting
console.log(`Job count changed from ${previousCount} to ${currentCount}, resetting stability counter`); console.log(`Still waiting for more jobs... (${currentCount}/${expectedJobCount})`);
} }
previousCount = currentCount; previousCount = currentCount;
@ -58,7 +65,7 @@ jobs:
} }
} }
console.log(`⚠️ Timeout: Job count did not stabilize after ${maxWaitMinutes} minutes`); console.log(`⚠️ Timeout: Job count did not reach expected ${expectedJobCount} after ${maxWaitMinutes} minutes`);
// Return latest data even if not stable // Return latest data even if not stable
const { data: checks } = await github.rest.checks.listForRef({ const { data: checks } = await github.rest.checks.listForRef({
owner: context.repo.owner, owner: context.repo.owner,