|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - staging # géré par deploy-staging.yml qui inclut ces checks |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + - staging |
| 11 | + - dev |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ci-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + # ───────────────────────────────────────────── |
| 19 | + # 1. Lint & Format |
| 20 | + # ───────────────────────────────────────────── |
| 21 | + lint: |
| 22 | + name: Lint & Format |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - uses: actions/setup-node@v4 |
| 29 | + with: |
| 30 | + node-version: 20 |
| 31 | + cache: npm |
| 32 | + cache-dependency-path: lucky7-app/frontend/package-lock.json |
| 33 | + |
| 34 | + - name: Installer les dépendances |
| 35 | + run: npm ci |
| 36 | + working-directory: lucky7-app/frontend |
| 37 | + |
| 38 | + - name: TypeScript — vérification des types |
| 39 | + run: npm run typecheck |
| 40 | + working-directory: lucky7-app/frontend |
| 41 | + |
| 42 | + - name: ESLint |
| 43 | + run: npm run lint |
| 44 | + working-directory: lucky7-app/frontend |
| 45 | + |
| 46 | + - name: Prettier — vérification du format |
| 47 | + run: npm run format:check |
| 48 | + working-directory: lucky7-app/frontend |
| 49 | + |
| 50 | + # ───────────────────────────────────────────── |
| 51 | + # 2. Tests unitaires (Vitest) |
| 52 | + # ───────────────────────────────────────────── |
| 53 | + test-unit: |
| 54 | + name: Tests unitaires |
| 55 | + runs-on: ubuntu-latest |
| 56 | + |
| 57 | + steps: |
| 58 | + - uses: actions/checkout@v4 |
| 59 | + |
| 60 | + - uses: actions/setup-node@v4 |
| 61 | + with: |
| 62 | + node-version: 20 |
| 63 | + cache: npm |
| 64 | + cache-dependency-path: lucky7-app/frontend/package-lock.json |
| 65 | + |
| 66 | + - name: Installer les dépendances |
| 67 | + run: npm ci |
| 68 | + working-directory: lucky7-app/frontend |
| 69 | + |
| 70 | + - name: Vitest |
| 71 | + run: npm run test:coverage |
| 72 | + working-directory: lucky7-app/frontend |
| 73 | + |
| 74 | + - name: Upload coverage |
| 75 | + uses: actions/upload-artifact@v4 |
| 76 | + if: always() |
| 77 | + with: |
| 78 | + name: coverage-report |
| 79 | + path: lucky7-app/frontend/coverage/ |
| 80 | + retention-days: 7 |
| 81 | + |
| 82 | + # ───────────────────────────────────────────── |
| 83 | + # 3. Tests E2E (Playwright) |
| 84 | + # ───────────────────────────────────────────── |
| 85 | + test-e2e: |
| 86 | + name: Tests E2E |
| 87 | + runs-on: ubuntu-latest |
| 88 | + needs: [lint, test-unit] # ne lance l'E2E que si lint + unit passent |
| 89 | + |
| 90 | + steps: |
| 91 | + - uses: actions/checkout@v4 |
| 92 | + |
| 93 | + - uses: actions/setup-node@v4 |
| 94 | + with: |
| 95 | + node-version: 20 |
| 96 | + cache: npm |
| 97 | + cache-dependency-path: lucky7-app/frontend/package-lock.json |
| 98 | + |
| 99 | + - name: Installer les dépendances |
| 100 | + run: npm ci |
| 101 | + working-directory: lucky7-app/frontend |
| 102 | + |
| 103 | + - name: Installer Playwright (Chromium uniquement) |
| 104 | + run: npx playwright install --with-deps chromium |
| 105 | + working-directory: lucky7-app/frontend |
| 106 | + |
| 107 | + - name: Build Next.js (prod) |
| 108 | + run: npm run build |
| 109 | + working-directory: lucky7-app/frontend |
| 110 | + |
| 111 | + - name: Tests Playwright |
| 112 | + run: npm run test:e2e |
| 113 | + working-directory: lucky7-app/frontend |
| 114 | + |
| 115 | + - name: Upload rapport Playwright |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + if: always() |
| 118 | + with: |
| 119 | + name: playwright-report |
| 120 | + path: lucky7-app/frontend/playwright-report/ |
| 121 | + retention-days: 7 |
0 commit comments