Repository navigation
274 lines (229 loc) · 9.09 KB
/
Copy pathci.yml
File metadata and controls
274 lines (229 loc) · 9.09 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
# Frontend CI Pipeline - hotfix
# Validates build, runs lint/typecheck/tests for root app + all workspace packages.
name: Frontend CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
workflow_dispatch:
jobs:
lint:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Lint (root app + packages)
run: npm run lint
- name: Typecheck (root app + packages)
run: npm run typecheck
build-web:
name: Build Check (shell app)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Build shell app
run: npm run build -w @velobits/shell
env:
VITE_API_URL: http://localhost:8000
# Federation remote entry points - Vite bakes these into the host bundle at
# build time. Use repo vars for the real deployment URLs; fall back to the
# local router path so the build check still exercises a prefixed (non-localhost)
# remoteEntry URL rather than the vite.config localhost:3101/3102 defaults.
VITE_EDITOR_REMOTE_ENTRY: ${{ vars.VITE_EDITOR_REMOTE_ENTRY || 'http://localhost:3100/remotes/editor/remoteEntry.js' }}
VITE_ANALYTICS_REMOTE_ENTRY: ${{ vars.VITE_ANALYTICS_REMOTE_ENTRY || 'http://localhost:3100/remotes/analytics/remoteEntry.js' }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN_FRONTEND }}
VITE_SENTRY_ENVIRONMENT: production
VITE_SENTRY_RELEASE: ${{ github.sha }}
build-remotes:
name: Build Check (${{ matrix.remote }})
runs-on: ubuntu-latest
strategy:
matrix:
remote:
- editor-remote
- analytics-remote
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
# The remotes are independently-deployed Module Federation bundles.
# Building them in CI ensures a shell change can't silently break a remote
# (their source is no longer a hollow re-export of shell/src).
- name: Build ${{ matrix.remote }}
run: npm run build -w @velobits/${{ matrix.remote }}
env:
VITE_API_URL: http://localhost:8000
test-web:
name: Tests & Coverage (shell app)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Run tests with coverage
run: npm run test:coverage -w @velobits/shell
test-remotes:
name: Tests & Coverage (${{ matrix.remote }})
runs-on: ubuntu-latest
strategy:
matrix:
remote:
- editor-remote
- analytics-remote
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Run tests with coverage
run: npm run test:coverage -w @velobits/${{ matrix.remote }}
federation-smoke:
name: Federation Smoke (host↔remote contract)
runs-on: ubuntu-latest
# Heavy E2E gate - runs only for `main` (pushes to main + PRs targeting main).
# Skipped on `develop`: push to develop has github.ref refs/heads/develop;
# a PR into develop has github.base_ref == 'develop'. Both are excluded here.
if: github.ref != 'refs/heads/develop' && github.base_ref != 'develop'
# Fail fast if a step hangs (e.g. a stalled Playwright CDN download) instead of
# sitting until GitHub's 6-hour default - which makes the run look permanently stuck.
timeout-minutes: 25
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
# Cache the downloaded browser binaries (~270 MB) keyed on the resolved
# Playwright version. On a cache hit we skip the slow CDN download entirely
# and only run install-deps (apt) below.
- name: Resolve Playwright version
id: pw
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
id: pw-cache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.pw.outputs.version }}
# Cache hit: browsers already present, only install the OS deps (fast).
# Cache miss: download chromium + headless shell + ffmpeg, then deps.
- name: Install Playwright browser (on cache miss)
if: steps.pw-cache.outputs.cache-hit != 'true'
run: npx playwright install chromium
- name: Install Playwright OS dependencies
run: npx playwright install-deps chromium
# Bring up the production simulation: built shell + remotes behind the nginx
# router on :3100 - the topology that actually exercises the remote `base` paths
# and the shell's baked VITE_*_REMOTE_ENTRY URLs (Phase 6.1/6.2). The backend +
# Keycloak are mocked inside the smoke spec, so no real services are needed.
- name: Start prod compose stack
run: |
cp .env.docker.prod.example .env.docker.prod
docker compose --profile prod up --build -d
- name: Wait for router (shell at /)
run: |
for i in $(seq 1 60); do
if curl -sf -o /dev/null http://localhost:3100/; then
echo "router up"; exit 0
fi
sleep 5
done
echo "router did not become ready" >&2
docker compose --profile prod logs --no-color | tail -100 >&2
exit 1
- name: Run federation smoke
run: npm run test:smoke -w @velobits/shell
- name: Tear down
if: always()
run: docker compose --profile prod down -v
build-content:
name: Build Check (content app)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Build content app
run: npm run build -w @velobits/content-app
env:
CONTENT_API_URL: http://localhost:8000
NEXT_PUBLIC_API_URL: http://localhost:8000
NEXT_PUBLIC_SITE_URL: https://fixmytext.velobits.dev
AUTH_SECRET: ci-placeholder-not-real
test-packages:
name: Tests (workspace packages)
runs-on: ubuntu-latest
strategy:
matrix:
package:
- app-core
- design-system
- api-client
- auth-shared
- tools-registry
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Test ${{ matrix.package }}
run: npm run test -w @velobits/${{ matrix.package }}
security:
name: Dependency Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
- name: Set up Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
# Gates on high/critical advisories, minus the reviewed, dated exceptions in
# scripts/audit-allowlist.json. See that file for why each one is accepted.
- name: Audit for vulnerabilities
run: node scripts/audit-allowlist.mjs