From 668632c398c63ded1a0d81f04a94079d110477d1 Mon Sep 17 00:00:00 2001 From: Zack Pollard Date: Tue, 3 Sep 2024 20:19:47 +0100 Subject: [PATCH] ci: split e2e into web / server & cli / linting & run on mich (#12267) * ci: split e2e tests into web / server & cli / linting * ci: run e2e on mich --- .github/workflows/test.yml | 89 +++++++++++++++++++++++++++++++------- 1 file changed, 74 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7b1d44b354..ac6236d2eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,8 @@ jobs: should_run_e2e: ${{ steps.found_paths.outputs.e2e == 'true' || steps.should_force.outputs.should_force == 'true' }} should_run_mobile: ${{ steps.found_paths.outputs.mobile == 'true' || steps.should_force.outputs.should_force == 'true' }} should_run_ml: ${{ steps.found_paths.outputs.machine-learning == 'true' || steps.should_force.outputs.should_force == 'true' }} + should_run_e2e_web: ${{ steps.found_paths.outputs.e2e == 'true' || steps.found_paths.outputs.web == 'true' || steps.should_force.outputs.should_force == 'true' }} + should_run_e2e_server_cli: ${{ steps.found_paths.outputs.e2e == 'true' || steps.found_paths.outputs.server == 'true' || steps.found_paths.outputs.cli == 'true' || steps.should_force.outputs.should_force == 'true' }} steps: - name: Checkout code uses: actions/checkout@v4 @@ -36,9 +38,6 @@ jobs: - 'open-api/typescript-sdk/**' e2e: - 'e2e/**' - - 'cli/**' - - 'server/**' - - 'open-api/typescript-sdk/**' mobile: - 'mobile/**' machine-learning: @@ -205,8 +204,8 @@ jobs: run: npm run test:cov if: ${{ !cancelled() }} - e2e-tests: - name: End-to-End Tests + e2e-tests-lint: + name: End-to-End Lint needs: pre-job if: ${{ needs.pre-job.outputs.should_run_e2e == 'true' }} runs-on: ubuntu-latest @@ -214,6 +213,45 @@ jobs: run: working-directory: ./e2e + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: './e2e/.nvmrc' + + - name: Run setup typescript-sdk + run: npm ci && npm run build + working-directory: ./open-api/typescript-sdk + if: ${{ !cancelled() }} + + - name: Install dependencies + run: npm ci + if: ${{ !cancelled() }} + + - name: Run linter + run: npm run lint + if: ${{ !cancelled() }} + + - name: Run formatter + run: npm run format + if: ${{ !cancelled() }} + + - name: Run tsc + run: npm run check + if: ${{ !cancelled() }} + + e2e-tests-server-cli: + name: End-to-End Tests (Server & CLI) + needs: pre-job + if: ${{ needs.pre-job.outputs.should_run_e2e_server_cli == 'true' }} + runs-on: mich + defaults: + run: + working-directory: ./e2e + steps: - name: Checkout code uses: actions/checkout@v4 @@ -239,16 +277,41 @@ jobs: run: npm ci if: ${{ !cancelled() }} - - name: Run linter - run: npm run lint + - name: Docker build + run: docker compose build if: ${{ !cancelled() }} - - name: Run formatter - run: npm run format + - name: Run e2e tests (api & cli) + run: npm run test if: ${{ !cancelled() }} - - name: Run tsc - run: npm run check + e2e-tests-web: + name: End-to-End Tests (Web) + needs: pre-job + if: ${{ needs.pre-job.outputs.should_run_e2e_web == 'true' }} + runs-on: mich + defaults: + run: + working-directory: ./e2e + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: 'recursive' + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version-file: './e2e/.nvmrc' + + - name: Run setup typescript-sdk + run: npm ci && npm run build + working-directory: ./open-api/typescript-sdk + if: ${{ !cancelled() }} + + - name: Install dependencies + run: npm ci if: ${{ !cancelled() }} - name: Install Playwright Browsers @@ -259,10 +322,6 @@ jobs: run: docker compose build if: ${{ !cancelled() }} - - name: Run e2e tests (api & cli) - run: npm run test - if: ${{ !cancelled() }} - - name: Run e2e tests (web) run: npx playwright test if: ${{ !cancelled() }}