mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
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:
parent
7c8f2274ca
commit
43b6faff4f
3 changed files with 46 additions and 2 deletions
4
.github/workflows/test-linting.yml
vendored
4
.github/workflows/test-linting.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
7
Makefile
7
Makefile
|
|
@ -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
37
ci_cd/check_schema_sync.sh
Executable 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."
|
||||
Loading…
Add table
Reference in a new issue