Part 6 pw #8
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 with Local Supabase | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| e2e: | |
| runs-on: ubuntu-latest | |
| # Cancel older, still-running copies of the same PR/branch | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: 📥 Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: 🧰 Use Node 20 LTS | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - name: 🏗️ Install project dependencies | |
| run: npm ci | |
| # ---------- SUPABASE ---------- | |
| - name: 🛠️ Install Supabase CLI | |
| uses: supabase/setup-cli@v1 # installs a pinned version | |
| with: | |
| version: 1.160.6 # keep in sync with local dev | |
| # :contentReference[oaicite:3]{index=3} | |
| - name: 🚀 Start local Supabase stack | |
| # “--no-analytics” = skip telemetry; background (&) | |
| run: supabase start --no-analytics & | |
| env: | |
| SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN || '' }} | |
| # ^ token only needed if you sync migrations against the cloud project | |
| - name: ⏱️ Wait for Supabase ports to be ready | |
| # waits up to 2 min for 54321 (API) and 54322 (DB) | |
| run: npx wait-on tcp:54321 tcp:54322 --timeout 120000 | |
| - name: 🌱 Seed fresh database | |
| run: psql -h localhost -p 54322 -U postgres -f supabase/seed/seed.sql | |
| env: | |
| PGPASSWORD: postgres # default local password | |
| # Optional: expose keys for tests that use env vars | |
| - name: 🔑 Export Supabase env vars | |
| run: | | |
| echo "SUPABASE_URL=http://localhost:54321" >> $GITHUB_ENV | |
| echo "SUPABASE_ANON_KEY=super-secret-anon-key" >> $GITHUB_ENV | |
| # Local anon/service keys are static. If you rotate them, inject here. | |
| # :contentReference[oaicite:4]{index=4} | |
| # ---------- PLAYWRIGHT ---------- | |
| - name: 📦 Install Playwright browsers | |
| run: npx playwright install --with-deps # installs Chromium, FF, WK | |
| - name: 🧪 Run Angular 19 E2E tests | |
| run: npm run e2e:local | |
| env: | |
| CI: true # enables retries/screenshots | |
| # ---------- REPORT ---------- | |
| - name: 📊 Upload Playwright HTML report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: playwright-report |