|
| 1 | +name: Pull Request |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: |
| 6 | + - opened |
| 7 | + - reopened |
| 8 | + - synchronize |
| 9 | + - ready_for_review |
| 10 | + |
| 11 | +env: |
| 12 | + CI: "true" |
| 13 | + |
| 14 | +jobs: |
| 15 | + lint: |
| 16 | + name: Lintowanie |
| 17 | + runs-on: ubuntu-latest |
| 18 | + environment: Integration |
| 19 | + env: |
| 20 | + NODE_ENV: development |
| 21 | + NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} |
| 22 | + NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} |
| 23 | + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} |
| 24 | + steps: |
| 25 | + - name: Checkout repo |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Setup Node.js |
| 29 | + uses: actions/setup-node@v5 |
| 30 | + with: |
| 31 | + node-version-file: .nvmrc |
| 32 | + |
| 33 | + - name: Install dependencies |
| 34 | + run: npm ci |
| 35 | + |
| 36 | + - name: Run lint |
| 37 | + run: npm run lint |
| 38 | + |
| 39 | + unit-test: |
| 40 | + name: Unit tests (coverage) |
| 41 | + runs-on: ubuntu-latest |
| 42 | + needs: lint |
| 43 | + environment: Integration |
| 44 | + env: |
| 45 | + NODE_ENV: development |
| 46 | + NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} |
| 47 | + NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} |
| 48 | + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} |
| 49 | + steps: |
| 50 | + - name: Checkout repo |
| 51 | + uses: actions/checkout@v4 |
| 52 | + |
| 53 | + - name: Setup Node.js |
| 54 | + uses: actions/setup-node@v5 |
| 55 | + with: |
| 56 | + node-version-file: .nvmrc |
| 57 | + |
| 58 | + - name: Install dependencies |
| 59 | + run: npm ci |
| 60 | + |
| 61 | + - name: Run unit tests with coverage |
| 62 | + run: npm run test:coverage |
| 63 | + |
| 64 | + - name: Upload unit test coverage |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: vitest-coverage |
| 68 | + path: coverage |
| 69 | + |
| 70 | + e2e-test: |
| 71 | + name: Playwright E2E tests |
| 72 | + runs-on: ubuntu-latest |
| 73 | + needs: lint |
| 74 | + environment: Tests |
| 75 | + env: |
| 76 | + NODE_ENV: development |
| 77 | + NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} |
| 78 | + NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} |
| 79 | + SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }} |
| 80 | + E2E_USERNAME_ID: ${{ secrets.E2E_USERNAME_ID }} |
| 81 | + E2E_USERNAME: ${{ secrets.E2E_USERNAME }} |
| 82 | + E2E_PASSWORD: ${{ secrets.E2E_PASSWORD }} |
| 83 | + steps: |
| 84 | + - name: Checkout repo |
| 85 | + uses: actions/checkout@v4 |
| 86 | + |
| 87 | + - name: Setup Node.js |
| 88 | + uses: actions/setup-node@v5 |
| 89 | + with: |
| 90 | + node-version-file: .nvmrc |
| 91 | + |
| 92 | + - name: Install dependencies |
| 93 | + run: npm ci |
| 94 | + |
| 95 | + - name: Install Playwright browsers |
| 96 | + run: npx playwright install chromium |
| 97 | + |
| 98 | + - name: Run Playwright tests |
| 99 | + run: npm run test:e2e |
| 100 | + |
| 101 | + - name: Upload Playwright report |
| 102 | + uses: actions/upload-artifact@v4 |
| 103 | + with: |
| 104 | + name: playwright-report |
| 105 | + path: playwright-report |
| 106 | + |
| 107 | + status-comment: |
| 108 | + name: Status PR |
| 109 | + runs-on: ubuntu-latest |
| 110 | + needs: |
| 111 | + - lint |
| 112 | + - unit-test |
| 113 | + - e2e-test |
| 114 | + permissions: |
| 115 | + contents: write |
| 116 | + pull-requests: write |
| 117 | + steps: |
| 118 | + - name: Comment PR status |
| 119 | + uses: peter-evans/create-or-update-comment@v5 |
| 120 | + with: |
| 121 | + issue-number: ${{ github.event.pull_request.number }} |
| 122 | + body: | |
| 123 | + ✅ Wszystkie kontrole zakończone pomyślnie. |
| 124 | + - Lintowanie: ✅ |
| 125 | + - Testy jednostkowe (z coverage): ✅ |
| 126 | + - Testy end-to-end: ✅ |
0 commit comments