fix: cap problem difficulty to 5 in e2e test #216
Workflow file for this run
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: CI & Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| unit-component-tests: | |
| name: Unit & Component Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.3.6" | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build shared package | |
| run: cd packages/shared && bun run build | |
| - name: Run shared package tests | |
| run: cd packages/shared && bun test | |
| - name: Build CLI | |
| run: cd packages/cli && bun run build | |
| - name: Run CLI tests | |
| run: cd packages/cli && bun test | |
| - name: Build MCP | |
| run: cd packages/mcp && bun run build | |
| - name: Run MCP tests | |
| run: cd packages/mcp && bun test | |
| - name: Generate Prisma client | |
| run: cd backend && bun x prisma generate | |
| - name: Type check backend | |
| run: cd backend && bun x tsc -p tsconfig.build.json --noEmit | |
| - name: Type check frontend | |
| run: cd apps/web && bun x tsc --noEmit | |
| - name: Type check site | |
| run: cd apps/site && bun x tsc --noEmit | |
| - name: Run backend tests | |
| run: cd backend && bun run test | |
| - name: Run frontend tests | |
| run: cd apps/web && bun run test | |
| - name: Run site tests | |
| run: cd apps/site && bun run test | |
| - name: Build frontend | |
| run: cd apps/web && bun run build | |
| - name: Build site | |
| run: cd apps/site && bun run build | |
| e2e-tests: | |
| name: E2E Tests | |
| needs: unit-component-tests | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: "1.3.6" | |
| - uses: supabase/setup-cli@v1 | |
| with: | |
| version: latest | |
| - name: Start local Supabase | |
| run: | | |
| # Move RLS migration aside — it references Prisma tables that don't exist yet | |
| mv supabase/migrations/00002_rls_policies.sql /tmp/00002_rls_policies.sql | |
| supabase start | |
| # Will apply RLS after Prisma migrations | |
| - name: Extract Supabase keys | |
| id: supabase | |
| run: | | |
| echo "SUPABASE_URL=$(supabase status --output json | jq -r '.API_URL')" >> "$GITHUB_OUTPUT" | |
| echo "ANON_KEY=$(supabase status --output json | jq -r '.ANON_KEY')" >> "$GITHUB_OUTPUT" | |
| echo "SERVICE_ROLE_KEY=$(supabase status --output json | jq -r '.SERVICE_ROLE_KEY')" >> "$GITHUB_OUTPUT" | |
| echo "DB_URL=$(supabase status --output json | jq -r '.DB_URL')" >> "$GITHUB_OUTPUT" | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Build shared package | |
| run: cd packages/shared && bun run build | |
| - name: Generate Prisma client | |
| run: cd backend && bun x prisma generate | |
| - name: Run Prisma migrations | |
| run: cd backend && bun x prisma migrate deploy | |
| env: | |
| DATABASE_URL: ${{ steps.supabase.outputs.DB_URL }} | |
| DIRECT_URL: ${{ steps.supabase.outputs.DB_URL }} | |
| - name: Apply RLS policies | |
| run: psql "${{ steps.supabase.outputs.DB_URL }}" -f /tmp/00002_rls_policies.sql | |
| - name: Seed database | |
| run: cd backend && bun x prisma db seed | |
| env: | |
| DATABASE_URL: ${{ steps.supabase.outputs.DB_URL }} | |
| DIRECT_URL: ${{ steps.supabase.outputs.DB_URL }} | |
| - name: Seed brands | |
| run: cd backend && bun x ts-node prisma/seeds/brands.ts | |
| env: | |
| DATABASE_URL: ${{ steps.supabase.outputs.DB_URL }} | |
| DIRECT_URL: ${{ steps.supabase.outputs.DB_URL }} | |
| - name: Build backend | |
| run: cd backend && bun run build | |
| - name: Build frontend | |
| run: cd apps/web && bun run build | |
| env: | |
| NEXT_PUBLIC_SUPABASE_URL: ${{ steps.supabase.outputs.SUPABASE_URL }} | |
| NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ steps.supabase.outputs.ANON_KEY }} | |
| NEXT_PUBLIC_BACKEND_URL: http://localhost:3000/api/v1 | |
| - name: Install Playwright browsers | |
| run: cd apps/web && bun x playwright install --with-deps chromium | |
| - name: Start services and run E2E tests | |
| run: | | |
| # Start backend (subshell so cd doesn't affect parent) | |
| (cd backend && bun run start:prod) & | |
| # Start frontend on port 3001 | |
| (cd apps/web && PORT=3001 bun run start) & | |
| # Wait for both | |
| timeout 60 bash -c 'until curl -sf http://localhost:3000/api/v1/health 2>/dev/null; do sleep 2; done' | |
| echo "Backend ready" | |
| timeout 120 bash -c 'until curl -sf http://localhost:3001 2>/dev/null; do sleep 2; done' | |
| echo "Frontend ready" | |
| # Run Playwright | |
| cd apps/web && bun run test:e2e | |
| env: | |
| CI: "true" | |
| DATABASE_URL: ${{ steps.supabase.outputs.DB_URL }} | |
| DIRECT_URL: ${{ steps.supabase.outputs.DB_URL }} | |
| SUPABASE_URL: ${{ steps.supabase.outputs.SUPABASE_URL }} | |
| SUPABASE_SERVICE_ROLE_KEY: ${{ steps.supabase.outputs.SERVICE_ROLE_KEY }} | |
| ALLOWED_ORIGINS: http://localhost:3001 | |
| NEXT_PUBLIC_SUPABASE_URL: ${{ steps.supabase.outputs.SUPABASE_URL }} | |
| NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ steps.supabase.outputs.ANON_KEY }} | |
| NEXT_PUBLIC_BACKEND_URL: http://localhost:3000/api/v1 | |
| - name: Upload Playwright report | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: playwright-report | |
| path: apps/web/playwright-report/ | |
| retention-days: 14 | |
| deploy-backend: | |
| name: Deploy Backend | |
| needs: | |
| - unit-component-tests | |
| - e2e-tests | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install Railway CLI | |
| run: npm install -g @railway/cli | |
| - name: Deploy backend to Railway | |
| run: railway up --service ${{ vars.RAILWAY_SERVICE_NAME }} | |
| env: | |
| RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }} | |
| # Frontend deploys automatically via Vercel git integration |