mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-30 01:08:33 +00:00
* ci(unit): run the full unit and smoke matrix on every PR on standard runners Pull requests ran only the core unit shards and a reduced smoke matrix, and several of those jobs used billed 16-core runners. Every pull request now runs the whole unit matrix and the full smoke Python matrix on ubuntu-latest, aimed at the ten-minute pull request budget. The slow shards are split along directory and file lines and run with --dist worksteal, so one heavy test module no longer pins a single worker. ui-unit is split into typecheck, type tests and six vitest shards. The core and changed-tests modes and their selector script are removed, along with the tests-only change category that only they used. The dev Rust profile now builds without debug info, under a fresh cargo cache key, which shrinks the target cache that kept the Actions cache full. The OpenAPI docs gate reuses HEAD's native module for the base tree when the Rust build inputs match instead of compiling it again, and the base-counts publisher restores the shared bridge. The Meta realtime test whose 256 KB parameter became its test id gets short ids, since printing that id stalled its shard for about four minutes. * test(ci): check the release-branch lint-runtime skip in the existing unit gate test * test(ci): expect four vitest workers and the shard flag in the ui-unit step * ci(cache): treat a stalled uv download cache restore as a miss after two minutes * ci(unit): skip the Rust toolchain with a prebuilt bridge and unused pytest plugins Jobs that install the prebuilt Rust bridge never compile Rust, so they only install the toolchain when the bridge artifact is missing. lint-runtime keeps it because the OpenAPI gate can build the base branch's native module. The unit pytest run no longer loads the ddtrace, logfire, langsmith and codspeed plugins. No unit test uses their fixtures or flags, and the 31 test files that touch those libraries give the same results with them off. * ci(unit): load the default pytest plugins in the unit run again test_explicit_enable_without_an_endpoint_exports_spans_to_console only passes when a plugin imports OpenTelemetry before pytest starts capturing stdout, because ConsoleSpanExporter binds sys.stdout at import. With the plugins off it fails every time, so the plugins stay on until that test stops depending on import order. * docs(ci): cut a job's fixed cost before adding shards
121 lines
4.7 KiB
YAML
121 lines
4.7 KiB
YAML
name: Publish lint base counts
|
|
|
|
# Every commit on main can become a future merge-base.
|
|
# Publishing its per-rule counts for each lint gate (strict ruff, type discipline,
|
|
# test quality, basedpyright) as an artifact lets the gates download them through
|
|
# litellm/scripts/lint_base_counts.py in seconds instead of scanning the merge-base tree in
|
|
# a throwaway worktree on every fresh checkout or moved merge-base.
|
|
# No concurrency group on purpose: runs must never cancel each other, because
|
|
# every sha's artifact matters (any of them can become a merge-base).
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
ref:
|
|
description: "Ref to compute and publish base counts for (defaults to the workflow run's commit)"
|
|
required: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- checker: ruff-strict
|
|
script: litellm/scripts/ruff_strict_gate.py
|
|
- checker: type-discipline
|
|
script: litellm/scripts/type_discipline_gate.py
|
|
- checker: test-quality
|
|
script: litellm/scripts/test_quality_gate.py
|
|
- checker: openapi-docs
|
|
script: litellm/scripts/openapi_docs_gate.py
|
|
- checker: basedpyright
|
|
script: litellm/scripts/type_check_gate.py
|
|
|
|
steps:
|
|
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
|
|
with:
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
clean: true
|
|
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: Restore the Rust bridge
|
|
id: bridge
|
|
if: matrix.checker == 'openapi-docs'
|
|
uses: ./.github/actions/restore-rust-bridge
|
|
with:
|
|
stale-cost-map: "true"
|
|
|
|
- name: Cache the Rust build
|
|
if: matrix.checker == 'openapi-docs' && steps.bridge.outputs.restored != 'true'
|
|
uses: ./.github/actions/cache-cargo-build
|
|
|
|
- name: Cache Prisma binaries
|
|
if: matrix.checker == 'basedpyright' || matrix.checker == 'openapi-docs'
|
|
uses: ./.github/actions/cache-prisma-binaries
|
|
|
|
# The source scanners only need the pinned dev tools (ruff and the
|
|
# stdlib checkers), the same versions test-linting.yml's python job runs.
|
|
- name: Install the dev tools
|
|
if: matrix.checker != 'basedpyright' && matrix.checker != 'openapi-docs'
|
|
run: |
|
|
uv sync --frozen --only-group dev --no-install-project
|
|
|
|
# The OpenAPI gate imports the proxy app, so it needs the same install the
|
|
# test-linting.yml python job uses, Prisma client included.
|
|
- name: Install the proxy
|
|
if: matrix.checker == 'openapi-docs'
|
|
env:
|
|
BRIDGE_RESTORED: ${{ steps.bridge.outputs.restored }}
|
|
run: |
|
|
if [ "${BRIDGE_RESTORED}" = true ]; then
|
|
uv sync --frozen --group proxy-dev --group e2e-dev --extra proxy --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
|
|
else
|
|
uv sync --frozen --group proxy-dev --group e2e-dev --extra proxy
|
|
fi
|
|
uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma
|
|
|
|
- name: Emit ${{ matrix.checker }} counts for HEAD
|
|
if: matrix.checker != 'basedpyright'
|
|
run: |
|
|
uv run --no-sync python ${{ matrix.script }} --emit-counts-dir "$RUNNER_TEMP/lint-counts"
|
|
|
|
# The basedpyright gate provisions its own measurement env (.venv-typecheck:
|
|
# a frozen uv sync of its canonical dependency groups plus a generated Prisma
|
|
# client), so no install step here can drift from what local runs measure.
|
|
- name: Emit basedpyright counts for HEAD
|
|
if: matrix.checker == 'basedpyright'
|
|
run: |
|
|
python litellm/scripts/type_check_gate.py --emit-counts-dir "$RUNNER_TEMP/lint-counts"
|
|
|
|
- name: Name the counts artifact
|
|
run: |
|
|
counts_file=$(ls "$RUNNER_TEMP"/lint-counts/${{ matrix.checker }}-counts-*.json)
|
|
echo "COUNTS_ARTIFACT_NAME=$(basename "$counts_file" .json)" >> "$GITHUB_ENV"
|
|
|
|
- name: Upload counts artifact
|
|
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
|
|
with:
|
|
name: ${{ env.COUNTS_ARTIFACT_NAME }}
|
|
path: ${{ runner.temp }}/lint-counts/
|
|
if-no-files-found: error
|