mirror of
https://github.com/morluto/rea.git
synced 2026-12-05 14:31:22 +00:00
test(ci): share repository reads in required-lane fixtures (#16707)
This commit is contained in:
1 parent
b8492dac72
commit
fb131b6cc9
1 file changed
+16
-69
@@ -11,6 +11,9 @@ import {
|
||||
workflowFixtureEnvironment,
|
||||
} from "../../support/workflowGit.js";
|
||||
|
||||
const readRepoFile = (path: string): Promise<string> =>
|
||||
readFile(new URL(path, import.meta.url), "utf8");
|
||||
|
||||
const workflow = async (filename = "ci.yml") =>
|
||||
z
|
||||
.object({
|
||||
@@ -24,14 +27,7 @@ const workflow = async (filename = "ci.yml") =>
|
||||
.passthrough(),
|
||||
),
|
||||
})
|
||||
.parse(
|
||||
parse(
|
||||
await readFile(
|
||||
new URL(`../../../.github/workflows/${filename}`, import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
);
|
||||
.parse(parse(await readRepoFile(`../../../.github/workflows/${filename}`)));
|
||||
|
||||
const scopeFlags = async () =>
|
||||
z
|
||||
@@ -52,12 +48,7 @@ it("opts only the Noble binary-layout toolchain into the Ubuntu Azure archive fa
|
||||
}),
|
||||
);
|
||||
const action = async (name: string) =>
|
||||
parse(
|
||||
await readFile(
|
||||
new URL(`../../../.github/actions/${name}/action.yml`, import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
);
|
||||
parse(await readRepoFile(`../../../.github/actions/${name}/action.yml`));
|
||||
const archiveSteps = z
|
||||
.object({
|
||||
runs: z.object({ steps: z.array(z.object({ run: z.string() })) }),
|
||||
@@ -277,23 +268,14 @@ it("uses bounded APT provisioning before verifying packet captures", async () =>
|
||||
it("keeps every SQLite runtime selector inside the published package engine range", async () => {
|
||||
const { engines } = z
|
||||
.object({ engines: z.object({ node: z.string() }) })
|
||||
.parse(
|
||||
JSON.parse(
|
||||
await readFile(
|
||||
new URL("../../../package.json", import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
);
|
||||
.parse(JSON.parse(await readRepoFile("../../../package.json")));
|
||||
const { strategy } = z
|
||||
.object({
|
||||
strategy: z.object({ matrix: z.object({ node: z.array(z.string()) }) }),
|
||||
})
|
||||
.parse((await workflow("sqlite-runtime.yml")).jobs.sqlite);
|
||||
const selectors = strategy.matrix.node;
|
||||
const pinned = (
|
||||
await readFile(new URL("../../../.nvmrc", import.meta.url), "utf8")
|
||||
).trim();
|
||||
const pinned = (await readRepoFile("../../../.nvmrc")).trim();
|
||||
expect(selectors).toContain(pinned);
|
||||
expect(
|
||||
new Set(selectors.map((selector) => minVersion(selector)?.major)),
|
||||
@@ -334,14 +316,7 @@ it("binds SQLite compatibility jobs to the build's prepared runtime artifact and
|
||||
it("requires each named SQLite compatibility test while retaining both directory suites", async () => {
|
||||
const { scripts } = z
|
||||
.object({ scripts: z.record(z.string(), z.string()) })
|
||||
.parse(
|
||||
JSON.parse(
|
||||
await readFile(
|
||||
new URL("../../../package.json", import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
);
|
||||
.parse(JSON.parse(await readRepoFile("../../../package.json")));
|
||||
const commands = z
|
||||
.string()
|
||||
.parse(scripts["test:sqlite:run"])
|
||||
@@ -429,12 +404,7 @@ it("exports every canonical scope with read authority for admission and keeps te
|
||||
}),
|
||||
})
|
||||
.parse(
|
||||
parse(
|
||||
await readFile(
|
||||
new URL("../../../.github/workflows/ci-timings.yml", import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
parse(await readRepoFile("../../../.github/workflows/ci-timings.yml")),
|
||||
);
|
||||
expect(timings.on.workflow_run).toBeUndefined();
|
||||
expect(timings.on.schedule).toHaveLength(1);
|
||||
@@ -591,11 +561,7 @@ async function assertProviderCacheCallers(
|
||||
}),
|
||||
),
|
||||
})
|
||||
.parse(
|
||||
parse(
|
||||
await readFile(new URL(`../../../${path}`, import.meta.url), "utf8"),
|
||||
),
|
||||
);
|
||||
.parse(parse(await readRepoFile(`../../../${path}`)));
|
||||
expect(called.on.workflow_call.inputs.build_cache_artifact).toMatchObject({
|
||||
type: "string",
|
||||
default: "",
|
||||
@@ -757,12 +723,8 @@ it("binds provider build reuse to the current run while keeping standalone dispa
|
||||
})
|
||||
.parse(
|
||||
parse(
|
||||
await readFile(
|
||||
new URL(
|
||||
"../../../.github/actions/portable-build-cache/action.yml",
|
||||
import.meta.url,
|
||||
),
|
||||
"utf8",
|
||||
await readRepoFile(
|
||||
"../../../.github/actions/portable-build-cache/action.yml",
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -810,11 +772,7 @@ it("leaves cancellation ownership with CI so child lanes cannot cancel another t
|
||||
for (const path of children) {
|
||||
const child = z
|
||||
.object({ concurrency: z.unknown().optional() })
|
||||
.parse(
|
||||
parse(
|
||||
await readFile(new URL(`../../../${path}`, import.meta.url), "utf8"),
|
||||
),
|
||||
);
|
||||
.parse(parse(await readRepoFile(`../../../${path}`)));
|
||||
expect(
|
||||
child.concurrency,
|
||||
`${path} must use caller scheduling`,
|
||||
@@ -879,14 +837,7 @@ it("keeps fast feedback separate from complete qualification and release proof",
|
||||
}),
|
||||
),
|
||||
})
|
||||
.parse(
|
||||
parse(
|
||||
await readFile(
|
||||
new URL("../../../.github/workflows/ci.yml", import.meta.url),
|
||||
"utf8",
|
||||
),
|
||||
),
|
||||
);
|
||||
.parse(parse(await readRepoFile("../../../.github/workflows/ci.yml")));
|
||||
expect(ci.on.schedule).toEqual([
|
||||
{ cron: "23 1,5,7,11,13,17,19,23 * * *" },
|
||||
{ cron: "23 9,15,21 * * *" },
|
||||
@@ -1391,12 +1342,8 @@ it.skipIf(process.platform === "win32").each([
|
||||
})
|
||||
.parse(
|
||||
parse(
|
||||
await readFile(
|
||||
new URL(
|
||||
"../../../.github/actions/host-apt-packages/action.yml",
|
||||
import.meta.url,
|
||||
),
|
||||
"utf8",
|
||||
await readRepoFile(
|
||||
"../../../.github/actions/host-apt-packages/action.yml",
|
||||
),
|
||||
),
|
||||
).runs.steps[0];
|
||||
|
||||
Reference in new issue
Block a user