diff --git a/.github/actions/run-tox/action.yml b/.github/actions/run-tox/action.yml new file mode 100644 index 000000000..98d2f39c1 --- /dev/null +++ b/.github/actions/run-tox/action.yml @@ -0,0 +1,29 @@ +name: 'Run tox with environment' +description: 'Runs tox with pdm as the package manager' +inputs: + python-version: + type: string + required: true + tox-env: + type: string + required: true + tox-args: + type: string + required: false +runs: + using: "composite" + steps: + - name: Setup Python with PDM + uses: pdm-project/setup-pdm@v4 + with: + python-version: ${{ inputs.python-version }} + - name: Install dependencies + run: | + pip install tox tox-pdm + shell: bash + - name: Run tox + run: | + tox run -e "${{ inputs.tox-env }}" -- ${{ inputs.tox-args }} + # errno 5 means all tests were filtered out, ignore + ret=$? && [[ $ret -eq 5 ]] && exit 0; exit $ret + shell: bash diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 88e77c970..13b5c002d 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -5,191 +5,30 @@ on: types: [opened, synchronize, reopened] jobs: - 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 + tests: 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 + uses: ./.github/workflows/testing.yml + with: + python: ${{ matrix.python }} - 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 + ui-tests: + uses: ./.github/workflows/ui-testing.yml - - name: Run pre-commit checks - run: npx husky run pre-commit - - unit-tests: - runs-on: ubuntu-latest + quality: 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 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@v4 - - - 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: - 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 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@v4 - - - name: Set up Node.js 22 - uses: actions/setup-node@v4 - with: - node-version: '22' - - - name: Install dependencies - run: npm ci + python: ["3.10"] + uses: ./.github/workflows/quality.yml + with: + python: ${{ matrix.python }} - - name: Run integration tests - run: npm run test:integration + ui-quality: + uses: ./.github/workflows/ui-quality.yml ui-pr-preview: - needs: [ui-quality-checks, ui-precommit-checks, ui-unit-tests, ui-integration-tests] + needs: [ui-quality, ui-tests] permissions: contents: write pull-requests: write diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 096311621..d0fc5efc6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,191 +6,31 @@ on: - main jobs: - quality-checks: - runs-on: ubuntu-latest + tests: strategy: matrix: python: ["3.10", "3.11", "3.12", "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 + uses: ./.github/workflows/testing.yml + with: + python: ${{ matrix.python }} + args: -m "smoke" - ui-quality-checks: - permissions: - contents: "read" - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v3 + ui-tests: + uses: ./.github/workflows/ui-testing.yml - - 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 + quality: strategy: matrix: python: ["3.10", "3.11", "3.12", "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@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: - 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@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: - 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 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: - 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 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 + uses: ./.github/workflows/quality.yml + with: + python: ${{ matrix.python }} - - name: Run integration tests - run: npm run test:integration + ui-quality: + uses: ./.github/workflows/ui-quality.yml deploy-ui-build: - needs: [ui-quality-checks, ui-precommit-checks, ui-unit-tests, ui-type-checks, ui-integration-tests] + needs: [ui-quality, ui-tests] permissions: contents: write runs-on: ubuntu-latest diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0e2e1f759..d9526f066 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -6,147 +6,20 @@ on: workflow_dispatch: # Enables manual triggering of the workflow jobs: - link-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: | - curl -sSL https://pdm-project.org/install-pdm.py | python3 - - pip install tox tox-pdm - - name: Run link checks - run: tox -e links - - unit-tests: - runs-on: ubuntu-latest + tests: 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 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 + uses: ./.github/workflows/testing.yml + with: + python: ${{ matrix.python }} + args: -m "smoke or sanity" - integration-tests: - 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 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: - 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 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 + ui-tests: + uses: ./.github/workflows/ui-testing.yml build-and-publish: - needs: [unit-tests, integration-tests, e2e-tests] + needs: [tests] runs-on: ubuntu-latest strategy: matrix: @@ -157,11 +30,12 @@ jobs: with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v5 + uses: pdm-project/setup-pdm@v4 with: python-version: ${{ matrix.python }} - name: Install dependencies - run: pip install tox tox-pdm + run: | + pip install tox tox-pdm - name: Build the package run: | export GUIDELLM_BUILD_TYPE=nightly @@ -200,7 +74,7 @@ jobs: echo "Artifacts uploaded to: ${{ steps.artifact-upload.outputs.artifact-url }}" publish-ui-build: - needs: [ui-unit-tests, ui-integration-tests, ui-e2e-tests] + needs: [ui-tests] permissions: contents: write pull-requests: write @@ -254,7 +128,7 @@ jobs: publish_branch: gh-pages build-and-push-container: - needs: [unit-tests, integration-tests, e2e-tests] + needs: [tests] runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 000000000..4bc055a66 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,42 @@ +name: Quality Checks + +on: + workflow_call: + inputs: + python: + required: true + type: string + +jobs: + quality-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run quality checks + uses: ./.github/actions/run-tox + with: + python-version: ${{ inputs.python }} + tox-env: quality + + type-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run type checks + uses: ./.github/actions/run-tox + with: + python-version: ${{ inputs.python }} + tox-env: types + + precommit-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ inputs.python }} + - name: Install dependencies + run: pip install pre-commit + - name: Run pre-commit checks + run: SKIP=ruff-format pre-commit run --all-files diff --git a/.github/workflows/release-candidate.yml b/.github/workflows/release-candidate.yml index 2b90c5446..a5db56788 100644 --- a/.github/workflows/release-candidate.yml +++ b/.github/workflows/release-candidate.yml @@ -6,147 +6,19 @@ on: - 'release/*' jobs: - link-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: | - curl -sSL https://pdm-project.org/install-pdm.py | python3 - - pip install tox tox-pdm - - name: Run link checks - run: tox -e links - - unit-tests: - runs-on: ubuntu-latest + tests: strategy: matrix: python: ["3.10", "3.11", "3.12", "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 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: - matrix: - python: ["3.10", "3.11", "3.12", "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 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: - matrix: - python: ["3.10", "3.11", "3.12", "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 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 + uses: ./.github/workflows/testing.yml + with: + python: ${{ matrix.python }} - - name: Run Cypress tests - run: npm run test:e2e --headless + ui-tests: + uses: ./.github/workflows/ui-testing.yml build-and-publish: - needs: [unit-tests, integration-tests, e2e-tests] + needs: [tests] runs-on: ubuntu-latest strategy: matrix: @@ -157,12 +29,11 @@ jobs: with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v5 + uses: pdm-project/setup-pdm@v4 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: Build the package run: | @@ -194,7 +65,7 @@ jobs: whl: $(find dist -name '*.tar.gz') publish-versioned-ui-build: - needs: [ui-unit-tests, ui-integration-tests, ui-e2e-tests] + needs: [ui-tests] permissions: contents: write runs-on: ubuntu-latest @@ -300,7 +171,7 @@ jobs: publish_branch: gh-pages build-and-push-container: - needs: [unit-tests, integration-tests, e2e-tests] + needs: tests runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b77b21876..bf2f9a37e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,6 +6,17 @@ on: - "v*.*.*" jobs: + tests: + strategy: + matrix: + python: ["3.10", "3.11", "3.12", "3.13"] + uses: ./.github/workflows/testing.yml + with: + python: ${{ matrix.python }} + + ui-tests: + uses: ./.github/workflows/ui-testing.yml + build-and-publish: runs-on: ubuntu-latest strategy: @@ -17,12 +28,11 @@ jobs: with: fetch-depth: 0 - name: Set up Python - uses: actions/setup-python@v5 + uses: pdm-project/setup-pdm@v4 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: Build the package run: | @@ -53,143 +63,9 @@ jobs: password: ${{ secrets.PYPI_PUBLIC_AUTH }} whl: $(find dist -name '*.tar.gz') - link-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: | - curl -sSL https://pdm-project.org/install-pdm.py | python3 - - pip install tox tox-pdm - - name: Run link checks - run: tox -e links - - unit-tests: - runs-on: ubuntu-latest - strategy: - matrix: - python: ["3.10", "3.11", "3.12", "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 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: - matrix: - python: ["3.10", "3.11", "3.12", "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: pip install tox tox-pdm - - 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: - matrix: - python: ["3.10", "3.11", "3.12", "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: pip install tox tox-pdm - - 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] + needs: [ui-tests] permissions: contents: write runs-on: ubuntu-latest @@ -295,7 +171,6 @@ jobs: publish_branch: gh-pages build-and-push-container: - needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/e2e.yml b/.github/workflows/testing.yml similarity index 60% rename from .github/workflows/e2e.yml rename to .github/workflows/testing.yml index 25df5bf50..7640950b1 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/testing.yml @@ -1,25 +1,42 @@ -# This workflow builds a Docker artifact, caches it based on the Dockerfile content, -# and then runs e2e tests using that artifact. - -name: E2E Tests +name: Tests on: - push: - branches: - - main - pull_request: - branches: - - main - workflow_dispatch: + workflow_call: + inputs: + python: + required: true + type: string + args: + required: false + type: string jobs: - build-and-test: + unit-tests: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run unit tests + uses: ./.github/actions/run-tox + with: + python-version: ${{ inputs.python }} + tox-env: test-unit + tox-args: ${{ inputs.args }} + integration-tests: + runs-on: ubuntu-latest steps: - - name: Check out repository - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + - name: Run integration tests + uses: ./.github/actions/run-tox + with: + python-version: ${{ inputs.python }} + tox-env: test-integration + tox-args: ${{ inputs.args }} + e2e-tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 # Cache the binary artifact # The key is based on the runner's OS and the hash of the Dockerfile. # If the Dockerfile changes, the hash changes, and a new cache is created. @@ -31,11 +48,9 @@ jobs: path: bin/llm-d-inference-sim # The unique key for the cache key: vllm-sim-binary-${{ runner.os }}-${{ hashFiles('tests/e2e/vllm-sim.Dockerfile') }} - # Set up Docker Buildx (required for the 'docker build -o' command) - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - # Conditionally build the artifact # This step only runs if the cache step above did NOT find a match. # 'steps.cache-vllm-sim.outputs.cache-hit' will be 'true' if the cache was restored. @@ -45,7 +60,6 @@ jobs: echo "Cache miss. Building artifact..." docker build . -f tests/e2e/vllm-sim.Dockerfile -o type=local,dest=./ shell: bash - - name: Verify artifact run: | if [ -f "bin/llm-d-inference-sim" ]; then @@ -55,15 +69,9 @@ jobs: exit 1 fi shell: bash - - - name: Set up Python - uses: actions/setup-python@v5 + - name: Run end-to-end tests + uses: ./.github/actions/run-tox 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 E2E tests - run: tox -e test-e2e - shell: bash + python-version: ${{ inputs.python }} + tox-env: test-e2e + tox-args: ${{ inputs.args }} diff --git a/.github/workflows/ui-quality.yml b/.github/workflows/ui-quality.yml new file mode 100644 index 000000000..be4a39dc9 --- /dev/null +++ b/.github/workflows/ui-quality.yml @@ -0,0 +1,62 @@ +name: UI Quality Checks + +on: + workflow_call: + +jobs: + 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 + + 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 + + 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 diff --git a/.github/workflows/ui-testing.yml b/.github/workflows/ui-testing.yml new file mode 100644 index 000000000..29315564f --- /dev/null +++ b/.github/workflows/ui-testing.yml @@ -0,0 +1,72 @@ +name: UI Tests + +on: + workflow_call: + +jobs: + 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 + + 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 + + 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 diff --git a/tests/e2e/test_successful_benchmark.py b/tests/e2e/test_successful_benchmark.py index 559a74adc..3642eaf43 100644 --- a/tests/e2e/test_successful_benchmark.py +++ b/tests/e2e/test_successful_benchmark.py @@ -36,6 +36,7 @@ def server(): @pytest.mark.timeout(30) +@pytest.mark.sanity def test_max_seconds_benchmark(server: VllmSimServer): """ Test that the max seconds constraint is properly triggered. @@ -78,6 +79,7 @@ def test_max_seconds_benchmark(server: VllmSimServer): @pytest.mark.timeout(30) +@pytest.mark.sanity def test_max_requests_benchmark(server: VllmSimServer): """ Test that the max requests constraint is properly triggered.