From 6552e6a6618524b028bcff4afa557d4976009a04 Mon Sep 17 00:00:00 2001 From: Ho Ngoc Hai Date: Wed, 8 Apr 2026 23:06:32 +0700 Subject: [PATCH] fix(ci): improve E2E workflow with Prisma generate, browser cache, and trace artifacts - Add missing `pnpm db:generate` step before migrations (Prisma client was not generated) - Add Playwright browser caching to speed up CI runs - Upload trace artifacts on failure for easier debugging - Remove redundant `pnpm build` step (Playwright webServer uses dev commands) Co-Authored-By: Paperclip --- .github/workflows/e2e.yml | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8919e6f..91ffcc6 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -104,25 +104,45 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile + - name: Cache Playwright browsers + id: playwright-cache + uses: actions/cache@v4 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} + - name: Install Playwright browsers + if: steps.playwright-cache.outputs.cache-hit != 'true' run: npx playwright install --with-deps chromium + - name: Install Playwright system deps + if: steps.playwright-cache.outputs.cache-hit == 'true' + run: npx playwright install-deps chromium + + - name: Generate Prisma client + run: pnpm db:generate + - name: Run database migrations run: pnpm db:migrate:deploy - name: Seed database run: pnpm db:seed - - name: Build apps - run: pnpm build - - name: Run E2E tests run: pnpm test:e2e - - name: Upload test report + - name: Upload Playwright report if: ${{ !cancelled() }} uses: actions/upload-artifact@v4 with: name: playwright-report path: playwright-report/ retention-days: 14 + + - name: Upload Playwright traces + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-traces + path: test-results/ + retention-days: 7