mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
With provider_endpoints_support.json regenerated, code-quality on main stops at the next two checks: - check_workflow_job_name_collisions: test-merge-smoke.yml and test-unit.yml both publish a `rust-bridge` check run. The smoke job is now named smoke-rust-bridge; nothing reads that check by name. - check_unbounded_in_lists: the app_ids "in" filter #52781 added to AppStore.list had no written bound. It pages with skip/take, so it is marked bounded-ok (the apps granted to one caller) instead of chunked.
384 lines
14 KiB
YAML
384 lines
14 KiB
YAML
name: smoke
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main, litellm_internal_staging, litellm_oss_staging, "litellm_**"]
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: merge-smoke-${{ github.event.pull_request.number || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
rust-bridge:
|
|
name: smoke-rust-bridge
|
|
runs-on: ubuntu-latest-16-cores
|
|
timeout-minutes: 25
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
outputs:
|
|
artifact: ${{ steps.bridge.outputs.artifact }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Detect a cost-map-only change
|
|
id: cost-map-only
|
|
if: github.event_name == 'pull_request'
|
|
uses: ./.github/actions/detect-changes
|
|
with:
|
|
category: cost-map-only
|
|
|
|
- name: Build or restore the Rust bridge
|
|
id: bridge
|
|
uses: ./.github/actions/build-rust-bridge
|
|
with:
|
|
stale-cost-map: ${{ steps.cost-map-only.outputs.decision == 'run' }}
|
|
|
|
dashboard-build:
|
|
name: dashboard-build
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Build the dashboard stage
|
|
run: docker build --target ui-builder -f litellm/deploy/docker/Dockerfile .
|
|
|
|
core-checks:
|
|
name: py${{ matrix.python-version }}
|
|
needs: rust-bridge
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ${{ fromJSON(github.event_name == 'pull_request' && '["3.10", "3.13"]' || '["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]') }}
|
|
env:
|
|
LITELLM_LOCAL_MODEL_COST_MAP: "True"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Set up uv
|
|
uses: ./.github/actions/setup-uv-with-retries
|
|
with:
|
|
version: "0.10.9"
|
|
|
|
- name: Download the Rust bridge
|
|
uses: ./.github/actions/rust-bridge
|
|
with:
|
|
artifact: ${{ needs.rust-bridge.outputs.artifact }}
|
|
|
|
- name: Install dependencies
|
|
env:
|
|
PYTHON_VERSION: ${{ matrix.python-version }}
|
|
run: |
|
|
.github/scripts/uv_sync_with_retries.sh --frozen --extra proxy --extra cli --group dev --group proxy-dev --python "$PYTHON_VERSION" --no-install-project
|
|
uv pip install --no-deps --python .venv/bin/python rust-bridge-dist/litellm-*.whl
|
|
cp rust-bridge-dist/litellm/rust_bridge/_native.abi3.so litellm/rust_bridge/_native.abi3.so
|
|
|
|
- name: Create the loopback-only network namespace
|
|
run: |
|
|
sudo ip netns add smoke
|
|
sudo ip netns exec smoke ip link set lo up
|
|
cat > "${RUNNER_TEMP}/in-netns" <<'WRAP'
|
|
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
exec sudo --preserve-env=LITELLM_LOCAL_MODEL_COST_MAP ip netns exec smoke setpriv --reuid "$(id -u)" --regid "$(id -g)" --init-groups -- env HOME="${HOME}" PATH="${PATH}" "$@"
|
|
WRAP
|
|
chmod +x "${RUNNER_TEMP}/in-netns"
|
|
echo "IN_NETNS=${RUNNER_TEMP}/in-netns" >> "${GITHUB_ENV}"
|
|
|
|
- name: Verify namespace isolation
|
|
run: $IN_NETNS .venv/bin/python .github/scripts/run_merge_smoke.py verify-isolation
|
|
|
|
- name: Verify interpreter version
|
|
env:
|
|
EXPECTED_PYTHON: ${{ matrix.python-version }}
|
|
run: $IN_NETNS .venv/bin/python .github/scripts/run_merge_smoke.py interpreter --expect "$EXPECTED_PYTHON"
|
|
|
|
- name: Import and CLI checks
|
|
run: $IN_NETNS .venv/bin/python .github/scripts/run_merge_smoke.py cli
|
|
|
|
- name: Routing and UUID compatibility
|
|
run: >-
|
|
$IN_NETNS .venv/bin/python -m pytest
|
|
tests/unit/router_strategy/test_complexity_router.py::TestCustomDimensions
|
|
tests/unit/test_uuid_helper.py -q
|
|
|
|
- name: Proxy startup check
|
|
run: $IN_NETNS .venv/bin/python .github/scripts/run_merge_smoke.py proxy-startup --diagnostics-dir "${RUNNER_TEMP}/smoke-diagnostics"
|
|
|
|
- name: Upload smoke diagnostics
|
|
if: always()
|
|
continue-on-error: true
|
|
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
|
|
with:
|
|
name: merge-smoke-diagnostics-py${{ matrix.python-version }}
|
|
path: ${{ runner.temp }}/smoke-diagnostics
|
|
if-no-files-found: ignore
|
|
|
|
- name: Remove the network namespace
|
|
if: always()
|
|
run: sudo ip netns delete smoke
|
|
|
|
- name: Keep only source-built wheels in the uv cache
|
|
if: always() && github.ref == 'refs/heads/main'
|
|
run: uv cache prune --ci
|
|
|
|
all-extras:
|
|
name: all-extras-py${{ matrix.python-version }}
|
|
needs: rust-bridge
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 10
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
python-version: ${{ fromJSON(github.event_name == 'pull_request' && '["3.13"]' || '["3.12", "3.13"]') }}
|
|
env:
|
|
LITELLM_LOCAL_MODEL_COST_MAP: "True"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Set up uv
|
|
uses: ./.github/actions/setup-uv-with-retries
|
|
with:
|
|
version: "0.10.9"
|
|
|
|
- name: Download the Rust bridge
|
|
uses: ./.github/actions/rust-bridge
|
|
with:
|
|
artifact: ${{ needs.rust-bridge.outputs.artifact }}
|
|
|
|
- name: Install every extra and dependency group
|
|
env:
|
|
PYTHON_VERSION: ${{ matrix.python-version }}
|
|
run: |
|
|
.github/scripts/uv_sync_with_retries.sh --frozen --all-groups --all-extras --python "$PYTHON_VERSION" --no-install-project --no-install-package litellm-proxy
|
|
uv pip install --no-deps --python .venv/bin/python rust-bridge-dist/*.whl
|
|
cp rust-bridge-dist/litellm/rust_bridge/_native.abi3.so litellm/rust_bridge/_native.abi3.so
|
|
|
|
- name: Import the SDK, the proxy server and the enterprise package
|
|
run: .venv/bin/python -c "import litellm, litellm.proxy.proxy_server, litellm_enterprise"
|
|
|
|
- name: Keep only source-built wheels in the uv cache
|
|
if: always() && github.ref == 'refs/heads/main'
|
|
run: uv cache prune --ci
|
|
|
|
windows-sdk:
|
|
name: windows-sdk
|
|
if: github.event_name != 'pull_request'
|
|
runs-on: windows-2025
|
|
timeout-minutes: 30
|
|
env:
|
|
LITELLM_LOCAL_MODEL_COST_MAP: "True"
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Set up uv
|
|
uses: ./.github/actions/setup-uv-with-retries
|
|
with:
|
|
version: "0.10.9"
|
|
|
|
- name: Install dependencies
|
|
run: .github/scripts/uv_sync_with_retries.sh --frozen --group dev --python 3.11
|
|
|
|
- name: Run the Windows tests
|
|
run: uv run --no-sync python -m pytest --tb=short -v tests/windows_tests
|
|
|
|
- name: Keep only source-built wheels in the uv cache
|
|
if: always() && github.ref == 'refs/heads/main'
|
|
run: uv cache prune --ci
|
|
|
|
proxy-build-from-pip:
|
|
name: proxy-build-from-pip
|
|
if: github.event_name != 'pull_request'
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 10
|
|
services:
|
|
postgres:
|
|
image: postgres:14@sha256:6a70deda415ec296f977890e11aba04a0db9f632a362e3fce45e845e3db74f26
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: circle_test
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd "pg_isready -U postgres"
|
|
--health-interval 2s
|
|
--health-timeout 5s
|
|
--health-retries 30
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Set up uv
|
|
uses: ./.github/actions/setup-uv-with-retries
|
|
with:
|
|
version: "0.10.9"
|
|
|
|
- name: Install the test client dependencies
|
|
run: .github/scripts/uv_sync_with_retries.sh --frozen --no-install-workspace --extra proxy --group dev --python 3.12
|
|
|
|
- name: Cache Prisma binaries
|
|
timeout-minutes: 3
|
|
uses: ./.github/actions/cache-prisma-binaries
|
|
|
|
- name: Install the published proxy into its own venv
|
|
run: |
|
|
uv --no-config venv --python 3.13 /tmp/litellm-pip
|
|
uv --no-config pip install --python /tmp/litellm-pip/bin/python \
|
|
"litellm[proxy,proxy-runtime]==1.83.0" \
|
|
"google-cloud-aiplatform==1.133.0" \
|
|
"google-genai==1.37.0" \
|
|
"anthropic[vertex]==0.84.0" \
|
|
"grpcio==1.78.0" \
|
|
"prometheus-client==0.20.0" \
|
|
"langfuse==2.59.7" \
|
|
"opentelemetry-api==1.28.0" \
|
|
"opentelemetry-sdk==1.28.0" \
|
|
"opentelemetry-exporter-otlp==1.28.0" \
|
|
"ddtrace==4.11.0" \
|
|
"sentry-sdk==2.21.0" \
|
|
"mangum==0.17.0" \
|
|
"azure-ai-contentsafety==1.0.0" \
|
|
"azure-storage-file-datalake==12.20.0" \
|
|
"pypdf==6.7.5" \
|
|
"llm-sandbox==0.3.31" \
|
|
"detect-secrets==1.5.0" \
|
|
"prisma==0.11.0" \
|
|
"openai==2.24.0"
|
|
export PATH="/tmp/litellm-pip/bin:$PATH"
|
|
/tmp/litellm-pip/bin/prisma generate --schema=litellm/schema.prisma
|
|
|
|
- name: Start the fake OpenAI endpoint
|
|
run: |
|
|
nohup .venv/bin/python tests/_fake_openai_endpoint_server.py --host 0.0.0.0 --port 8190 > "${RUNNER_TEMP}/fake-openai.log" 2>&1 &
|
|
for _ in $(seq 1 30); do
|
|
curl -sf http://localhost:8190/health > /dev/null && exit 0
|
|
sleep 1
|
|
done
|
|
cat "${RUNNER_TEMP}/fake-openai.log"
|
|
exit 1
|
|
|
|
- name: Generate a master key
|
|
run: |
|
|
key="sk-$(openssl rand -hex 16)"
|
|
echo "::add-mask::${key}"
|
|
echo "LITELLM_MASTER_KEY=${key}" >> "${GITHUB_ENV}"
|
|
|
|
- name: Start the published proxy
|
|
env:
|
|
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/circle_test
|
|
LITELLM_LICENSE: bad-license
|
|
FAKE_OPENAI_API_BASE: http://localhost:8190
|
|
OTEL_EXPORTER: in_memory
|
|
USE_DDTRACE: "True"
|
|
DD_TRACE_OPENAI_ENABLED: "False"
|
|
GCS_FLUSH_INTERVAL: "1"
|
|
LITELLM_LOG: ERROR
|
|
run: |
|
|
cd /tmp/litellm-pip
|
|
nohup /tmp/litellm-pip/bin/ddtrace-run /tmp/litellm-pip/bin/litellm \
|
|
--config "${GITHUB_WORKSPACE}/tests/basic_proxy_startup_tests/build_from_pip_config.yaml" \
|
|
--port 4000 > /tmp/litellm-pip.log 2>&1 &
|
|
for _ in $(seq 1 150); do
|
|
curl -sf --max-time 5 -o /dev/null http://localhost:4000 && exit 0
|
|
sleep 2
|
|
done
|
|
exit 1
|
|
|
|
- name: Run the startup tests
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
base_url=http://localhost:4000
|
|
readiness_response="$(curl -sS --fail-with-body --write-out $'\n%{http_code}' "${base_url}/health/readiness")"
|
|
readiness_status="${readiness_response##*$'\n'}"
|
|
readiness_body="${readiness_response%$'\n'*}"
|
|
[[ "${readiness_status}" == "200" ]]
|
|
jq -e '.status == "healthy" or .status == "connected"' <<< "${readiness_body}" > /dev/null
|
|
liveness_status="$(curl -sS --fail-with-body --output /dev/null --write-out '%{http_code}' "${base_url}/health/liveness")"
|
|
[[ "${liveness_status}" == "200" ]]
|
|
completion_response="$(curl -sS --fail-with-body --write-out $'\n%{http_code}' \
|
|
--header "Authorization: Bearer ${LITELLM_MASTER_KEY}" \
|
|
--header 'Content-Type: application/json' \
|
|
--data '{"model":"gpt-4","messages":[{"role":"system","content":"You are a helpful assistant."},{"role":"user","content":"Hello!"}]}' \
|
|
"${base_url}/chat/completions")"
|
|
completion_status="${completion_response##*$'\n'}"
|
|
completion_body="${completion_response%$'\n'*}"
|
|
[[ "${completion_status}" == "200" ]]
|
|
jq -e '
|
|
(.choices | length) == 1 and
|
|
.choices[0].message.role == "assistant" and
|
|
.choices[0].message.content == "Hello! This is a mock response from the fake OpenAI endpoint."
|
|
' <<< "${completion_body}" > /dev/null
|
|
|
|
- name: Show the proxy logs
|
|
if: always()
|
|
run: cat /tmp/litellm-pip.log || true
|
|
|
|
- name: Keep only source-built wheels in the uv cache
|
|
if: always() && github.ref == 'refs/heads/main'
|
|
run: uv cache prune --ci
|
|
|
|
smoke-passed:
|
|
name: smoke passed
|
|
needs: [rust-bridge, dashboard-build, core-checks, all-extras]
|
|
if: always()
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 2
|
|
permissions: {}
|
|
steps:
|
|
- name: Require every smoke job to succeed
|
|
env:
|
|
NEEDS: ${{ toJSON(needs) }}
|
|
run: |
|
|
jq -r 'to_entries[] | "\(.key): \(.value.result)"' <<< "$NEEDS"
|
|
jq -e 'all(.[]; .result == "success")' <<< "$NEEDS" > /dev/null
|