ReviewOS

also looking at this

zig-utils/zig-test-framework

Add deterministic test sharding for distributed CI

#22
Merged glennmichael123 wants to merge codex/issue-4-deterministic-sharding into main
10 files +322 -5
build.zigmodified+10-0
Changes to build.zig
@@ -276,6 +276,16 @@ pub fn build(b: *std.Build) void {
276276 run_invalid_config.expectExitCode(2);
277277 test_step.dependOn(&run_invalid_config.step);
278278
279 // Exercise both sides of a file-level shard split. One shard runs the
280 // fixture and the other is intentionally empty; both are valid CI jobs.
281 const run_shard_one = b.addRunArtifact(exe);
282 run_shard_one.addArgs(&.{ "--test-dir", "tests", "--pattern", "sample.test.zig", "--shard-index", "1", "--shard-count", "2", "--no-color" });
283 test_step.dependOn(&run_shard_one.step);
284
285 const run_shard_two = b.addRunArtifact(exe);
286 run_shard_two.addArgs(&.{ "--test-dir", "tests", "--pattern", "sample.test.zig", "--shard-index", "2", "--shard-count", "2", "--no-color" });
287 test_step.dependOn(&run_shard_two.step);
288
279289 const run_version = b.addRunArtifact(exe);
280290 run_version.addArg("--version");
281291 run_version.expectStdErrEqual(b.fmt("Zig Test Framework v{s}\n", .{package_version}));