ci: restore timing summary artifact (#87832)

* ci: restore timing summary artifact

* ci: report pnpm warmup fanout timing

* ci: run timing summary from trusted base
This commit is contained in:
Dallin Romney
2026-05-28 18:08:12 -07:00
committed by GitHub
parent 00067563a6
commit 93c30de17b
5 changed files with 257 additions and 11 deletions

View File

@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import {
parseRunTimingArgs,
selectLatestMainPushCiRun,
summarizePnpmStoreWarmupBarrier,
summarizeRunTimings,
} from "../../scripts/ci-run-timings.mjs";
@@ -80,6 +81,71 @@ describe("scripts/ci-run-timings.mjs", () => {
});
});
it("summarizes the pnpm store warmup fanout barrier", () => {
expect(
summarizePnpmStoreWarmupBarrier({
conclusion: "success",
createdAt: "2026-05-28T23:03:01Z",
jobs: [
{
completedAt: "2026-05-28T23:04:05Z",
conclusion: "success",
name: "preflight",
startedAt: "2026-05-28T23:03:55Z",
status: "completed",
},
{
completedAt: "2026-05-28T23:04:27Z",
conclusion: "success",
name: "pnpm-store-warmup",
startedAt: "2026-05-28T23:04:07Z",
status: "completed",
},
{
completedAt: "2026-05-28T23:06:26Z",
conclusion: "success",
name: "checks-fast-bundled-protocol",
startedAt: "2026-05-28T23:04:29Z",
status: "completed",
},
{
completedAt: "2026-05-28T23:04:28Z",
conclusion: "skipped",
name: "check-docs",
startedAt: "2026-05-28T23:04:28Z",
status: "completed",
},
{
completedAt: "2026-05-28T23:04:35Z",
conclusion: "success",
name: "security-fast",
startedAt: "2026-05-28T23:03:55Z",
status: "completed",
},
{
completedAt: "2026-05-28T23:05:30Z",
conclusion: "success",
name: "checks-node-compat-node22",
startedAt: "2026-05-28T23:04:30Z",
status: "completed",
},
],
status: "completed",
updatedAt: "2026-05-28T23:07:33Z",
}),
).toEqual({
activePostWarmupJobCount: 1,
firstPostWarmupStartDelaySeconds: 2,
postWarmupP95StartDelaySeconds: 2,
postWarmupStartedWithinWindow: 1,
preflightToWarmupCompleteSeconds: 22,
preflightToWarmupStartSeconds: 2,
warmupDurationSeconds: 20,
warmupResult: "completed/success",
windowSeconds: 5,
});
});
it("falls back to the newest push CI run when the exact SHA has not appeared yet", () => {
expect(
selectLatestMainPushCiRun(

View File

@@ -47,6 +47,58 @@ describe("ci workflow guards", () => {
expect(buildArtifactSteps.some((step) => step.run === "pnpm ui:build")).toBe(false);
});
it("uploads a CI timing summary after the run lanes finish", () => {
const workflow = readCiWorkflow();
const timingJob = workflow.jobs["ci-timings-summary"];
expect(timingJob.permissions).toMatchObject({ actions: "read", contents: "read" });
expect(timingJob.needs).toEqual([
"preflight",
"security-fast",
"pnpm-store-warmup",
"build-artifacts",
"checks-fast-core",
"checks-fast-plugin-contracts-shard",
"checks-fast-channel-contracts-shard",
"checks-node-compat",
"checks-node-core-test-nondist-shard",
"check-shard",
"check-additional-shard",
"check-docs",
"skills-python",
"checks-windows",
"macos-node",
"macos-swift",
"android",
]);
expect(timingJob.if).toContain("always()");
expect(timingJob.if).toContain("!cancelled()");
const checkoutStep = timingJob.steps.find(
(step) => step.name === "Checkout timing summary helper",
);
expect(checkoutStep.uses).toBe("actions/checkout@v6");
expect(checkoutStep.with.ref).toBe(
"${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || needs.preflight.outputs.checkout_revision || github.sha }}",
);
expect(checkoutStep.with["persist-credentials"]).toBe(false);
const writeStep = timingJob.steps.find((step) => step.name === "Write CI timing summary");
expect(writeStep.env).toMatchObject({ GH_TOKEN: "${{ github.token }}" });
expect(writeStep.run).toContain(
'node scripts/ci-run-timings.mjs "$GITHUB_RUN_ID" --limit 25 > ci-timings-summary.txt',
);
expect(writeStep.run).toContain('cat ci-timings-summary.txt >> "$GITHUB_STEP_SUMMARY"');
const uploadStep = timingJob.steps.find((step) => step.name === "Upload CI timing summary");
expect(uploadStep.uses).toBe("actions/upload-artifact@v7");
expect(uploadStep.with).toMatchObject({
name: "ci-timings-summary",
path: "ci-timings-summary.txt",
"retention-days": 14,
});
});
it("keeps push docs validation ClawHub-backed", () => {
const workflow = readFileSync(".github/workflows/docs.yml", "utf8");