Open-source inference server and production cluster for all the models your agent needs.
Python bgecolbertdata-pipelinedeep-learningembeddingsinferenceinference-serverinformation-retrievalllmmlmlopsnatural-language-processingnlppythonrerankingretrievalretrieval-augmented-generationsemantic-searchspladevector-search
ci: build CPU images concurrently and split the Python and Rust jobs (#1040)
Krisztian Gajdar4f5d3ae8d347
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 1539aed04..719dc6d3a 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -88,15 +88,15 @@ jobs:sha256: 3aaab5c05a8a94a93b42b4f581779bbd5c44ddb251e7f3639fc671ec5c6aab8ainstall_args: --jobs=1cache: true- - run: mise exec -- uv lock --check --project .- run: mise run sync- run: mise run lint- run: mise run typecheck+ # The server tests run in the python-server-tests job.- name: Offline public unit testsenv:HF_HUB_OFFLINE: "1"TRANSFORMERS_OFFLINE: "1"- run: mise run test+ run: mise run test -- --ignore-glob 'packages/sie_server/tests/*'- run: mise run test-integrations -- --python-only- name: Public tooling syntax and testsrun: |@@ -144,6 +144,36 @@ jobs:- name: Pinned collector privacyrun: mise exec -- uv run --frozen --project . --no-sync pytest -q -m docker tools/ci/tests/test_collector_*privacy.py+ python-server-tests:+ name: CI / Python server tests (${{ matrix.shard }})+ runs-on: blacksmith-4vcpu-ubuntu-2404+ timeout-minutes: 60+ strategy:+ fail-fast: false+ matrix:+ # Together with the python job's selection, every unit test runs once.+ include:+ - shard: adapters+ selection: packages/sie_server/tests/adapters+ - shard: other+ selection: --ignore-glob packages/sie_server/tests/adapters packages/sie_server/tests+ steps:+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5+ with:+ persist-credentials: false+ - run: bash tools/ci/mise_binary.bash+ - uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2+ with:+ version: 2026.5.5+ sha256: 3aaab5c05a8a94a93b42b4f581779bbd5c44ddb251e7f3639fc671ec5c6aab8a+ install_args: --jobs=1+ cache: true+ - name: Offline server unit tests+ env:+ HF_HUB_OFFLINE: "1"+ TRANSFORMERS_OFFLINE: "1"+ run: mise run test -- ${{ matrix.selection }}+bundle-resolution:name: CI / Bundle resolutionruns-on: blacksmith-2vcpu-ubuntu-2404@@ -204,10 +234,10 @@ jobs:- run: mise run ts -- lint- run: mise run ts -- test- rust:- name: CI / Rust+ rust-checks:+ name: CI / Rust checksruns-on: blacksmith-8vcpu-ubuntu-2404- timeout-minutes: 90+ timeout-minutes: 45steps:- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5with:@@ -227,7 +257,6 @@ jobs:# rustup's default home, so this entry needs its own key.cache_key_prefix: mise-rustcache: true- - run: mise run sync- run: mise run rust-fmt -- --check- run: mise run rust-check- run: mise run rust-clippy@@ -240,6 +269,31 @@ jobs:- run: mise exec -- cargo fmt --manifest-path packages/sie_server_rust/Cargo.toml -- --check- run: mise exec -- cargo check --manifest-path packages/sie_server_rust/Cargo.toml --locked --all-targets- run: mise exec -- cargo clippy --manifest-path packages/sie_server_rust/Cargo.toml --locked --all-targets -- -D warnings++ rust-tests:+ name: CI / Rust tests+ runs-on: blacksmith-8vcpu-ubuntu-2404+ timeout-minutes: 90+ steps:+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5+ with:+ persist-credentials: false+ - name: Keep the Rust toolchain inside the directory mise-action caches+ run: |+ echo "RUSTUP_HOME=$HOME/.local/share/mise/rustup" >> "$GITHUB_ENV"+ echo "CARGO_HOME=$HOME/.local/share/mise/cargo" >> "$GITHUB_ENV"+ - run: bash tools/ci/mise_binary.bash+ - uses: jdx/mise-action@c37c93293d6b742fc901e1406b8f764f6fb19dac # v2+ with:+ version: 2026.5.5+ sha256: 3aaab5c05a8a94a93b42b4f581779bbd5c44ddb251e7f3639fc671ec5c6aab8a+ install_args: --jobs=1+ # With rustup's and cargo's homes set above, the toolchain and its+ # components restore with the cache. The other jobs leave Rust in+ # rustup's default home, so this entry needs its own key.+ cache_key_prefix: mise-rust+ cache: true+ - run: mise run sync- run: mise exec -- uv run --frozen --project . --no-sync python tools/ci/rust_tests.py- name: Preserve diagnosticsif: always()@@ -411,7 +465,7 @@ jobs:required:name: CI / Requiredif: ${{ always() }}- needs: [policy, bootstrap, python, bundle-resolution, typescript, rust, contracts, helm, live-sdk, cpu-stack, python-distributions, npm-distributions]+ needs: [policy, bootstrap, python, python-server-tests, bundle-resolution, typescript, rust-checks, rust-tests, contracts, helm, live-sdk, cpu-stack, python-distributions, npm-distributions]runs-on: blacksmith-2vcpu-ubuntu-2404timeout-minutes: 5steps:diff --git a/tools/ci/cpu_stack_smoke.py b/tools/ci/cpu_stack_smoke.pyindex d71cd15c8..0fddd8e97 100644--- a/tools/ci/cpu_stack_smoke.py+++ b/tools/ci/cpu_stack_smoke.py@@ -7,11 +7,13 @@ import jsonimport osimport secretsimport subprocess+import sysimport tempfileimport timeimport urllib.errorimport urllib.requestimport uuid+from concurrent.futures import ThreadPoolExecutorfrom pathlib import Pathimport nats@@ -140,23 +142,47 @@ async def assert_nats_refuses_anonymous(url: str) -> None:raise RuntimeError("NATS accepted an anonymous connection")-def build_images(registry: str, revision: str) -> None:+def build_images(registry: str, revision: str, logs: Path) -> None:common = ["--registry", registry, "--version", "0.0.0", "--source-revision", revision]- commands = [["build-server", "--platform", "cpu", "--bundle", "default", *common]]- commands.extend(["build-service", "--service", service, *common] for service in SERVICES)- for args in commands:- subprocess.run(["mise", "run", "docker", "--", *args], check=True, timeout=3600)+ builds = {"sie-server": ["build-server", "--platform", "cpu", "--bundle", "default", *common]}+ builds.update({service: ["build-service", "--service", service, *common] for service in SERVICES})++ def build(name: str) -> str:+ with (logs / f"build-{name}.log").open("w") as log:+ try:+ status = subprocess.run(+ [sys.executable, "-m", "tools.mise_tasks.docker_task", *builds[name]],+ check=False,+ stdout=log,+ stderr=subprocess.STDOUT,+ timeout=3600,+ ).returncode+ except subprocess.TimeoutExpired:+ return "timed out"+ return f"exit {status}"++ # Concurrent builds write to one log each, printed whole when the build+ # ends, so their output does not interleave.+ failed = []+ with ThreadPoolExecutor(max_workers=len(builds)) as pool:+ for name, outcome in zip(builds, pool.map(build, builds), strict=True):+ print(f"--- docker build {name}: {outcome} ---")+ print((logs / f"build-{name}.log").read_text(), flush=True)+ if outcome != "exit 0":+ failed.append(name)+ if failed:+ raise RuntimeError(f"Docker build failed for {', '.join(failed)}")def main() -> None:require_local_docker()revision = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()registry = f"local/sie-ci-{uuid.uuid4().hex[:8]}"- build_images(registry, revision)- network = f"sie-ci-{uuid.uuid4().hex[:8]}"- containers: list[str] = []logs = Path(".cache/ci-logs")logs.mkdir(parents=True, exist_ok=True)+ build_images(registry, revision, logs)+ network = f"sie-ci-{uuid.uuid4().hex[:8]}"+ containers: list[str] = []docker("network", "create", network)with tempfile.TemporaryDirectory(prefix="sie-cpu-ipc-", dir="/tmp") as ipc:diff --git a/tools/ci/required_ci.py b/tools/ci/required_ci.pyindex 294562b8f..0c6caa2e6 100644--- a/tools/ci/required_ci.py+++ b/tools/ci/required_ci.py@@ -10,9 +10,11 @@ MANDATORY_JOBS = ("policy","bootstrap","python",+ "python-server-tests","bundle-resolution","typescript",- "rust",+ "rust-checks",+ "rust-tests","contracts","helm","live-sdk",diff --git a/tools/ci/tests/test_cpu_checks.py b/tools/ci/tests/test_cpu_checks.pyindex e3b74374a..e2050b61d 100644--- a/tools/ci/tests/test_cpu_checks.py+++ b/tools/ci/tests/test_cpu_checks.py@@ -1,6 +1,8 @@from __future__ import annotationsimport json+import subprocess+import sysfrom pathlib import Pathfrom unittest.mock import Mock@@ -77,15 +79,33 @@ def test_docker_host_override_cannot_hide_remote_endpoint(monkeypatch):cpu_stack_smoke.require_local_docker()-def test_cpu_builds_all_six_images_without_publish(monkeypatch):- run = Mock()+def test_cpu_builds_all_six_images_without_publish(monkeypatch, tmp_path):+ run = Mock(return_value=Mock(returncode=0))monkeypatch.setattr(cpu_stack_smoke.subprocess, "run", run)- cpu_stack_smoke.build_images("local/test", "a" * 40)- assert len(run.call_args_list) == 6+ cpu_stack_smoke.build_images("local/test", "a" * 40, tmp_path)commands = [call.args[0] for call in run.call_args_list]- assert all(command[:4] == ["mise", "run", "docker", "--"] for command in commands)+ assert len(commands) == 6+ assert all(command[:3] == [sys.executable, "-m", "tools.mise_tasks.docker_task"] for command in commands)assert all("--push" not in command for command in commands)- assert [command[command.index("--service") + 1] for command in commands[1:]] == list(cpu_stack_smoke.SERVICES)+ assert sum(command[3] == "build-server" for command in commands) == 1+ services = [command[command.index("--service") + 1] for command in commands if command[3] == "build-service"]+ assert sorted(services) == sorted(cpu_stack_smoke.SERVICES)+ assert sorted(path.name for path in tmp_path.iterdir()) == sorted(+ f"build-{name}.log" for name in ("sie-server", *cpu_stack_smoke.SERVICES)+ )+++def test_cpu_build_failures_name_each_image_after_every_build_ran(monkeypatch, tmp_path):+ def run(command, **_kwargs):+ if "sie-config" in command:+ raise subprocess.TimeoutExpired(command, 3600)+ return Mock(returncode=int("sie-gateway" in command))++ calls = Mock(side_effect=run)+ monkeypatch.setattr(cpu_stack_smoke.subprocess, "run", calls)+ with pytest.raises(RuntimeError, match="Docker build failed for sie-config, sie-gateway$"):+ cpu_stack_smoke.build_images("local/test", "a" * 40, tmp_path)+ assert calls.call_count == 6def test_cpu_stack_task_wraps_one_harness_and_docker_flag_delegates():diff --git a/tools/ci/tests/test_public_tree.py b/tools/ci/tests/test_public_tree.pyindex 94145c50b..d8737e8b8 100644--- a/tools/ci/tests/test_public_tree.py+++ b/tools/ci/tests/test_public_tree.py@@ -85,7 +85,8 @@ def test_ci_is_fork_safe_and_actions_are_immutable() -> None:"CI / Policy","CI / Python","CI / TypeScript",- "CI / Rust",+ "CI / Rust checks",+ "CI / Rust tests","CI / Contracts","CI / Helm","CI / Required",diff --git a/tools/ci/tests/test_required_ci.py b/tools/ci/tests/test_required_ci.pyindex b70f6be97..bb292aafc 100644--- a/tools/ci/tests/test_required_ci.py+++ b/tools/ci/tests/test_required_ci.py@@ -96,6 +96,24 @@ def test_required_check_reports_on_merge_queue_groups():assert all(context not in json.dumps(document) for document in documents), (name, context)+def test_unit_test_shards_cover_every_test_once():+ """The python job and the two server shards split the unit tests without a gap or an overlap."""+ jobs = yaml.safe_load((ROOT / ".github/workflows/ci.yml").read_text())["jobs"]+ server = "packages/sie_server/tests"+ selections = [step["run"] for step in jobs["python"]["steps"] if step.get("run", "").startswith("mise run test ")]+ # A glob, because pytest never ignores a directory that is itself a test path.+ assert selections == [f"mise run test -- --ignore-glob '{server}/*'"]+ shards = jobs["python-server-tests"]+ assert shards["strategy"]["fail-fast"] is False+ assert {shard["shard"]: shard["selection"] for shard in shards["strategy"]["matrix"]["include"]} == {+ "adapters": f"{server}/adapters",+ "other": f"--ignore-glob {server}/adapters {server}",+ }+ assert [step["run"] for step in shards["steps"] if "mise run test" in step.get("run", "")] == [+ "mise run test -- ${{ matrix.selection }}"+ ]++def test_bootstrap_builds_fresh_trees_and_checks_all_locks():"""The bootstrap lane may restore the tool cache but must build the Python and pnpm trees itself."""workflow = yaml.safe_load((ROOT / ".github/workflows/ci.yml").read_text())@@ -354,7 +372,7 @@ def test_cpu_lane_uses_cpu_stack_task():def test_rust_audits_both_committed_dependency_graphs():workflow = yaml.safe_load((ROOT / ".github/workflows/ci.yml").read_text())- commands = [shlex.split(step.get("run", "")) for step in workflow["jobs"]["rust"]["steps"]]+ commands = [shlex.split(step.get("run", "")) for step in workflow["jobs"]["rust-checks"]["steps"]]assert ["mise", "run", "gateway-deny"] in commandsassert ["mise",diff --git a/tools/mise_tasks/test.bash b/tools/mise_tasks/test.bashindex ad669e105..02b458122 100755--- a/tools/mise_tasks/test.bash+++ b/tools/mise_tasks/test.bash@@ -6,6 +6,7 @@#USAGE flag "-l --collect-only" help="Only collect and list test names, don't run them"#USAGE flag "-k --filter <filter>" help="Filter tests by name expression (passed to pytest -k)"#USAGE flag "-m --model <model>" help="Run model tests for a model ID (e.g. BAAI/bge-m3) or 'all' for all models"+#USAGE flag "--ignore-glob <glob>" help="Skip paths matching this glob (passed to pytest --ignore-glob)"#USAGE arg "<path>" help="Optional path to test" default=""set -euo pipefail@@ -15,7 +16,7 @@ ARGS=()if [[ "${usage_docker:-}" == "true" ]]; thenif [[ "${usage_collect_only:-}" == "true" || "${usage_coverage:-}" == "true" || \"${usage_integration:-}" == "true" || -n "${usage_filter:-}" || \- -n "${usage_model:-}" || -n "${usage_path:-}" ]]; then+ -n "${usage_model:-}" || -n "${usage_ignore_glob:-}" || -n "${usage_path:-}" ]]; thenecho "ERROR: --docker delegates to 'mise run cpu-stack' and cannot be combined with pytest selectors." >&2exit 1fi@@ -40,6 +41,10 @@ if [[ "${usage_integration:-}" == "true" ]]; thenARGS+=("-m" "integration" "-s" "-o" "log_cli=true" "-o" "log_cli_level=INFO")fi+if [[ -n "${usage_ignore_glob:-}" ]]; then+ ARGS+=("--ignore-glob=${usage_ignore_glob}")+fi+if [[ -n "${usage_path:-}" ]]; thenARGS+=("${usage_path}")fi