Fixes and Cleanup of CI #1465
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Development | ||
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, reopened] | ||
| jobs: | ||
| tests: | ||
| strategy: | ||
| matrix: | ||
| python: ["3.10", "3.13"] | ||
| uses: ./.github/workflows/testing.yml | ||
|
Check failure on line 12 in .github/workflows/development.yml
|
||
| with: | ||
| python: ${{ matrix.python }} | ||
| args: -m "smoke or sanity" | ||
| ui-tests: | ||
| uses: ./.github/workflows/testing-ui.yml | ||
| quality-checks: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python: ["3.10", "3.13"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python }} | ||
| - name: Install dependencies | ||
| run: | | ||
| curl -sSL https://pdm-project.org/install-pdm.py | python3 - | ||
| pip install tox tox-pdm | ||
| - name: Run quality checks | ||
| run: tox -e quality | ||
| ui-quality-checks: | ||
| permissions: | ||
| contents: "read" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Node.js 22 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run quality and typing checks | ||
| run: npm run lint | ||
| type-checks: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python: ["3.10", "3.13"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python }} | ||
| - name: Install dependencies | ||
| run: | | ||
| curl -sSL https://pdm-project.org/install-pdm.py | python3 - | ||
| pip install tox tox-pdm | ||
| - name: Run quality checks | ||
| run: tox -e types | ||
| ui-type-checks: | ||
| permissions: | ||
| contents: "read" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Node.js 22 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run quality and typing checks | ||
| run: npm run type-check | ||
| precommit-checks: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| python: ["3.10"] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: ${{ matrix.python }} | ||
| - name: Install dependencies | ||
| run: pip install pre-commit | ||
| - name: Run pre-commit checks | ||
| run: SKIP=ruff-format pre-commit run --all-files | ||
| ui-precommit-checks: | ||
| permissions: | ||
| contents: "read" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v4 | ||
| - name: Set up Node.js 22 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
| - name: Install dependencies | ||
| run: npm ci | ||
| - name: Run pre-commit checks | ||
| run: npx husky run pre-commit | ||
| ui-pr-preview: | ||
| needs: [ui-quality-checks, ui-precommit-checks, ui-tests] | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| issues: write | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out code | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Node.js 22 | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '22' | ||
| - name: Check if UI-related files changed | ||
| id: check-changes | ||
| run: | | ||
| BASE_BRANCH=${{ github.event.pull_request.base.ref }} | ||
| CHANGED_FILES=$(git diff --name-only origin/$BASE_BRANCH...HEAD) | ||
| SHOULD_BUILD=false | ||
| if echo "$CHANGED_FILES" | grep -q "^src/ui/"; then | ||
| echo "UI source files changed" | ||
| SHOULD_BUILD=true | ||
| fi | ||
| echo "should_build=$SHOULD_BUILD" >> $GITHUB_OUTPUT | ||
| echo "Should build: $SHOULD_BUILD" | ||
| - name: Install dependencies | ||
| if: steps.check-changes.outputs.should_build == 'true' | ||
| run: npm ci | ||
| - name: Build app to root | ||
| if: steps.check-changes.outputs.should_build == 'true' | ||
| id: build | ||
| run: | | ||
| # Export vars to ensure they are loaded before build | ||
| export $(grep -v '^#' .env.development | xargs) | ||
| PR_NUMBER=${{ github.event.pull_request.number }} | ||
| echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT | ||
| # Set asset prefix and base path with PR number | ||
| ASSET_PREFIX=https://blog.vllm.ai/guidellm/ui/pr/${PR_NUMBER} | ||
| USE_MOCK_DATA=true | ||
| BASE_PATH=/ui/pr/${PR_NUMBER} | ||
| GIT_SHA=${{ github.sha }} | ||
| export ASSET_PREFIX=${ASSET_PREFIX} | ||
| export BASE_PATH=${BASE_PATH} | ||
| export GIT_SHA=${GIT_SHA} | ||
| export USE_MOCK_DATA=${USE_MOCK_DATA} | ||
| npm run build | ||
| - name: Deploy to GitHub Pages | ||
| if: steps.check-changes.outputs.should_build == 'true' | ||
| uses: peaceiris/actions-gh-pages@v3 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| publish_dir: ./src/ui/out | ||
| destination_dir: ui/pr/${{ steps.build.outputs.pr_number }} | ||
| keep_files: false | ||
| user_name: ${{ github.actor }} | ||
| user_email: ${{ github.actor }}@users.noreply.github.com | ||
| publish_branch: gh-pages | ||
| commit_message: 'build: Deploy preview build for PR #${{ github.event.pull_request.number }}' | ||
| - name: Set deployment url | ||
| if: steps.check-changes.outputs.should_build == 'true' | ||
| id: deploy | ||
| run: | | ||
| DEPLOY_URL=https://blog.vllm.ai/guidellm/ui/pr/${{ steps.build.outputs.pr_number }} | ||
| echo "url=${DEPLOY_URL}" >> $GITHUB_OUTPUT | ||
| - name: Find PR comment | ||
| if: steps.check-changes.outputs.should_build == 'true' | ||
| uses: peter-evans/find-comment@v2 | ||
| id: find-comment | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| body-includes: '<!-- pr-preview-comment -->' | ||
| - name: Post Deployment URL to PR | ||
| if: steps.check-changes.outputs.should_build == 'true' | ||
| uses: peter-evans/create-or-update-comment@v3 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | ||
| issue-number: ${{ github.event.pull_request.number }} | ||
| edit-mode: replace | ||
| body: | | ||
| <!-- pr-preview-comment --> | ||
| 🎉 **Live Preview:** [Click here to view the live version](${{ steps.deploy.outputs.url }}) | ||
| *Last updated: ${{ github.sha }}* | ||
| - name: Skip build notification | ||
| if: steps.check-changes.outputs.should_build == 'false' | ||
| run: echo "Skipping UI preview build - no relevant files changed" | ||
| build-and-push-container: | ||
| # Only build if the PR branch is local | ||
| if: github.event.pull_request.head.repo.full_name == github.repository | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| packages: write | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Buildah build | ||
| id: build-image | ||
| uses: redhat-actions/buildah-build@v2 | ||
| with: | ||
| image: ${{ github.event.repository.name }} | ||
| build-args: | | ||
| GUIDELLM_BUILD_TYPE=dev | ||
| tags: "pr-${{ github.event.number }}" | ||
| containerfiles: | | ||
| ./Containerfile | ||
| - name: Push To ghcr.io | ||
| id: push-to-ghcr | ||
| uses: redhat-actions/push-to-registry@v2 | ||
| with: | ||
| image: ${{ steps.build-image.outputs.image }} | ||
| tags: ${{ steps.build-image.outputs.tags }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ github.token }} | ||
| registry: ghcr.io/${{ github.repository_owner }} | ||