-
Notifications
You must be signed in to change notification settings - Fork 0
359 lines (311 loc) · 14.3 KB
/
Copy pathci.yml
File metadata and controls
359 lines (311 loc) · 14.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
name: CI
on:
push:
branches: [main, develop]
pull_request:
# Do not restrict by base branch: stacked PR layers target the preceding
# feature branch rather than main/develop.
merge_group:
branches: [main]
concurrency:
group: ci-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name != 'merge_group' }}
permissions:
contents: read
jobs:
# ═══════════════════════════════════════════════════════════════
# Change Detection — decides which expensive jobs to run
# ═══════════════════════════════════════════════════════════════
changes:
name: Detect Changes
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
backend: ${{ steps.filter.outputs.backend }}
frontend: ${{ steps.filter.outputs.frontend }}
ci: ${{ steps.filter.outputs.ci }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
backend:
- 'server/smp/**'
- 'shared/**'
- 'server/smp/build.gradle.kts'
frontend:
- 'apps/web/marketing/**'
- 'apps/web/app/**'
- 'apps/web/admin/**'
- 'pnpm-lock.yaml'
ci:
- '.github/workflows/**'
- '.github/actions/**'
- 'justfile'
- 'package.json'
- 'pnpm-workspace.yaml'
- 'pnpm-lock.yaml'
- 'settings.gradle.kts'
- 'build.gradle.kts'
# ═══════════════════════════════════════════════════════════════
# Always-on jobs — fast, run on every push
# ═══════════════════════════════════════════════════════════════
# ──────────────────────────────────────────────────────────────
# 1. Lint — Biome (marketing/app) + Detekt (backend)
# ──────────────────────────────────────────────────────────────
lint:
name: 🧹 Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-frontend
- uses: ./.github/actions/setup-backend
- name: Biome lint (marketing + app + admin)
shell: bash
run: |
cd apps/web/marketing && pnpm lint
cd ../app && pnpm lint
cd ../admin && pnpm lint
- name: Spotless check (backend)
shell: bash
run: ./gradlew spotlessCheck --no-daemon
- name: Detekt (backend)
shell: bash
run: ./gradlew :server:smp:detekt --no-daemon
# ──────────────────────────────────────────────────────────────
# 2. Frontend unit tests (marketing + app)
# ──────────────────────────────────────────────────────────────
frontend-unit:
name: 🧪 Frontend Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-frontend
- name: Run marketing unit tests + coverage
shell: bash
run: cd apps/web/marketing && pnpm test:coverage
- name: Run web/app unit tests + coverage
shell: bash
run: cd apps/web/app && pnpm test:coverage
- name: Run web/admin unit tests
shell: bash
run: cd apps/web/admin && pnpm test:run
# ──────────────────────────────────────────────────────────────
# 3. Production builds and frontend type checks
# ──────────────────────────────────────────────────────────────
build:
name: 🔨 Production Builds
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-frontend
- uses: ./.github/actions/setup-backend
- name: Build marketing site
shell: bash
run: pnpm --filter marketing build
- name: Type-check and build dashboard
shell: bash
run: pnpm --filter app build
- name: Type-check and build admin
shell: bash
run: pnpm --filter @profiletailors/admin build
- name: Build backend artifact
shell: bash
run: ./gradlew :server:smp:bootJar --no-daemon
# ──────────────────────────────────────────────────────────────
# 4. Backend unit tests (Kotlin — no Postgres)
# ──────────────────────────────────────────────────────────────
backend-unit:
name: 🧪 Backend Unit Tests
runs-on: ubuntu-latest
env:
SMP_DB_TEST_PASSWORD: ${{ secrets.SMP_POSTGRES_PASSWORD }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-backend
- name: Run unit tests (exclude BDD suites)
shell: bash
run: ./gradlew :server:smp:test -x :server:smp:bddFastTest -x :server:smp:bddPostgresTest --no-daemon
# ═══════════════════════════════════════════════════════════════
# Conditional jobs — only run when relevant paths change
# ═══════════════════════════════════════════════════════════════
# ──────────────────────────────────────────────────────────────
# 5. Backend BDD fast suite
# ──────────────────────────────────────────────────────────────
backend-bdd:
name: 🔨 Backend BDD
needs: changes
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
actions: write
env:
SMP_DB_TEST_PASSWORD: ${{ secrets.SMP_POSTGRES_PASSWORD }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-backend
- name: Run BDD fast suite (with verbose output)
id: bdd-test
continue-on-error: true
shell: bash
run: ./gradlew :server:smp:bddFastTest --no-daemon --info --stacktrace -x :shared:common:test -x :shared:spring-boot-common:test
- name: Upload BDD test report
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: bdd-test-report
path: server/smp/build/reports/tests/bddFastTest/
- name: Check BDD test result
if: steps.bdd-test.outcome == 'failure'
run: exit 1
# ──────────────────────────────────────────────────────────────
# 5a. Backend Postgres integration suite
# ──────────────────────────────────────────────────────────────
backend-postgres:
name: 🐘 Backend Postgres
needs: changes
if: needs.changes.outputs.backend == 'true'
runs-on: ubuntu-latest
env:
SMP_DB_TEST_PASSWORD: ${{ secrets.SMP_POSTGRES_PASSWORD }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-backend
- name: Run Postgres integration tests
shell: bash
run: ./gradlew :server:smp:postgresIntegrationTest --no-daemon -x :shared:common:test -x :shared:spring-boot-common:test
- name: Run Postgres BDD suite
shell: bash
run: ./gradlew :server:smp:bddPostgresTest --no-daemon -x :shared:common:test -x :shared:spring-boot-common:test
# ──────────────────────────────────────────────────────────────
# 6. Marketing E2E (Playwright — all browsers)
# ──────────────────────────────────────────────────────────────
marketing-e2e:
name: 🌐 Marketing E2E
needs: changes
if: needs.changes.outputs.frontend == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-frontend
with:
install-playwright: 'true'
playwright-browsers: 'chromium firefox webkit'
- name: Run Marketing E2E
shell: bash
run: cd apps/web/marketing && pnpm test:e2e
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: marketing-e2e-report
path: apps/web/marketing/playwright-report/
retention-days: 7
# ──────────────────────────────────────────────────────────────
# 7. Dashboard E2E (Playwright — isolated browser/API mocks)
#
# Each test owns its browser context and resets the route-backed mock state.
# Shards run independently and require no backend services or secrets.
# ──────────────────────────────────────────────────────────────
dashboard-e2e-mocked:
name: 🎭 Dashboard E2E Mocked (${{ matrix.shard }}/4)
needs: changes
if: needs.changes.outputs.frontend == 'true' || needs.changes.outputs.backend == 'true' || needs.changes.outputs.ci == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-frontend
with:
install-playwright: 'true'
playwright-browsers: 'chromium'
- name: Run scheduler E2E shard
shell: bash
run: |
pnpm --filter app exec playwright test \
-c e2e/playwright.scheduler.config.ts \
--shard=${{ matrix.shard }}/4
- name: Upload Scheduler E2E report
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: scheduler-e2e-report-${{ matrix.shard }}
path: apps/web/app/e2e/playwright-scheduler-report/
retention-days: 7
media-e2e-mocked:
name: 🖼️ Media E2E Mocked
needs: changes
if: needs.changes.outputs.frontend == 'true' || needs.changes.outputs.ci == 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: ./.github/actions/setup-frontend
with:
install-playwright: 'true'
playwright-browsers: chromium
- name: Run mocked media E2E
run: pnpm --filter app test:e2e:media:mocked
- name: Upload Playwright report
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: media-e2e-mocked-report
path: apps/web/app/e2e/playwright-media-mocked-report/
retention-days: 7
ci-gate:
name: ✅ CI Gate
if: always()
needs:
- changes
- lint
- frontend-unit
- build
- backend-unit
- backend-bdd
- backend-postgres
- marketing-e2e
- dashboard-e2e-mocked
- media-e2e-mocked
runs-on: ubuntu-latest
steps:
- name: Require every applicable check to pass
env:
RESULTS: >-
${{ join(needs.*.result, ' ') }}
run: |
for result in $RESULTS; do
if [[ "$result" != 'success' && "$result" != 'skipped' ]]; then
echo "::error::At least one applicable CI check did not pass: $RESULTS"
exit 1
fi
done
echo "All applicable CI checks passed: $RESULTS"