Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

ci(ui): move frontend lint into its own "UI Lint" workflow (#32810)

ryan-crabbe-berri3afd4a228223
diff --git a/.github/workflows/test-litellm-ui-build.yml b/.github/workflows/test-litellm-ui-build.yml
index 67bec6715f0..525e2c5b949 100644
--- a/.github/workflows/test-litellm-ui-build.yml
+++ b/.github/workflows/test-litellm-ui-build.yml
@@ -36,83 +36,3 @@ jobs:
- name: Build
run: npm run build
-
- frontend-lint:
- runs-on: ubuntu-latest
- timeout-minutes: 8
- defaults:
- run:
- working-directory: ui/litellm-dashboard
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
- with:
- fetch-depth: 0
- persist-credentials: false
-
- - name: Collect changed files
- id: changed
- env:
- BASE_SHA: ${{ github.event.pull_request.base.sha }}
- run: |
- : > "$RUNNER_TEMP/prettier_files.txt"
- : > "$RUNNER_TEMP/eslint_files.txt"
- while IFS= read -r f; do
- [ -f "$f" ] || continue
- case "$f" in
- *.js | *.jsx | *.ts | *.tsx | *.mjs | *.cjs)
- printf '%s\n' "$f" >> "$RUNNER_TEMP/prettier_files.txt"
- printf '%s\n' "$f" >> "$RUNNER_TEMP/eslint_files.txt" ;;
- *.json | *.css | *.scss | *.md | *.mdx | *.yml | *.yaml | *.html)
- printf '%s\n' "$f" >> "$RUNNER_TEMP/prettier_files.txt" ;;
- esac
- done < <(git diff --name-only --diff-filter=ACMR --relative "$BASE_SHA"...HEAD -- .)
- if [ -s "$RUNNER_TEMP/prettier_files.txt" ] || [ -s "$RUNNER_TEMP/eslint_files.txt" ]; then
- echo "has_files=true" >> "$GITHUB_OUTPUT"
- else
- echo "has_files=false" >> "$GITHUB_OUTPUT"
- echo "No lintable UI files changed in this PR; nothing to check."
- fi
-
- - name: Setup Node.js
- if: steps.changed.outputs.has_files == 'true'
- uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
- with:
- node-version: "20"
- cache: "npm"
- cache-dependency-path: ui/litellm-dashboard/package-lock.json
-
- - name: Install dependencies
- if: steps.changed.outputs.has_files == 'true'
- run: npm ci
-
- - name: Lint changed files (prettier + eslint)
- if: steps.changed.outputs.has_files == 'true'
- run: |
- prettier_files=()
- eslint_files=()
- while IFS= read -r f; do prettier_files+=("$f"); done < "$RUNNER_TEMP/prettier_files.txt"
- while IFS= read -r f; do eslint_files+=("$f"); done < "$RUNNER_TEMP/eslint_files.txt"
- status=0
- if [ ${#prettier_files[@]} -gt 0 ]; then
- echo "::group::Prettier (${#prettier_files[@]} files)"
- npx prettier --check "${prettier_files[@]}" || { status=1; echo "::error::Unformatted files. Fix with: npm run format"; }
- echo "::endgroup::"
- fi
- if [ ${#eslint_files[@]} -gt 0 ]; then
- echo "::group::ESLint (${#eslint_files[@]} files)"
- npx eslint --no-warn-ignored --pass-on-unpruned-suppressions "${eslint_files[@]}" || status=1
- echo "::endgroup::"
- fi
- exit $status
-
- - name: Check lint budgets
- if: ${{ !cancelled() && steps.changed.outputs.has_files == 'true' }}
- run: |
- npx eslint . -f json -o "$RUNNER_TEMP/lint-report.json" || true
- node scripts/check-lint-budgets.mjs "$RUNNER_TEMP/lint-report.json" eslint-budgets.json --check eslint-metrics.json
-
- - name: Check for dead code (knip)
- if: ${{ !cancelled() && steps.changed.outputs.has_files == 'true' }}
- run: npm run knip
diff --git a/.github/workflows/test-litellm-ui-lint.yml b/.github/workflows/test-litellm-ui-lint.yml
new file mode 100644
index 00000000000..226cbf6a879
--- /dev/null
+++ b/.github/workflows/test-litellm-ui-lint.yml
@@ -0,0 +1,92 @@
+name: UI Lint
+permissions:
+ contents: read
+
+on:
+ pull_request:
+ branches:
+ - main
+ - litellm_internal_staging
+ - litellm_oss_staging
+ - "litellm_**"
+
+jobs:
+ frontend-lint:
+ runs-on: ubuntu-latest
+ timeout-minutes: 8
+ defaults:
+ run:
+ working-directory: ui/litellm-dashboard
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
+ with:
+ fetch-depth: 0
+ persist-credentials: false
+
+ - name: Collect changed files
+ id: changed
+ env:
+ BASE_SHA: ${{ github.event.pull_request.base.sha }}
+ run: |
+ : > "$RUNNER_TEMP/prettier_files.txt"
+ : > "$RUNNER_TEMP/eslint_files.txt"
+ while IFS= read -r f; do
+ [ -f "$f" ] || continue
+ case "$f" in
+ *.js | *.jsx | *.ts | *.tsx | *.mjs | *.cjs)
+ printf '%s\n' "$f" >> "$RUNNER_TEMP/prettier_files.txt"
+ printf '%s\n' "$f" >> "$RUNNER_TEMP/eslint_files.txt" ;;
+ *.json | *.css | *.scss | *.md | *.mdx | *.yml | *.yaml | *.html)
+ printf '%s\n' "$f" >> "$RUNNER_TEMP/prettier_files.txt" ;;
+ esac
+ done < <(git diff --name-only --diff-filter=ACMR --relative "$BASE_SHA"...HEAD -- .)
+ if [ -s "$RUNNER_TEMP/prettier_files.txt" ] || [ -s "$RUNNER_TEMP/eslint_files.txt" ]; then
+ echo "has_files=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "has_files=false" >> "$GITHUB_OUTPUT"
+ echo "No lintable UI files changed in this PR; nothing to check."
+ fi
+
+ - name: Setup Node.js
+ if: steps.changed.outputs.has_files == 'true'
+ uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
+ with:
+ node-version: "20"
+ cache: "npm"
+ cache-dependency-path: ui/litellm-dashboard/package-lock.json
+
+ - name: Install dependencies
+ if: steps.changed.outputs.has_files == 'true'
+ run: npm ci
+
+ - name: Lint changed files (prettier + eslint)
+ if: steps.changed.outputs.has_files == 'true'
+ run: |
+ prettier_files=()
+ eslint_files=()
+ while IFS= read -r f; do prettier_files+=("$f"); done < "$RUNNER_TEMP/prettier_files.txt"
+ while IFS= read -r f; do eslint_files+=("$f"); done < "$RUNNER_TEMP/eslint_files.txt"
+ status=0
+ if [ ${#prettier_files[@]} -gt 0 ]; then
+ echo "::group::Prettier (${#prettier_files[@]} files)"
+ npx prettier --check "${prettier_files[@]}" || { status=1; echo "::error::Unformatted files. Fix with: npm run format"; }
+ echo "::endgroup::"
+ fi
+ if [ ${#eslint_files[@]} -gt 0 ]; then
+ echo "::group::ESLint (${#eslint_files[@]} files)"
+ npx eslint --no-warn-ignored --pass-on-unpruned-suppressions "${eslint_files[@]}" || status=1
+ echo "::endgroup::"
+ fi
+ exit $status
+
+ - name: Check lint budgets
+ if: ${{ !cancelled() && steps.changed.outputs.has_files == 'true' }}
+ run: |
+ npx eslint . -f json -o "$RUNNER_TEMP/lint-report.json" || true
+ node scripts/check-lint-budgets.mjs "$RUNNER_TEMP/lint-report.json" eslint-budgets.json --check eslint-metrics.json
+
+ - name: Check for dead code (knip)
+ if: ${{ !cancelled() && steps.changed.outputs.has_files == 'true' }}
+ run: npm run knip