ci: enforce schema.prisma sync across all copies

Add ci_cd/check_schema_sync.sh that diffs the three schema.prisma files
(repo root, litellm/proxy/, litellm-proxy-extras/) and exits non-zero if
any diverge. Wire it into the linting workflow and expose it as a
make check-schema-sync target (included in make lint).
This commit is contained in:
Ishaan Jaffer 2026-02-21 11:42:35 -08:00
parent 7c8f2274ca
commit 43b6faff4f
3 changed files with 46 additions and 2 deletions

View file

@ -74,3 +74,7 @@ jobs:
- name: Check import safety
run: |
poetry run python -c "from litellm import *" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1)
- name: Check schema.prisma files are in sync
run: |
bash ci_cd/check_schema_sync.sh

View file

@ -128,11 +128,14 @@ check-circular-imports: install-dev
check-import-safety: install-dev
@poetry run python -c "from litellm import *; print('[from litellm import *] OK! no issues!');" || (echo '🚨 import failed, this means you introduced unprotected imports! 🚨'; exit 1)
check-schema-sync:
bash ci_cd/check_schema_sync.sh
# Combined linting (matches test-linting.yml workflow)
lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety
lint: format-check lint-ruff lint-mypy check-circular-imports check-import-safety check-schema-sync
# Faster linting for local development (only checks changed code)
lint-dev: lint-format-changed lint-mypy check-circular-imports check-import-safety
lint-dev: lint-format-changed lint-mypy check-circular-imports check-import-safety check-schema-sync
# Testing targets
test:

37
ci_cd/check_schema_sync.sh Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
# check_schema_sync.sh
# Ensures all three copies of schema.prisma are identical.
# Exits non-zero if any differ.
set -euo pipefail
SOURCE="schema.prisma"
COPY1="litellm/proxy/schema.prisma"
COPY2="litellm-proxy-extras/litellm_proxy_extras/schema.prisma"
FAILED=0
diff_files() {
local a="$1"
local b="$2"
if ! diff -q "$a" "$b" > /dev/null 2>&1; then
echo "FAIL: $a and $b are out of sync."
diff "$a" "$b" || true
FAILED=1
else
echo "OK: $a and $b match."
fi
}
diff_files "$SOURCE" "$COPY1"
diff_files "$SOURCE" "$COPY2"
if [ "$FAILED" -ne 0 ]; then
echo ""
echo "schema.prisma files are out of sync. The source of truth is '$SOURCE'."
echo "Copy it to the other locations and commit the result."
exit 1
fi
echo ""
echo "All schema.prisma files are in sync."