-
Notifications
You must be signed in to change notification settings - Fork 0
307 lines (261 loc) · 8.75 KB
/
Copy pathci.yml
File metadata and controls
307 lines (261 loc) · 8.75 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
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
static:
name: Static Gateway
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
filter: tree:0
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Codegen Check
run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon run root:codegen-check
- name: Format Check (affected)
run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :fmt-check
- name: Typecheck (affected)
run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :typecheck
- name: Lint (affected)
run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :lint
unit-tests:
name: Unit Tests
needs: static
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
filter: tree:0
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Run Unit Tests (affected)
run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :test-unit
pglite-compat:
name: PGlite Compatibility (non-blocking)
needs: static
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
filter: tree:0
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Run PGlite Compatibility Gate
run: pnpm exec tsx scripts/pglite-compat-gate.ts | tee pglite-compat-report.json
- name: Upload PGlite Compatibility Report
uses: actions/upload-artifact@v5
with:
name: pglite-compat-report
path: pglite-compat-report.json
integration-tests:
name: Integration Tests
needs: static
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
filter: tree:0
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Postgres Search Runtime
run: docker build -t cat-postgres-search-runtime apps/postgres-search-runtime
- name: Run Postgres Search Runtime
run: |
docker run -d --name cat-search-runtime \
-e POSTGRES_USER=user \
-e POSTGRES_PASSWORD=pass \
-e POSTGRES_DB=cat \
-p 5432:5432 \
cat-postgres-search-runtime
- name: Wait for Postgres Search Runtime
timeout-minutes: 2
run: |
for _ in $(seq 1 30); do
status="$(docker inspect -f '{{.State.Health.Status}}' cat-search-runtime)"
if [ "$status" = "healthy" ]; then
if python3 -c "import socket; socket.create_connection(('127.0.0.1', 5432), timeout=1).close()" >/dev/null 2>&1; then
exit 0
fi
fi
if [ "$status" = "unhealthy" ]; then
docker logs cat-search-runtime
exit 1
fi
sleep 2
done
docker logs cat-search-runtime
exit 1
- name: Run Integration Tests (affected)
env:
TEST_DATABASE_URL: "postgres://user:pass@localhost:5432/cat"
run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon ci :test-integration
e2e-tests:
name: E2E Tests
needs: static
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
filter: tree:0
- name: Install pnpm
uses: pnpm/action-setup@v5
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build Postgres Search Runtime
run: docker build -t cat-postgres-search-runtime apps/postgres-search-runtime
- name: Run Postgres Search Runtime
run: |
docker run -d --name cat-search-runtime-e2e \
-e POSTGRES_USER=user \
-e POSTGRES_PASSWORD=pass \
-e POSTGRES_DB=cat \
-p 5432:5432 \
cat-postgres-search-runtime
- name: Wait for Postgres Search Runtime
timeout-minutes: 2
run: |
for _ in $(seq 1 30); do
status="$(docker inspect -f '{{.State.Health.Status}}' cat-search-runtime-e2e)"
if [ "$status" = "healthy" ]; then
if python3 -c "import socket; socket.create_connection(('127.0.0.1', 5432), timeout=1).close()" >/dev/null 2>&1; then
exit 0
fi
fi
if [ "$status" = "unhealthy" ]; then
docker logs cat-search-runtime-e2e
exit 1
fi
sleep 2
done
docker logs cat-search-runtime-e2e
exit 1
- name: Push Database Schema
run: |
set +e
pnpm moon run db:push --quiet > /tmp/db-push.log 2>&1
status=$?
cat /tmp/db-push.log
if [ "$status" -ne 0 ]; then
summary="$(tail -n 20 /tmp/db-push.log)"
summary="${summary//'%'/'%25'}"
summary="${summary//$'\n'/'%0A'}"
summary="${summary//$'\r'/'%0D'}"
echo "::error title=Push Database Schema failed::$summary"
fi
exit "$status"
env:
DATABASE_URL: postgresql://user:pass@localhost:5432/cat?schema=public
- name: Install Playwright Browsers
run: |
for attempt in 1 2 3; do
pnpm exec playwright install --with-deps && exit 0
status=$?
if [ "$attempt" -eq 3 ]; then
exit "$status"
fi
echo "Playwright browser install failed on attempt $attempt; refreshing apt lists and retrying."
sudo rm -rf /var/lib/apt/lists/*
done
- name: Build App
run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon run app:build
env:
DATABASE_URL: postgresql://user:pass@localhost:5432/cat?schema=public
CAT_RUNTIME_PROFILE: lite
CAT_SEARCH_REQUIREMENT: full-search-runtime
- name: Run App
working-directory: apps/app
run: |
pnpm exec tsx scripts/copy-drizzle.ts
NODE_ENV=production node dist/server/index.mjs > ../../app.log 2>&1 &
env:
PORT: 3000
DATABASE_URL: postgresql://user:pass@localhost:5432/cat?schema=public
CAT_RUNTIME_PROFILE: lite
CAT_SEARCH_REQUIREMENT: full-search-runtime
- name: Wait for Healthcheck
timeout-minutes: 3
run: |
echo "Waiting for service to be healthy..."
RETRIES=90
until curl --output /dev/null --silent --head --fail http://localhost:3000/_health; do
printf '.'
sleep 2
RETRIES=$((RETRIES-1))
if [ $RETRIES -le 0 ]; then
echo "Timeout waiting for service!"
echo "================ APPLICATION LOGS ================"
cat app.log
echo "=================================================="
exit 1
fi
done
echo "Server is up!"
- name: Run E2E Tests
run: MOON_OUTPUT_STYLE=buffer-only-failure pnpm moon run app-e2e:test-e2e
env:
PORT: 3000
DATABASE_URL: postgresql://user:pass@localhost:5432/cat?schema=public
CAT_RUNTIME_PROFILE: lite
CAT_SEARCH_REQUIREMENT: full-search-runtime
PW_REUSE_EXISTING_SERVER: "true"
E2E_SKIP_DB_CHECK: "true"
- name: Upload Playwright Report
if: failure()
uses: actions/upload-artifact@v5
with:
name: playwright-report
path: apps/app-e2e/playwright-report/
retention-days: 30