From abc7902abee3f8017e6f9a5ebc6318d9cf9ef230 Mon Sep 17 00:00:00 2001 From: Guilherme Beira Date: Tue, 5 May 2026 08:11:51 -0300 Subject: [PATCH] perf(ci): use the prebuilt release binary for interface collection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The publish job's `Start local worker for interface collection` step was running `cargo run --bin $WORKER --`, paying a full cold cargo compile (200+ deps for skills/mcp) before the worker could even register with the engine. That added 50-90s to every publish despite the `binary-build` job having already produced a working linux-gnu binary on the GitHub Release that publish depends on. Add a `release-binary` mode that, for any `deploy: binary` worker, downloads `$BIN-x86_64-unknown-linux-gnu.tar.gz` from `releases/download/$TAG/`, extracts it, and runs the binary directly. Cargo compile drops out of the critical path; the Collect step now waits ~5s of curl + a fresh process boot instead of ~60s of compile. The mode-detection now prefers `release-binary` whenever `deploy == binary` (the only path that reaches publish — dry runs short-circuit upstream, and `_rust-binary.yml` is a `needs:` of `publish` so the asset is guaranteed to exist). `cargo-run` is kept as a fallback for any future Rust worker that ships via `image` deploy or otherwise has no release asset; `iii-add` (Node/Python via `scripts.start`) is unaffected. --- .github/workflows/_publish-registry.yml | 31 ++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/workflows/_publish-registry.yml b/.github/workflows/_publish-registry.yml index 7f685c7ed..071e0ebf5 100644 --- a/.github/workflows/_publish-registry.yml +++ b/.github/workflows/_publish-registry.yml @@ -97,6 +97,9 @@ jobs: env: WORKER: ${{ inputs.worker }} BIN: ${{ inputs.bin }} + DEPLOY: ${{ inputs.deploy }} + TAG: ${{ inputs.tag }} + REPO_URL: ${{ format('https://github.com/{0}', github.repository) }} run: | set -euo pipefail mode=$(python3 - <<'PY' @@ -104,6 +107,7 @@ jobs: import yaml worker = os.environ["WORKER"] + deploy = os.environ.get("DEPLOY", "") manifest_path = f"{worker}/iii.worker.yaml" manifest = yaml.safe_load(open(manifest_path, encoding="utf-8").read()) or {} scripts = manifest.get("scripts") or {} @@ -112,7 +116,9 @@ jobs: has_runtime = bool(runtime.get("kind") or runtime.get("language")) language = str(manifest.get("language") or "").strip().lower() - if has_scripts_start or has_runtime: + if deploy == "binary": + print("release-binary") + elif has_scripts_start or has_runtime: print("iii-add") elif language == "rust": print("cargo-run") @@ -125,6 +131,29 @@ jobs: iii-add) iii worker add "./$WORKER" --force --reset-config --wait ;; + release-binary) + bin_name="${BIN:-$WORKER}" + asset_url="$REPO_URL/releases/download/$TAG/${bin_name}-x86_64-unknown-linux-gnu.tar.gz" + echo "Fetching prebuilt worker: $asset_url" + curl -fsSL "$asset_url" -o /tmp/worker-bin.tar.gz + tar -xzf /tmp/worker-bin.tar.gz -C /tmp/ + bin_path="/tmp/${bin_name}" + chmod +x "$bin_path" + + worker_log="worker-$WORKER.log" + pushd "$WORKER" >/dev/null + echo "Starting local worker with: (cd $WORKER && $bin_path)" + "$bin_path" > "../$worker_log" 2>&1 & + echo "$!" > ../worker.pid + popd >/dev/null + + sleep 2 + if ! kill -0 "$(cat worker.pid)" 2>/dev/null; then + echo "::error::$WORKER exited before interface collection" + cat "$worker_log" || true + exit 1 + fi + ;; cargo-run) if [[ ! -f "$WORKER/Cargo.toml" ]]; then echo "::error::$WORKER is a Rust worker but $WORKER/Cargo.toml was not found"