mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-06 10:48:12 +02:00
refactor(ci): split workspaces-a into two Vitest native shards
Split the slow workspaces-a CI lane into two Vitest native shards and keep release verification in parity. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
6601014898
commit
d648becb90
5 files changed
+91
-10
No files matched your search
@@ -84,6 +84,15 @@ test("release verify workflow covers the same split test surface as stable PR ve
|
||||
assert.match(verifyWorkflow, new RegExp(`shard_index: ${shardIndex}[\\s\\S]*?shard_count: 5`));
|
||||
}
|
||||
|
||||
// workspaces-a splits with Vitest native --shard in pr.yml; release
|
||||
// verification must keep the same two-shard coverage.
|
||||
for (const shardIndex of [0, 1]) {
|
||||
assert.match(
|
||||
verifyWorkflow,
|
||||
new RegExp(`group: general-workspaces-a[\\s\\S]*?shard_index: ${shardIndex}\\n\\s+shard_count: 2`),
|
||||
);
|
||||
}
|
||||
|
||||
assert.match(verifyWorkflow, /pnpm test:run:general -- --group/);
|
||||
assert.match(verifyWorkflow, /pnpm test:run:serialized -- --shard-index/);
|
||||
});
|
||||
@@ -77,9 +77,37 @@ test("a route/authz suite never leaks into the general-server shards", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("shard flags are rejected for the parallel workspace groups", () => {
|
||||
const result = dryRun(["--mode", "general", "--group", "general-workspaces-a", "--shard-index", "0", "--shard-count", "3"]);
|
||||
assert.notEqual(result.status, 0, "workspace groups must not accept shard flags");
|
||||
test("shard flags are rejected for the workspaces-b group", () => {
|
||||
const result = dryRun(["--mode", "general", "--group", "general-workspaces-b", "--shard-index", "0", "--shard-count", "3"]);
|
||||
assert.notEqual(result.status, 0, "workspaces-b must not accept shard flags");
|
||||
});
|
||||
|
||||
test("workspaces-a shards map to Vitest native --shard slices over a stable project list", () => {
|
||||
const shards = [0, 1].map((index) =>
|
||||
dryRunJson([
|
||||
"--mode", "general", "--group", "general-workspaces-a",
|
||||
"--shard-index", String(index), "--shard-count", "2",
|
||||
]),
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
shards.map((shard) => shard.workspacesVitestShard),
|
||||
["1/2", "2/2"],
|
||||
"each matrix job must pass its own --shard slice to vitest",
|
||||
);
|
||||
// Vitest's --shard partitions each project's file list deterministically, so
|
||||
// an identical project list across jobs is what guarantees complete,
|
||||
// non-overlapping coverage of the lane.
|
||||
assert.deepEqual(shards[0].workspaceProjects, shards[1].workspaceProjects);
|
||||
assert.ok(shards[0].workspaceProjects.length > 0, "workspaces-a must run at least one project");
|
||||
|
||||
const unsharded = dryRunJson(["--mode", "general", "--group", "general-workspaces-a"]);
|
||||
assert.deepEqual(
|
||||
unsharded.workspaceProjects,
|
||||
shards[0].workspaceProjects,
|
||||
"sharding must not change which projects the lane covers",
|
||||
);
|
||||
assert.equal(unsharded.workspacesVitestShard, null);
|
||||
});
|
||||
|
||||
test("duration-aware partition balances skewed weights better than round-robin", () => {
|
||||
|
||||
Reference in new issue
Block a user