name: UI Unit Tests permissions: contents: read on: pull_request: branches: - main - litellm_internal_staging - litellm_oss_staging - "litellm_**" push: branches: - litellm_internal_staging concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: ui-unit-tests: runs-on: ubuntu-latest-16-cores timeout-minutes: 20 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: Setup Node.js 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 run: npm ci - name: Run UI unit tests (Vitest) env: CI: "true" BASE_SHA: ${{ github.event.pull_request.base.sha }} run: | if [ -n "$BASE_SHA" ]; then echo "Pull request: running only tests related to changes since $BASE_SHA" npm run test -- --run --changed "$BASE_SHA" --passWithNoTests \ --pool forks --poolOptions.forks.maxForks=14 else echo "Push to $GITHUB_REF_NAME: running the full suite" npm run test -- --run --pool forks --poolOptions.forks.maxForks=14 fi