ci: split auto-reply shard timing

This commit is contained in:
Peter Steinberger
2026-04-25 23:46:56 +01:00
parent 1531123d35
commit 496d90c3b5
13 changed files with 382 additions and 96 deletions

View File

@@ -1,5 +1,9 @@
import { describe, expect, it } from "vitest";
import { summarizeRunTimings } from "../../scripts/ci-run-timings.mjs";
import {
parseRunTimingArgs,
selectLatestMainPushCiRun,
summarizeRunTimings,
} from "../../scripts/ci-run-timings.mjs";
describe("scripts/ci-run-timings.mjs", () => {
it("separates queue time from job duration", () => {
@@ -46,4 +50,58 @@ describe("scripts/ci-run-timings.mjs", () => {
["slow", 20],
]);
});
it("selects the push CI run for the current main SHA", () => {
expect(
selectLatestMainPushCiRun(
[
{
databaseId: 3,
event: "issue_comment",
headSha: "current",
},
{
databaseId: 2,
event: "push",
headSha: "older",
},
{
databaseId: 1,
event: "push",
headSha: "current",
},
],
"current",
),
).toMatchObject({ databaseId: 1 });
});
it("falls back to the newest push CI run when the exact SHA has not appeared yet", () => {
expect(
selectLatestMainPushCiRun(
[
{
databaseId: 4,
event: "issue_comment",
headSha: "current",
},
{
databaseId: 3,
event: "push",
headSha: "previous",
},
],
"current",
),
).toMatchObject({ databaseId: 3 });
});
it("ignores pnpm passthrough sentinels when parsing monitor args", () => {
expect(parseRunTimingArgs(["--latest-main", "--", "--limit", "3"])).toEqual({
explicitRunId: undefined,
limit: 3,
recentLimit: null,
useLatestMain: true,
});
});
});