-
Notifications
You must be signed in to change notification settings - Fork 4
247 lines (203 loc) · 8.3 KB
/
Copy pathdevelop.yml
File metadata and controls
247 lines (203 loc) · 8.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
name: Develop CI — Node 24
on:
push:
branches:
- develop
pull_request:
branches:
- develop
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# ----------------------------------------------------------------
# Job 1 — Lint (ESLint, non destructif)
# ----------------------------------------------------------------
lint:
name: Lint — Node 24
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Setup Node 24
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Lint check
run: npm run lint:check
# ----------------------------------------------------------------
# Job 2 — TypeScript strict
# ----------------------------------------------------------------
typecheck:
name: TypeScript strict — Node 24
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Setup Node 24
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: TypeScript strict check
run: npx tsc --noEmit
# ----------------------------------------------------------------
# Job 3 — Vite build (production)
# ----------------------------------------------------------------
build-check:
name: Vite build — Node 24
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- name: Setup Node 24
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build (production)
run: npm run build
# ----------------------------------------------------------------
# Job 4 — Coverage (jsdom + browser + merge) : seul job qui lance les
# suites Vitest. Remplace les anciens jobs unit-and-integration et
# web-components pour ne plus exécuter chaque suite 2× par run (étape 16).
# ----------------------------------------------------------------
coverage:
name: Coverage check — Node 24
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- name: Setup Node 24
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('./package-lock.json').packages['node_modules/@playwright/test'].version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
- name: Install Playwright chromium (cold)
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps chromium
- name: Install Playwright OS dependencies (cache hit)
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium
- name: Run coverage (jsdom + browser + merge — thresholds enforced in vitest.config.ts)
run: NODE_ENV=test npm run coverage
# ----------------------------------------------------------------
# Job 5 — Tests E2E Playwright
# ----------------------------------------------------------------
e2e:
name: E2E Playwright — Node 24
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
- name: Setup Node 24
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node -p "require('./package-lock.json').packages['node_modules/@playwright/test'].version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v6
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
- name: Install Playwright chromium (cold)
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install --with-deps chromium
- name: Install Playwright OS dependencies (cache hit)
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: npx playwright install-deps chromium
- name: Run E2E tests
run: npm run test:e2e
# ----------------------------------------------------------------
# Job 6 — Smoke test du serveur Express
# ----------------------------------------------------------------
server-smoke:
name: Server smoke test — Node 24
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v7
- name: Setup Node 24
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Start server in background
run: npm run smoke:server &
- name: Wait for server on port 3001
run: npx wait-on tcp:3001 --timeout 30000
- name: Check server responds (socket.io handshake)
run: |
status=$(curl -s -o /tmp/smoke.out -w '%{http_code}' http://localhost:3001/socket.io/)
echo "HTTP status: $status"
cat /tmp/smoke.out
echo
if [ "$status" != "400" ] || ! grep -q "Transport unknown" /tmp/smoke.out; then
echo "::error::Réponse inattendue de /socket.io/ (status=$status) — le serveur ne répond pas correctement"
exit 1
fi
# ----------------------------------------------------------------
# Job 7 — Déploiement de la documentation VitePress (GitHub Pages)
# Uniquement sur push develop, et seulement si toute la CI est verte.
# ----------------------------------------------------------------
docs-deploy:
name: Deploy docs — GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
needs: [lint, typecheck, build-check, coverage, e2e, server-smoke]
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v7
- name: Setup Node 24
uses: actions/setup-node@v6
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build docs (API reference + VitePress)
run: npm run docs:build
- name: Configure GitHub Pages
uses: actions/configure-pages@v6
- name: Upload docs artifact
uses: actions/upload-pages-artifact@v5
with:
path: docs-dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5