litellm/.github/workflows/test-mcp-dependency-resolution.yml

131 lines
5.6 KiB
YAML

name: LiteLLM MCP Dependency Resolution
on:
pull_request:
branches:
- main
- "litellm_**"
permissions:
contents: read
pull-requests: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
resolve:
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
persist-credentials: false
- name: Detect relevant changes
id: changes
uses: ./.github/actions/detect-changes
with:
category: mcp-dependencies
- name: Set up Python
if: steps.changes.outputs.decision != 'skip'
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: ${{ matrix.python-version }}
- name: Set up uv
if: steps.changes.outputs.decision != 'skip'
uses: ./.github/actions/setup-uv-with-retries
with:
version: "0.10.9"
- name: Cache the Rust build
if: steps.changes.outputs.decision != 'skip'
uses: ./.github/actions/cache-cargo-build
- name: Verify lockfile
if: steps.changes.outputs.decision != 'skip'
run: |
uv lock --check
- name: Verify dashboard build helpers
if: steps.changes.outputs.decision != 'skip'
run: uv run --no-project --with pytest python -m pytest -c /dev/null tests/base_sdk_tests/test_ui_build_scripts.py -q
- name: Set up dashboard Node
if: steps.changes.outputs.decision != 'skip'
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version-file: ui/litellm-dashboard/.nvmrc
- name: Build dashboard for proxy wheel checks
if: steps.changes.outputs.decision != 'skip'
run: |
cd ui/litellm-dashboard
npm ci
npm run build
mkdir -p ../../litellm-proxy-extras/litellm_proxy_extras/ui
cp -R out/. ../../litellm-proxy-extras/litellm_proxy_extras/ui/
- name: Check locked runtime installations
if: steps.changes.outputs.decision != 'skip'
run: |
for extra in core cli mcp proxy; do
args=()
if [ "$extra" != core ]; then args=(--extra "$extra"); fi
UV_PROJECT_ENVIRONMENT=".venv-$extra" .github/scripts/uv_sync_with_retries.sh --frozen --no-dev --no-editable --python ${{ matrix.python-version }} "${args[@]}"
uv pip check --python ".venv-$extra"
if [ "$extra" = core ]; then
checker=("$GITHUB_WORKSPACE/tests/base_sdk_tests/check_base_sdk_install.py")
elif [ "$extra" = cli ]; then
checker=("$GITHUB_WORKSPACE/tests/base_sdk_tests/check_cli_install.py" --profile cli)
else
checker=("$GITHUB_WORKSPACE/scripts/check_mcp_sdk_install.py" --extra "$extra")
fi
(cd "$RUNNER_TEMP" && "$GITHUB_WORKSPACE/.venv-$extra/bin/python" "${checker[@]}")
if [ "$extra" = core ] || [ "$extra" = proxy ]; then
(cd "$RUNNER_TEMP" && "$GITHUB_WORKSPACE/.venv-$extra/bin/python" "$GITHUB_WORKSPACE/tests/base_sdk_tests/check_cli_install.py" --profile "$extra")
fi
if [ "$extra" = core ] || [ "$extra" = proxy ]; then
(cd "$RUNNER_TEMP" && "$GITHUB_WORKSPACE/.venv-$extra/bin/python" "$GITHUB_WORKSPACE/tests/base_sdk_tests/check_proxy_ui.py" --profile "$extra")
fi
done
- name: Build the public wheel
if: steps.changes.outputs.decision != 'skip'
run: uv build --all-packages --wheel --out-dir dist/mcp-check
- name: Check lowest direct runtime installations
if: steps.changes.outputs.decision != 'skip'
run: |
wheel=$(realpath dist/mcp-check/litellm-[0-9]*.whl)
for extra in core cli mcp proxy; do
args=()
if [ "$extra" != core ]; then args=(--extra "$extra"); fi
uv pip compile pyproject.toml --no-sources --find-links dist/mcp-check "${args[@]}" --python-version ${{ matrix.python-version }} --resolution lowest-direct -o "lowest-$extra.txt"
uv venv --python ${{ matrix.python-version }} ".venv-lowest-$extra"
uv pip sync --find-links dist/mcp-check --python ".venv-lowest-$extra" "lowest-$extra.txt"
uv pip install --python ".venv-lowest-$extra" --no-deps "$wheel"
uv pip check --python ".venv-lowest-$extra"
if [ "$extra" = core ]; then
checker=("$GITHUB_WORKSPACE/tests/base_sdk_tests/check_base_sdk_install.py")
elif [ "$extra" = cli ]; then
checker=("$GITHUB_WORKSPACE/tests/base_sdk_tests/check_cli_install.py" --profile cli)
else
checker=("$GITHUB_WORKSPACE/scripts/check_mcp_sdk_install.py" --extra "$extra")
fi
(cd "$RUNNER_TEMP" && "$GITHUB_WORKSPACE/.venv-lowest-$extra/bin/python" "${checker[@]}")
if [ "$extra" = core ] || [ "$extra" = proxy ]; then
(cd "$RUNNER_TEMP" && "$GITHUB_WORKSPACE/.venv-lowest-$extra/bin/python" "$GITHUB_WORKSPACE/tests/base_sdk_tests/check_cli_install.py" --profile "$extra")
fi
if [ "$extra" = core ] || [ "$extra" = proxy ]; then
(cd "$RUNNER_TEMP" && "$GITHUB_WORKSPACE/.venv-lowest-$extra/bin/python" "$GITHUB_WORKSPACE/tests/base_sdk_tests/check_proxy_ui.py" --profile "$extra")
fi
done