TEST: tackles some CI inefficiencies #4
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: E2E Tests | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'test/**' | |
| - 'package.json' | |
| - 'pnpm-lock.yaml' | |
| - 'tsconfig.json' | |
| - 'scripts/**' | |
| - 'packages/**' | |
| - 'examples/**' | |
| - '.github/workflows/e2e.yml' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'test/**' | |
| - 'package.json' | |
| - 'pnpm-lock.yaml' | |
| - 'tsconfig.json' | |
| - 'scripts/**' | |
| - 'packages/**' | |
| - 'examples/**' | |
| - '.github/workflows/e2e.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Type check | |
| run: pnpm run build | |
| - name: Lint check | |
| run: pnpm run lint | |
| - name: Build React Web CLI | |
| run: pnpm --filter @ably/react-web-cli build | |
| - name: Build Web CLI Example | |
| run: | | |
| cd examples/web-cli | |
| pnpm build | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install Playwright | |
| run: pnpm exec playwright install --with-deps chromium | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| dist/ | |
| packages/react-web-cli/dist/ | |
| examples/web-cli/dist/ | |
| retention-days: 1 | |
| e2e-cli-tests: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| NO_COLOR: 1 | |
| E2E_ABLY_API_KEY: ${{ secrets.E2E_ABLY_API_KEY }} | |
| E2E_ABLY_ACCESS_TOKEN: ${{ secrets.E2E_ABLY_ACCESS_TOKEN }} | |
| TERMINAL_SERVER_SIGNING_SECRET: ${{ secrets.TERMINAL_SERVER_SIGNING_SECRET }} | |
| E2E_TESTS: true | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| - name: Set up test environment | |
| run: | | |
| echo "ABLY_API_KEY=${{ secrets.E2E_ABLY_API_KEY }}" > .env.test | |
| echo "E2E_ABLY_API_KEY=${{ secrets.E2E_ABLY_API_KEY }}" >> .env.test | |
| echo "E2E_ABLY_ACCESS_TOKEN=${{ secrets.E2E_ABLY_ACCESS_TOKEN }}" >> .env.test | |
| echo "TERMINAL_SERVER_SIGNING_SECRET=${{ secrets.TERMINAL_SERVER_SIGNING_SECRET }}" >> .env.test | |
| - name: Run E2E CLI Tests | |
| run: pnpm test:e2e | |
| web-cli-auth-tests: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| NO_COLOR: 1 | |
| E2E_ABLY_API_KEY: ${{ secrets.E2E_ABLY_API_KEY }} | |
| E2E_ABLY_ACCESS_TOKEN: ${{ secrets.E2E_ABLY_ACCESS_TOKEN }} | |
| TERMINAL_SERVER_SIGNING_SECRET: ${{ secrets.TERMINAL_SERVER_SIGNING_SECRET }} | |
| E2E_TESTS: true | |
| HEADLESS: true | |
| TEST_GROUP: auth | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install Playwright | |
| run: pnpm exec playwright install --with-deps chromium | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| - name: Run Authentication & Security Tests | |
| run: | | |
| pnpm exec playwright test \ | |
| --config test/e2e/web-cli/playwright.config.ts \ | |
| test/e2e/web-cli/authentication.test.ts \ | |
| test/e2e/web-cli/domain-scoped-auth.test.ts \ | |
| --reporter=json,html | |
| web-cli-session-tests: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| env: | |
| NO_COLOR: 1 | |
| E2E_ABLY_API_KEY: ${{ secrets.E2E_ABLY_API_KEY }} | |
| E2E_ABLY_ACCESS_TOKEN: ${{ secrets.E2E_ABLY_ACCESS_TOKEN }} | |
| TERMINAL_SERVER_SIGNING_SECRET: ${{ secrets.TERMINAL_SERVER_SIGNING_SECRET }} | |
| E2E_TESTS: true | |
| HEADLESS: true | |
| TEST_GROUP: session | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install Playwright | |
| run: pnpm exec playwright install --with-deps chromium | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| - name: Run Session & Reconnection Tests | |
| run: | | |
| pnpm exec playwright test \ | |
| --config test/e2e/web-cli/playwright.config.ts \ | |
| test/e2e/web-cli/session-resume.test.ts \ | |
| test/e2e/web-cli/reconnection.test.ts \ | |
| test/e2e/web-cli/reconnection-diagnostic.test.ts \ | |
| --reporter=json,html | |
| web-cli-ui-tests: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| env: | |
| NO_COLOR: 1 | |
| E2E_ABLY_API_KEY: ${{ secrets.E2E_ABLY_API_KEY }} | |
| E2E_ABLY_ACCESS_TOKEN: ${{ secrets.E2E_ABLY_ACCESS_TOKEN }} | |
| TERMINAL_SERVER_SIGNING_SECRET: ${{ secrets.TERMINAL_SERVER_SIGNING_SECRET }} | |
| E2E_TESTS: true | |
| HEADLESS: true | |
| TEST_GROUP: ui | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install Playwright | |
| run: pnpm exec playwright install --with-deps chromium | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| - name: Run UI & Core Features Tests | |
| run: | | |
| pnpm exec playwright test \ | |
| --config test/e2e/web-cli/playwright.config.ts \ | |
| test/e2e/web-cli/terminal-ui.test.ts \ | |
| test/e2e/web-cli/web-cli.test.ts \ | |
| test/e2e/web-cli/prompt-integrity.test.ts \ | |
| --reporter=json,html | |
| web-cli-rate-limit-test: | |
| needs: [web-cli-auth-tests, web-cli-session-tests, web-cli-ui-tests] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| env: | |
| NO_COLOR: 1 | |
| E2E_ABLY_API_KEY: ${{ secrets.E2E_ABLY_API_KEY }} | |
| E2E_ABLY_ACCESS_TOKEN: ${{ secrets.E2E_ABLY_ACCESS_TOKEN }} | |
| # Terminal Server Signing Secret is intentionally not set | |
| # Rate limit test should NOT use terminal server signing secret. | |
| E2E_TESTS: true | |
| HEADLESS: true | |
| TEST_GROUP: rate-limit | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v3 | |
| with: | |
| version: 10 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install Playwright | |
| run: pnpm exec playwright install --with-deps chromium | |
| - name: Download build artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| - name: Run Rate Limit Test | |
| run: | | |
| pnpm exec playwright test \ | |
| --config test/e2e/web-cli/playwright.config.ts \ | |
| test/e2e/web-cli/z-rate-limit-trigger.test.ts \ | |
| --reporter=json,html |