diff --git a/.github/workflows/development-cleanup.yml b/.github/workflows/development-cleanup.yml new file mode 100644 index 00000000..b40f7431 --- /dev/null +++ b/.github/workflows/development-cleanup.yml @@ -0,0 +1,87 @@ +name: Cleanup Dev + +on: + pull_request: + types: [closed] + +jobs: + cleanup-ui-pr-preview: + permissions: + contents: write + id-token: 'write' + issues: write + runs-on: ubuntu-latest + + steps: + - name: Check out gh-pages branch + uses: actions/checkout@v3 + with: + ref: gh-pages + fetch-depth: 1 + + - name: Check if preview directory exists + id: check-preview + run: | + if [ -d "ui/pr/${{ github.event.pull_request.number }}" ]; then + echo "preview_exists=true" >> $GITHUB_OUTPUT + echo "Preview directory exists for PR #${{ github.event.pull_request.number }}" + else + echo "preview_exists=false" >> $GITHUB_OUTPUT + echo "No preview directory found for PR #${{ github.event.pull_request.number }}" + fi + + - name: Create an empty directory for cleanup + if: steps.check-preview.outputs.preview_exists == 'true' + run: mkdir -p empty + + - name: Remove GitHub Pages Build + if: steps.check-preview.outputs.preview_exists == 'true' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./empty + destination_dir: ui/pr/${{ github.event.pull_request.number }} + keep_files: false + user_name: ${{ github.actor }} + user_email: ${{ github.actor }}@users.noreply.github.com + publish_branch: gh-pages + commit_message: 'chore: Clean up preview for PR #${{ github.event.pull_request.number }}' + + - name: Log Cleanup Completion + run: echo "Cleanup completed for PR \#${{ github.event.pull_request.number }}" + + update-preview-comment: + needs: [cleanup-ui-pr-preview] + name: Update PR Comment + permissions: + pull-requests: write + issues: write + runs-on: ubuntu-latest + steps: + - name: Update PR comment to reflect cleanup + uses: peter-evans/find-comment@v2 + id: find-comment + with: + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ github.event.pull_request.number }} + body-includes: '' + + - name: Update PR comment to reflect cleanup + if: steps.find-comment.outputs.comment-id != '' + 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: | + + ๐Ÿงน The live preview for this PR has been removed. + + - name: Log comment update status + run: | + if [ "${{ steps.find-comment.outputs.comment-id }}" != "" ]; then + echo "Updated existing preview comment" + else + echo "No preview comment found to update" + fi diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index de322bcb..43f53936 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -29,6 +29,11 @@ jobs: - 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 @@ -59,6 +64,11 @@ jobs: - 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 @@ -81,7 +91,7 @@ jobs: - name: Run pre-commit checks run: SKIP=ruff-format pre-commit run --all-files - ui-precommit-check: + ui-precommit-checks: permissions: contents: "read" runs-on: ubuntu-latest @@ -89,6 +99,11 @@ jobs: - 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 @@ -119,6 +134,11 @@ jobs: - 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 @@ -149,6 +169,11 @@ jobs: - 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 @@ -208,6 +233,105 @@ jobs: ` }) + ui-pr-preview: + needs: [ui-quality-checks, ui-precommit-checks, ui-unit-tests, ui-integration-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: 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://neuralmagic.github.io/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://neuralmagic.github.io/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: '' + + - 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: | + + ๐ŸŽ‰ **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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 47aef02e..cdc4c284 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,25 @@ jobs: - 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@v3 + + - 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: @@ -38,6 +57,25 @@ jobs: - 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@v3 + + - 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: @@ -54,6 +92,25 @@ jobs: - 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@v3 + + - 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 + unit-tests: runs-on: ubuntu-latest strategy: @@ -70,6 +127,25 @@ jobs: - name: Run unit tests run: tox -e test-unit -- -m "smoke or sanity" + ui-unit-tests: + permissions: + contents: "read" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Run unit tests + run: npm run test:unit + integration-tests: runs-on: ubuntu-latest strategy: @@ -85,3 +161,65 @@ jobs: run: pip install tox - name: Run integration tests run: tox -e test-integration -- -m smoke + + ui-integration-tests: + permissions: + contents: "read" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Run integration tests + run: npm run test:integration + + deploy-ui-build: + needs: [ui-quality-checks, ui-precommit-checks, ui-unit-tests, ui-type-checks, ui-integration-tests] + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Build app to root + id: build + run: | + # Export vars to ensure they are loaded before build + export $(grep -v '^#' .env.development | xargs) + + # Set asset prefix and base path with PR number + ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/dev + BASE_PATH=/ui/dev + GIT_SHA=${{ github.sha }} + export ASSET_PREFIX=${ASSET_PREFIX} + export BASE_PATH=${BASE_PATH} + export GIT_SHA=${GIT_SHA} + npm run build + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ui/out + destination_dir: ui/dev + keep_files: false + user_name: ${{ github.actor }} + user_email: ${{ github.actor }}@users.noreply.github.com + publish_branch: gh-pages diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 02825fbe..2fedf537 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -38,6 +38,25 @@ jobs: - name: Run unit tests run: tox -e test-unit + ui-unit-tests: + permissions: + contents: "read" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Run unit tests + run: npm run test:unit + integration-tests: runs-on: ubuntu-latest strategy: @@ -54,6 +73,25 @@ jobs: - name: Run integration tests run: tox -e test-integration -- -m "smoke or sanity" + ui-integration-tests: + permissions: + contents: "read" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Run integration tests + run: npm run test:integration + e2e-tests: runs-on: ubuntu-latest strategy: @@ -70,6 +108,35 @@ jobs: - name: Run integration tests run: tox -e test-e2e -- -m smoke + ui-e2e-tests: + permissions: + contents: "read" + id-token: "write" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Generate Build + run: | + npm run build + + - name: Start the Next.js app + run: | + npx serve@latest src/ui/out & + npx wait-on http://localhost:3000 # Wait until the app is ready + + - name: Run Cypress tests + run: npm run test:e2e --headless + build-and-publish: needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest @@ -124,6 +191,60 @@ jobs: run: | echo "Artifacts uploaded to: ${{ steps.artifact-upload.outputs.artifact-url }}" + publish-ui-build: + needs: [ui-unit-tests, ui-integration-tests, ui-e2e-tests] + permissions: + contents: write + pull-requests: write + issues: write + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: "Set GIT_TAG" + id: vars + run: | + if [ -z "${{ github.ref_name }}" ]; then + echo "TAG=latest" >> $GITHUB_ENV + else + echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV + fi + + - name: Build app to root + id: build + run: | + # Export vars to ensure they are loaded before build + export $(grep -v '^#' .env.staging | xargs) + + # Set asset prefix and base path with git tag + ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/nightly + BASE_PATH=/ui/nightly + GIT_SHA=${{ github.sha }} + export ASSET_PREFIX=${ASSET_PREFIX} + export BASE_PATH=${BASE_PATH} + export GIT_SHA=${GIT_SHA} + npm run build + + - name: Update latest build in GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ui/out + destination_dir: ui/nightly + keep_files: false + user_name: ${{ github.actor }} + user_email: ${{ github.actor }}@users.noreply.github.com + publish_branch: gh-pages + build-and-push-container: needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index 7d194ed4..a7236127 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -38,6 +38,25 @@ jobs: - name: Run unit tests run: tox -e test-unit + ui-unit-tests: + permissions: + contents: "read" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Run unit tests + run: npm run test:unit + integration-tests: runs-on: ubuntu-latest strategy: @@ -54,6 +73,25 @@ jobs: - name: Run integration tests run: tox -e test-integration + ui-integration-tests: + permissions: + contents: "read" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Run integration tests + run: npm run test:integration + e2e-tests: runs-on: ubuntu-latest strategy: @@ -70,6 +108,35 @@ jobs: - name: Run end-to-end tests run: tox -e test-e2e + ui-e2e-tests: + permissions: + contents: "read" + id-token: "write" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Generate Build + run: | + npm run build + + - name: Start the Next.js app + run: | + npx serve@latest src/ui/out & + npx wait-on http://localhost:3000 # Wait until the app is ready + + - name: Run Cypress tests + run: npm run test:e2e --headless + build-and-publish: needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest @@ -116,6 +183,112 @@ jobs: password: ${{ secrets.PYPI_PUBLIC_AUTH }} whl: $(find dist -name '*.tar.gz') + publish-versioned-ui-build: + needs: [ui-unit-tests, ui-integration-tests, ui-e2e-tests] + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: "Set GIT_TAG" + id: vars + run: | + if [ -z "${{ github.ref_name }}" ]; then + echo "TAG=latest" >> $GITHUB_ENV + else + echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV + fi + + - name: Build app to root + id: build + run: | + # Export vars to ensure they are loaded before build + export $(grep -v '^#' .env.staging | xargs) + + # Set asset prefix and base path with git tag + ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/release/${TAG} + BASE_PATH=/ui/release/${TAG} + GIT_SHA=${{ github.sha }} + export ASSET_PREFIX=${ASSET_PREFIX} + export BASE_PATH=${BASE_PATH} + export GIT_SHA=${GIT_SHA} + npm run build + + - name: Deploy versioned build to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ui/out + destination_dir: ui/release/${TAG} + keep_files: false + user_name: ${{ github.actor }} + user_email: ${{ github.actor }}@users.noreply.github.com + publish_branch: gh-pages + + publish-latest-ui-build: + needs: [publish-versioned-ui-build] + permissions: + contents: write + pull-requests: write + issues: write + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: "Set GIT_TAG" + id: vars + run: | + if [ -z "${{ github.ref_name }}" ]; then + echo "TAG=latest" >> $GITHUB_ENV + else + echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV + fi + + - name: Build app to root + id: build + run: | + # Export vars to ensure they are loaded before build + export $(grep -v '^#' .env.staging | xargs) + + # Set asset prefix and base path with git tag + ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/release/latest + BASE_PATH=/ui/release/latest + GIT_SHA=${{ github.sha }} + export ASSET_PREFIX=${ASSET_PREFIX} + export BASE_PATH=${BASE_PATH} + export GIT_SHA=${GIT_SHA} + npm run build + + - name: Update latest build in GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ui/out + destination_dir: ui/release/latest + keep_files: false + user_name: ${{ github.actor }} + user_email: ${{ github.actor }}@users.noreply.github.com + publish_branch: gh-pages + build-and-push-container: needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 191ba1eb..f8cf7901 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,7 +3,7 @@ name: Release on: push: tags: - - 'v*.*.*' + - "v*.*.*" jobs: build-and-publish: @@ -37,7 +37,7 @@ jobs: retention-days: 90 - name: Log artifact location run: | - echo "Artifacts uploaded to: Artifacts uploaded to: ${{ steps.artifact-upload.outputs.artifact-url }}" + echo "Artifacts uploaded to: ${{ steps.artifact-upload.outputs.artifact-url }}" - name: Push wheel to PyPI uses: neuralmagic/nm-actions/actions/publish-whl@v1.0.0 with: @@ -83,6 +83,25 @@ jobs: - name: Run unit tests run: tox -e test-unit + ui-unit-tests: + permissions: + contents: "read" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Run unit tests + run: npm run test:unit + integration-tests: runs-on: ubuntu-latest strategy: @@ -99,6 +118,25 @@ jobs: - name: Run integration tests run: tox -e test-integration + ui-integration-tests: + permissions: + contents: "read" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Run integration tests + run: npm run test:integration + e2e-tests: runs-on: ubuntu-latest strategy: @@ -115,6 +153,141 @@ jobs: - name: Run end-to-end tests run: tox -e test-e2e + ui-e2e-tests: + permissions: + contents: "read" + id-token: "write" + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: Generate Build + run: | + npm run build + + - name: Start the Next.js app + run: | + npx serve@latest src/ui/out & + npx wait-on http://localhost:3000 # Wait until the app is ready + + - name: Run Cypress tests + run: npm run test:e2e --headless + + publish-versioned-ui-build: + needs: [ui-unit-tests, ui-integration-tests, ui-e2e-tests] + permissions: + contents: write + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: "Set GIT_TAG" + id: vars + run: | + if [ -z "${{ github.ref_name }}" ]; then + echo "TAG=latest" >> $GITHUB_ENV + else + echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV + fi + + - name: Build app to root + id: build + run: | + # Export vars to ensure they are loaded before build + export $(grep -v '^#' .env.production | xargs) + + # Set asset prefix and base path with git tag + ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/${TAG} + BASE_PATH=/ui/${TAG} + GIT_SHA=${{ github.sha }} + export ASSET_PREFIX=${ASSET_PREFIX} + export BASE_PATH=${BASE_PATH} + export GIT_SHA=${GIT_SHA} + npm run build + + - name: Deploy versioned build to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ui/out + destination_dir: ui/${TAG} + keep_files: false + user_name: ${{ github.actor }} + user_email: ${{ github.actor }}@users.noreply.github.com + publish_branch: gh-pages + + publish-latest-ui-build: + needs: [publish-versioned-ui-build] + permissions: + contents: write + pull-requests: write + issues: write + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Set up Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: '22' + + - name: Install dependencies + run: npm ci + + - name: "Set GIT_TAG" + id: vars + run: | + if [ -z "${{ github.ref_name }}" ]; then + echo "TAG=latest" >> $GITHUB_ENV + else + echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV + fi + + - name: Build app to root + id: build + run: | + # Export vars to ensure they are loaded before build + export $(grep -v '^#' .env.production | xargs) + + # Set asset prefix and base path with git tag + ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/latest + BASE_PATH=/ui/latest + GIT_SHA=${{ github.sha }} + export ASSET_PREFIX=${ASSET_PREFIX} + export BASE_PATH=${BASE_PATH} + export GIT_SHA=${GIT_SHA} + npm run build + + - name: Update latest build in GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./ui/out + destination_dir: ui/latest + keep_files: false + user_name: ${{ github.actor }} + user_email: ${{ github.actor }}@users.noreply.github.com + publish_branch: gh-pages + build-and-push-container: needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest diff --git a/src/ui/.env.development b/src/ui/.env.development index 66c8d235..2d03b789 100644 --- a/src/ui/.env.development +++ b/src/ui/.env.development @@ -1,3 +1,3 @@ -ASSET_PREFIX=https://review.neuralmagic.com/guidellm-ui/dev/_next -BASE_PATH=/guidellm-ui/dev +ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/dev +BASE_PATH=/ui/dev NEXT_PUBLIC_USE_MOCK_API=true diff --git a/src/ui/.env.example b/src/ui/.env.example index 44ab168b..b9d5ff2b 100644 --- a/src/ui/.env.example +++ b/src/ui/.env.example @@ -1,4 +1,4 @@ ASSET_PREFIX=http://localhost:3000 BASE_PATH=http://localhost:3000 NEXT_PUBLIC_USE_MOCK_API=true -USE_MOCK_DATA=true +USE_MOCK_DATA=false diff --git a/src/ui/.env.local b/src/ui/.env.local index 44ab168b..b9d5ff2b 100644 --- a/src/ui/.env.local +++ b/src/ui/.env.local @@ -1,4 +1,4 @@ ASSET_PREFIX=http://localhost:3000 BASE_PATH=http://localhost:3000 NEXT_PUBLIC_USE_MOCK_API=true -USE_MOCK_DATA=true +USE_MOCK_DATA=false diff --git a/src/ui/.env.production b/src/ui/.env.production index 66c8d235..981e7d86 100644 --- a/src/ui/.env.production +++ b/src/ui/.env.production @@ -1,3 +1,3 @@ -ASSET_PREFIX=https://review.neuralmagic.com/guidellm-ui/dev/_next -BASE_PATH=/guidellm-ui/dev +ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/latest +BASE_PATH=/ui/latest NEXT_PUBLIC_USE_MOCK_API=true diff --git a/src/ui/.env.staging b/src/ui/.env.staging index 66c8d235..416e04c3 100644 --- a/src/ui/.env.staging +++ b/src/ui/.env.staging @@ -1,3 +1,3 @@ -ASSET_PREFIX=https://review.neuralmagic.com/guidellm-ui/dev/_next -BASE_PATH=/guidellm-ui/dev +ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/release/latest +BASE_PATH=/ui/release/latest NEXT_PUBLIC_USE_MOCK_API=true