From f8a60328b47b430c8f2e49fb652e88a20e429f64 Mon Sep 17 00:00:00 2001 From: Mateo Wang <277851410+mateo-berri@users.noreply.github.com> Date: Tue, 10 Nov 2026 21:05:29 -0800 Subject: [PATCH] ci(image-scan): build Rust with a fast ci cargo profile instead of fat-LTO release (#51075) * ci: speed up image scans with an opt-in Rust profile Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix: separate cached Rust wheels by maturin profile Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .github/workflows/image-scan.yml | 4 ++-- Dockerfile | 1 + litellm-rust/Cargo.toml | 6 ++++++ packaging/litellm-proxy/pyproject.toml | 9 +++++++++ pyproject.toml | 1 + 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/image-scan.yml b/.github/workflows/image-scan.yml index 6e13b49eb15..54051104cb9 100644 --- a/.github/workflows/image-scan.yml +++ b/.github/workflows/image-scan.yml @@ -60,7 +60,7 @@ jobs: persist-credentials: false - name: Build the image - run: docker build --build-arg LITELLM_RELEASE_TAG=v0.0.0-lens-ci -t "$IMAGE" . + run: docker build --build-arg MATURIN_PEP517_ARGS="--profile ci" --build-arg LITELLM_RELEASE_TAG=v0.0.0-lens-ci -t "$IMAGE" . - name: Save the image for the verify matrix run: docker save "$IMAGE" | zstd -T0 -3 -o "$RUNNER_TEMP/litellm-image.tar.zst" @@ -73,7 +73,7 @@ jobs: compression-level: 0 - name: Build the Admin MCP schema image - run: docker build --build-arg LITELLM_RELEASE_TAG=v0.0.0-lens-ci --target builder -t "$ADMIN_MCP_SCHEMA_IMAGE" . + run: docker build --build-arg MATURIN_PEP517_ARGS="--profile ci" --build-arg LITELLM_RELEASE_TAG=v0.0.0-lens-ci --target builder -t "$ADMIN_MCP_SCHEMA_IMAGE" . - name: Save the Admin MCP schema image for the verify matrix run: docker save "$ADMIN_MCP_SCHEMA_IMAGE" | zstd -T0 -3 -o "$RUNNER_TEMP/litellm-admin-mcp-schema.tar.zst" diff --git a/Dockerfile b/Dockerfile index 205f0cc981d..0e9337e658b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -102,6 +102,7 @@ COPY --from=ui-builder /ui/out/. litellm/proxy/_experimental/out/ RUN sed -i 's/\r$//' docker/build_admin_ui.sh && chmod +x docker/build_admin_ui.sh && ./docker/build_admin_ui.sh # Install project and workspace packages (fast - deps already cached) +ARG MATURIN_PEP517_ARGS="" RUN uv build --package litellm-proxy --wheel --out-dir /wheels RUN uv sync --frozen --no-install-package litellm-proxy --no-default-groups --no-editable \ --extra proxy \ diff --git a/litellm-rust/Cargo.toml b/litellm-rust/Cargo.toml index cc72cd01dc0..a00a8ec2446 100644 --- a/litellm-rust/Cargo.toml +++ b/litellm-rust/Cargo.toml @@ -161,3 +161,9 @@ panic = "unwind" debug = false incremental = false strip = "symbols" + +[profile.ci] +inherits = "release" +opt-level = 0 +lto = false +codegen-units = 256 diff --git a/packaging/litellm-proxy/pyproject.toml b/packaging/litellm-proxy/pyproject.toml index 172f40a7228..6b99c77df7a 100644 --- a/packaging/litellm-proxy/pyproject.toml +++ b/packaging/litellm-proxy/pyproject.toml @@ -20,3 +20,12 @@ include = [ { path = ".cargo/config.toml", format = "sdist" }, { path = "model_prices_and_context_window.json", format = "sdist" }, ] + +[tool.uv] +cache-keys = [ + { file = "pyproject.toml" }, + { file = "setup.py" }, + { file = "setup.cfg" }, + { dir = "src" }, + { env = "MATURIN_PEP517_ARGS" }, +] diff --git a/pyproject.toml b/pyproject.toml index 6145db57902..e80ba2d5d44 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -368,6 +368,7 @@ exclude = [ concurrent-builds = 1 cache-keys = [ { file = "pyproject.toml" }, + { env = "MATURIN_PEP517_ARGS" }, { file = "rust-toolchain.toml" }, { file = ".cargo/config.toml" }, { file = "litellm-rust/Cargo.lock" },