mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
PR #37550 taught the backend unit-test shards to read the pull request's own file list, but four required jobs were never wired to that gate and ran in full on every pull request regardless of what it touched. A UI-only pull request still paid roughly 17 runner-minutes of Python work it could not have affected, and a backend-only one still installed and built the dashboard. Lint and the MCP suite now take the existing backend decision. The dashboard build and unit tests take a new ui decision, which tracks ui/ rather than reusing client: client deliberately runs whenever the backend changes, because it gates CircleCI's end-to-end jobs that drive a real proxy, while the build and the unit tests cannot see the backend at all. CI config counts as ui-relevant too, so a pull request that rewrites the dashboard workflows still exercises them instead of shipping unvalidated. The gate stays inside the job rather than moving to on.paths or to a job-level condition on the shard callers. A workflow filtered out by on.paths never starts and never reports, so a required check waits forever, and a skipped caller job publishes its own name instead of the nested "<shard> / Run tests" the ruleset requires. Both were measured before settling on this shape. Three setup steps in the shard base and in the documentation job also leaked past the gate, so a skipped shard still spent about twelve seconds installing uv and restoring its cache. They now carry the same condition, and the documentation job stops cloning litellm-docs when it has nothing to validate.
42 lines
1.5 KiB
Bash
Executable file
42 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -uo pipefail
|
|
|
|
readonly API_FILE_CEILING=3000
|
|
readonly CATEGORY="${CATEGORY:-backend}"
|
|
|
|
decide() {
|
|
echo "detect-changes[${CATEGORY}]: decision=$1"
|
|
[ -z "${GITHUB_OUTPUT:-}" ] || echo "decision=$1" >>"${GITHUB_OUTPUT}"
|
|
exit 0
|
|
}
|
|
|
|
run_full() {
|
|
echo "detect-changes[${CATEGORY}]: $1; running job"
|
|
decide run
|
|
}
|
|
|
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
classify="${here}/../../.circleci/scripts/classify_changes.sh"
|
|
|
|
[ -n "${PR_NUMBER:-}" ] || run_full "not a pull_request event"
|
|
[ -n "${REPO:-}" ] || run_full "no repository in the environment"
|
|
|
|
case "${CHANGED_FILE_COUNT:-}" in
|
|
'' | *[!0-9]*) run_full "the event payload carries no changed_files count" ;;
|
|
esac
|
|
[ "${CHANGED_FILE_COUNT}" -le "${API_FILE_CEILING}" ] ||
|
|
run_full "PR #${PR_NUMBER} changes ${CHANGED_FILE_COUNT} files, past the ${API_FILE_CEILING}-file listing ceiling"
|
|
|
|
changed="$(gh api "repos/${REPO}/pulls/${PR_NUMBER}/files" --paginate --jq '.[].filename')" ||
|
|
run_full "could not list the files on PR #${PR_NUMBER}"
|
|
[ -n "${changed}" ] || run_full "the API listed no files on PR #${PR_NUMBER}"
|
|
|
|
echo "detect-changes[${CATEGORY}]: files changed by PR #${PR_NUMBER}:"
|
|
printf '%s\n' "${changed}" | sed 's/^/ /'
|
|
|
|
decision="$(printf '%s\n' "${changed}" | bash "${classify}" "${CATEGORY}")" ||
|
|
run_full "classify_changes.sh failed"
|
|
case "${decision}" in
|
|
run | skip) decide "${decision}" ;;
|
|
*) run_full "classify_changes.sh printed an unexpected decision: ${decision}" ;;
|
|
esac
|