|
| 1 | +name: E2E (playwright-utils) |
| 2 | + |
| 3 | +# UI tests in e2e/, built on the private @anaconda/playwright-utils package. |
| 4 | +# Not a required check: a failure is reported on the PR but never blocks a merge. |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + merge_group: |
| 9 | + workflow_dispatch: |
| 10 | + push: |
| 11 | + # Temporary: lets the pipeline run from the working branch before a PR exists. |
| 12 | + branches: [e2e/legacy-tests-on-playwright-utils] |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: read |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + e2e: |
| 23 | + # Fork PRs get no secrets, so the private package can't be installed; skip instead of failing. |
| 24 | + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository |
| 25 | + runs-on: ubuntu-latest |
| 26 | + timeout-minutes: 45 |
| 27 | + |
| 28 | + services: |
| 29 | + postgres: |
| 30 | + image: pgvector/pgvector:pg16 |
| 31 | + env: |
| 32 | + POSTGRES_HOST_AUTH_METHOD: trust |
| 33 | + options: >- |
| 34 | + --health-cmd pg_isready |
| 35 | + --health-interval 10s |
| 36 | + --health-timeout 5s |
| 37 | + --health-retries 5 |
| 38 | + ports: |
| 39 | + - 5432:5432 |
| 40 | + |
| 41 | + env: |
| 42 | + POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/postgres |
| 43 | + POSTGRES_CONNECT_TIMEOUT: 30000 |
| 44 | + POSTGRES_MAX_QUERY_TIME: 30000 |
| 45 | + |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 48 | + with: |
| 49 | + # Nothing here pushes; don't leave the job's GITHUB_TOKEN in .git/config for later steps. |
| 50 | + persist-credentials: false |
| 51 | + |
| 52 | + - name: Setup pnpm |
| 53 | + uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v4.4.0 |
| 54 | + |
| 55 | + - name: Setup Node.js |
| 56 | + uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 |
| 57 | + with: |
| 58 | + node-version-file: '.nvmrc' |
| 59 | + cache: 'pnpm' |
| 60 | + cache-dependency-path: | |
| 61 | + pnpm-lock.yaml |
| 62 | + e2e/pnpm-lock.yaml |
| 63 | +
|
| 64 | + - name: Install app dependencies |
| 65 | + run: pnpm install --frozen-lockfile |
| 66 | + |
| 67 | + - name: Install e2e dependencies |
| 68 | + working-directory: e2e |
| 69 | + # The token is scoped to this step only; the app and the tests never see it. |
| 70 | + env: |
| 71 | + NODE_AUTH_TOKEN: ${{ secrets.ANACONDA_PACKAGES_READ_TOKEN }} |
| 72 | + run: pnpm install --frozen-lockfile --ignore-workspace --ignore-scripts |
| 73 | + |
| 74 | + - name: Run database migrations |
| 75 | + run: pnpm drizzle migrate |
| 76 | + |
| 77 | + - name: Cache Playwright browsers |
| 78 | + id: playwright-cache |
| 79 | + uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4 |
| 80 | + with: |
| 81 | + path: ~/.cache/ms-playwright |
| 82 | + key: playwright-${{ runner.os }}-${{ hashFiles('e2e/pnpm-lock.yaml') }} |
| 83 | + |
| 84 | + - name: Install Playwright browser |
| 85 | + if: steps.playwright-cache.outputs.cache-hit != 'true' |
| 86 | + working-directory: e2e |
| 87 | + run: pnpm exec playwright install --with-deps chromium |
| 88 | + |
| 89 | + - name: Install Playwright system dependencies |
| 90 | + if: steps.playwright-cache.outputs.cache-hit == 'true' |
| 91 | + working-directory: e2e |
| 92 | + run: pnpm exec playwright install-deps chromium |
| 93 | + |
| 94 | + - name: Start web app |
| 95 | + run: nohup node e2e/ci/start-web.mjs > web-server.log 2>&1 & |
| 96 | + |
| 97 | + - name: Warm up routes |
| 98 | + run: node e2e/ci/warm-up.mjs |
| 99 | + |
| 100 | + - name: Run tests |
| 101 | + working-directory: e2e |
| 102 | + run: pnpm test |
| 103 | + |
| 104 | + - name: Upload report |
| 105 | + if: always() |
| 106 | + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 107 | + with: |
| 108 | + name: e2e-report |
| 109 | + path: | |
| 110 | + e2e/playwright-report |
| 111 | + e2e/test-results |
| 112 | + web-server.log |
| 113 | + retention-days: 7 |
0 commit comments