Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(ci): run ex63 lanes serially with shared build dirs

Steven Enamakel5a123760bb9c
diff --git a/scripts/ci/self-hosted/compare-runs.mjs b/scripts/ci/self-hosted/compare-runs.mjs
index 5d4e5927ba..c25ee90365 100644
--- a/scripts/ci/self-hosted/compare-runs.mjs
+++ b/scripts/ci/self-hosted/compare-runs.mjs
@@ -183,11 +183,7 @@ function main(argv) {
const per = Object.entries(laneMinutes(t))
.map(([k, v]) => `${k}=${v}m`)
.join(" ");
- const hits = t.sccache?.stats?.cache_hits?.counts?.Rust;
- const misses = t.sccache?.stats?.cache_misses?.counts?.Rust;
- const sc =
- hits != null ? ` sccache rust hits=${hits} misses=${misses}` : "";
- console.log(`| ↳ ${kind} lanes | ${per}${sc} | | | |`);
+ console.log(`| ↳ ${kind} lanes | ${per} | | | |`);
}
}
}
diff --git a/scripts/ci/self-hosted/lanes-plan.mjs b/scripts/ci/self-hosted/lanes-plan.mjs
index 8875d840d2..786d0284a2 100644
--- a/scripts/ci/self-hosted/lanes-plan.mjs
+++ b/scripts/ci/self-hosted/lanes-plan.mjs
@@ -134,29 +134,26 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
const nodeCache = ex63 ? "${CI_CACHE_DIR:-/cache}/node-tools" : null;
const core = areas.rustCore;
- // ex63: one throwaway target dir per lane so lanes never queue on cargo's
- // build-dir lock; sccache warms the build from the host's shared, capped
- // store (or the slot's /cache disk when the store is down). sccache keys
- // include the target dir, so a lane shares with the same lane of every
- // earlier job on any VM, not with the other lanes.
- // hosted: cargo's default target dirs, which Swatinem/rust-cache restores.
- const targetDir = (lane) => (ex63 ? `${scratch}/target/${lane}` : null);
- const sccache = ex63 ? { RUSTC_WRAPPER: "sccache" } : {};
- const rustEnv = {
+ // Private lanes run sequentially and share compatible build products.
+ // Instrumented objects stay separate from ordinary build/link checks.
+ const targetDir = (lane) => ex63
+ ? `target/ci-private-${lane === "cov" ? "coverage" : "build"}`
+ : null;
+ const rustEnv = ex63 ? {
+ CARGO_INCREMENTAL: "0",
+ RUSTC_WRAPPER: "",
+ RUSTC_WORKSPACE_WRAPPER: "",
+ CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: "/usr/local/bin/rust-mold-linker",
+ } : {
CARGO_INCREMENTAL: "0",
RUSTFLAGS: "-C link-arg=-fuse-ld=mold",
};
- // Instrumented builds: no DWARF, a large test stack, and on hosted the
- // serialized build ci-lite needs to fit the runner's disk. On ex63 they go
- // through sccache too: cargo-llvm-cov chains an existing RUSTC_WRAPPER in
- // both its wrapper and RUSTFLAGS modes, and cache hits give byte-identical
- // lcov (checked with cargo-llvm-cov 0.8 and sccache 0.10). Hosted keeps
- // ci-lite's wrapper-free setup.
+ const sccache = {};
const covEnv = {
...rustEnv,
CARGO_PROFILE_DEV_DEBUG: "0",
RUST_MIN_STACK: "67108864",
- ...(ex63 ? sccache : { CARGO_BUILD_JOBS: "1" }),
+ ...(!ex63 ? { CARGO_BUILD_JOBS: "1" } : {}),
};
const modulesDir = ex63
? `${scratch}/test-modules`
@@ -173,13 +170,6 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
// arms this job for any change under core, embed, tinyhumans, rpc, cli or
// tui, which is every crate the TUI depends on.
//
- // Also left to those pushes, as duplicates of what runs here:
- // - `cargo test -p openhuman-embed` / `-p openhuman-tinyhumans` (default
- // features): rust-core-coverage already runs both crates' tests, with the
- // product features;
- // - `cargo check -p openhuman --no-default-features`: embed-check-no-default
- // builds the core with exactly that feature set (none) as its dependency.
-
/** @type {Lane[]} */
const lanes = [
{
@@ -595,6 +585,36 @@ export function buildPlan({ profile, areas, env = {}, isPullRequest = true }) {
},
];
+ if (ex63) {
+ for (const lane of lanes) {
+ if (!["rust-gates-off", "storage-drivers"].includes(lane.name)) continue;
+ for (const check of lane.checks) {
+ if (!check.run.startsWith("cargo test ")) continue;
+ const [cargoArgs, filters] = check.run.slice("cargo test ".length).split(" --");
+ let args = cargoArgs.replace("--no-fail-fast ", "");
+ let expression = "";
+ let serial = "";
+ if (filters) {
+ const include = [];
+ const exclude = [];
+ const tokens = filters.trim().split(/\s+/);
+ for (let i = 0; i < tokens.length; i++) {
+ if (tokens[i] === "--skip") exclude.push(tokens[++i]);
+ else if (tokens[i] === "--test-threads=1") serial = " --test-threads=1";
+ else include.push(tokens[i]);
+ }
+ const terms = include.map((f) => `test(${f})`).join(" | ");
+ expression = ` -E '${terms ? `(${terms})` : "all()"}${exclude.map((f) => ` & not test(${f})`).join("")}'`;
+ }
+ check.env = { ...covEnv, CARGO_BUILD_TARGET_DIR: "target/ci-private-coverage" };
+ check.run = `cargo llvm-cov nextest --profile ci --no-fail-fast --no-tests=fail --no-clean ${args}${expression}${serial} --lcov --output-path ci-out/lcov/lcov-${check.name}.info`;
+ }
+ }
+ const tauri = lanes.find((l) => l.name === "tauri").checks.find((c) => c.name === "tauri-coverage");
+ tauri.env = { ...covEnv, CARGO_BUILD_TARGET_DIR: "target/ci-private-coverage" };
+ tauri.run = "unset RUSTFLAGS RUSTC_WRAPPER && cargo llvm-cov nextest --profile ci --no-fail-fast --no-tests=fail --no-clean --no-rustc-wrapper --manifest-path crates/openhuman-app/Cargo.toml --lcov --output-path ci-out/lcov/lcov-tauri.info";
+ }
+
for (const lane of lanes) {
lane.checks = lane.checks.map((c) => ({
...c,
diff --git a/scripts/ci/self-hosted/lanes.mjs b/scripts/ci/self-hosted/lanes.mjs
index 682a991b87..7119e33f28 100644
--- a/scripts/ci/self-hosted/lanes.mjs
+++ b/scripts/ci/self-hosted/lanes.mjs
@@ -169,8 +169,6 @@ export function renderSummary(results) {
"",
`VM memory: ${(mem.totalMiB / 1024).toFixed(1)} GiB, lowest available ${mem.minAvailableMiB == null ? "?" : `${(mem.minAvailableMiB / 1024).toFixed(1)} GiB`}; heavy-compile slots: ${results.heavySlots ?? "uncapped"}.`,
);
- const sc = sccacheSummary(results.sccache);
- if (sc) rows.push("", sc);
rows.push(
"",
"`skipped` = area untouched; `blocked` = a check it needs did not succeed. Neither is a pass for the check itself.",
@@ -319,7 +317,7 @@ export class Runner {
constructor(plan, { out, maxParallel, maxHeavy = Infinity }) {
this.plan = plan;
this.out = out;
- this.maxParallel = maxParallel > 0 ? maxParallel : plan.lanes.length;
+ this.maxParallel = plan.profile === "ex63" ? 1 : maxParallel > 0 ? maxParallel : plan.lanes.length;
this.heavy = new PrioritySemaphore(maxHeavy);
this.maxHeavy = maxHeavy;
// check id -> { pgid, peakRssMiB } while running; sampled every 5 s.
@@ -379,7 +377,8 @@ export class Runner {
runCommand(lane, check, logStream, record) {
const env = { ...process.env, ...(lane.env ?? {}), ...(check.env ?? {}) };
if (lane.targetDir) {
- env.CARGO_TARGET_DIR = lane.targetDir;
+ env.CARGO_BUILD_TARGET_DIR = check.env?.CARGO_BUILD_TARGET_DIR ?? lane.targetDir;
+ delete env.CARGO_TARGET_DIR;
mkdirSync(lane.targetDir, { recursive: true });
}
const argv = ["bash", "-o", "pipefail", "-c", check.run];
@@ -775,8 +774,6 @@ async function main() {
log(`detached runner pid=${child.pid} lanes=${lanesJson}`);
return 0;
}
- if (args.profile === "ex63")
- spawnSync("sccache", ["--start-server"], { stdio: "ignore" });
const envHeavy = Number.parseInt(process.env.OH_LANES_MAX_HEAVY ?? "", 10);
const maxHeavy =
@@ -803,7 +800,7 @@ async function main() {
runner: process.env.RUNNER_NAME ?? null,
areas,
lanes,
- sccache: args.profile === "ex63" ? sccacheStats() : null,
+
heavySlots: Number.isFinite(maxHeavy) ? maxHeavy : null,
memory: runner.memory,
cacheBytes: du(process.env.CI_CACHE_DIR),