ci(proxy): fail the build when the lazy OpenAPI snapshot goes stale #407
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Check Lazy OpenAPI Snapshot Sync | |
| on: | |
| pull_request: | |
| paths: | |
| - "litellm/proxy/**" | |
| - "litellm/types/**" | |
| - "enterprise/**" | |
| - "uv.lock" | |
| - ".github/workflows/check-lazy-openapi-snapshot.yml" | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-sync: | |
| name: Verify _lazy_openapi_snapshot.json matches the proxy routes | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout repository | |
| 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: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7 | |
| with: | |
| version: "0.10.9" | |
| - name: Cache uv dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: | | |
| ~/.cache/uv | |
| .venv | |
| key: ${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-uv- | |
| - name: Install backend dependencies | |
| run: .github/scripts/uv_sync_with_retries.sh --frozen --group ci --group proxy-dev --extra google --extra proxy --extra semantic-router | |
| - name: Generate Prisma client | |
| env: | |
| PRISMA_BINARY_CACHE_DIR: ${{ runner.temp }}/prisma-cache | |
| run: uv run --no-sync prisma generate --schema litellm/proxy/schema.prisma | |
| - name: Fail if the snapshot is stale | |
| run: | | |
| if ! uv run --no-sync python -m litellm.proxy._lazy_openapi_snapshot --check; then | |
| echo "::error file=litellm/proxy/_lazy_openapi_snapshot.json::Lazy OpenAPI snapshot is out of sync with the proxy routes." | |
| exit 1 | |
| fi |