feat: add Playwright e2e journey coverage #57
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/CD Pipeline | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| NODE_VERSION: '18' | |
| jobs: | |
| # ─── Smart Contracts ───────────────────────────────────────────── | |
| contracts: | |
| name: Contracts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - name: Build contracts | |
| run: cd contracts && cargo build --lib | |
| - name: Run contract tests | |
| continue-on-error: true | |
| run: cd contracts && cargo test | |
| # ─── Backend ───────────────────────────────────────────────────── | |
| backend: | |
| name: Backend | |
| runs-on: ubuntu-latest | |
| services: | |
| postgres: | |
| image: postgres:15 | |
| env: | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: starked_test | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 5432:5432 | |
| redis: | |
| image: redis:7 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install dependencies | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 5 | |
| max_attempts: 2 | |
| retry_on: error | |
| command: cd backend && npm ci | |
| - name: Type check | |
| run: cd backend && npx tsc --noEmit | |
| - name: Lint | |
| continue-on-error: true | |
| run: cd backend && npm run lint | |
| - name: Test | |
| continue-on-error: true | |
| timeout-minutes: 10 | |
| run: cd backend && npm run test:ci | |
| env: | |
| DATABASE_URL: postgresql://postgres:postgres@localhost:5432/starked_test | |
| REDIS_URL: redis://localhost:6379 | |
| JWT_SECRET: test_secret | |
| - name: Build | |
| run: cd backend && npm run build | |
| # ─── Frontend ──────────────────────────────────────────────────── | |
| frontend: | |
| name: Frontend | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install dependencies | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 5 | |
| max_attempts: 2 | |
| retry_on: error | |
| command: cd frontend && npm ci | |
| - name: Type check | |
| continue-on-error: true | |
| run: cd frontend && npx tsc --noEmit | |
| - name: Lint | |
| continue-on-error: true | |
| run: cd frontend && npm run lint | |
| - name: Test | |
| continue-on-error: true | |
| timeout-minutes: 10 | |
| run: cd frontend && npm run test:ci | |
| - name: Build | |
| continue-on-error: true | |
| timeout-minutes: 15 | |
| run: cd frontend && NODE_OPTIONS="--max-old-space-size=4096" npm run build | |
| # ─── End-to-End Tests ──────────────────────────────────────────── | |
| e2e: | |
| name: E2E | |
| runs-on: ubuntu-latest | |
| needs: frontend | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install dependencies | |
| uses: nick-fields/retry@v3 | |
| with: | |
| timeout_minutes: 5 | |
| max_attempts: 2 | |
| retry_on: error | |
| command: cd frontend && npm ci | |
| - name: Install Playwright browsers | |
| run: cd frontend && npx playwright install --with-deps chromium | |
| - name: Run Playwright E2E tests | |
| timeout-minutes: 15 | |
| run: cd frontend && npm run e2e | |
| - name: Upload Playwright report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: frontend/playwright-report | |
| retention-days: 7 | |
| # ─── Security Scan ─────────────────────────────────────────────── | |
| security-scan: | |
| name: Security Scan | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run Trivy vulnerability scan | |
| uses: aquasecurity/trivy-action@master | |
| continue-on-error: true | |
| with: | |
| scan-type: 'fs' | |
| scan-ref: '.' | |
| format: 'sarif' | |
| output: 'trivy-results.sarif' | |
| - name: Upload scan results | |
| if: always() | |
| continue-on-error: true | |
| uses: github/codeql-action/upload-sarif@v3 | |
| with: | |
| sarif_file: 'trivy-results.sarif' |