-
Notifications
You must be signed in to change notification settings - Fork 21
208 lines (172 loc) · 5.28 KB
/
Copy pathci.yml
File metadata and controls
208 lines (172 loc) · 5.28 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
lint-and-typecheck:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm -r --filter @telivityhaip/shared --filter @telivityhaip/database --filter @telivityhaip/booking-requests run build
- name: Lint
run: pnpm lint
- name: Type Check
run: pnpm typecheck
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: haip
POSTGRES_PASSWORD: haip
POSTGRES_DB: haip_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build
- name: Migrate test database
run: pnpm db:migrate
env:
DATABASE_URL: postgresql://haip:haip@localhost:5432/haip_test
- name: Run tests and verify README test counts
run: node scripts/sync-test-count.mjs --check
env:
DATABASE_URL: postgresql://haip:haip@localhost:5432/haip_test
REDIS_URL: redis://localhost:6379
FORCE_COLOR: '0'
CI: 'true'
release-smoke:
name: Release smoke (PMS contract)
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: haip
POSTGRES_PASSWORD: haip
POSTGRES_DB: haip_smoke
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build
- name: Run release smoke test
run: pnpm --filter @telivityhaip/api run test:release-smoke
env:
DATABASE_URL: postgresql://haip:haip@localhost:5432/haip_smoke
REDIS_URL: redis://localhost:6379
RELEASE_SMOKE: '1'
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- name: Build all packages
run: pnpm build
demo-smoke:
name: One-command demo smoke test
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
# Exercises the exact path a newcomer follows: `docker compose up`.
# Builds the image, runs the one-shot init (migrate + seed), then the API.
# `up -d` blocks on init's service_completed_successfully, so a failed
# migrate/seed (e.g. schema drift) fails this step immediately.
- name: Build & start the demo (docker compose up)
run: docker compose up -d --build
- name: Wait for the API to become healthy
run: |
for i in $(seq 1 60); do
if curl -fsS http://localhost:3000/api/v1/health | grep -q '"status":"ok"'; then
echo "API healthy after ~$((i * 5))s"
exit 0
fi
sleep 5
done
echo "::error::API did not become healthy within 5 minutes"
exit 1
- name: Verify the dashboard UI is served at the same origin
run: |
body=$(curl -fsS http://localhost:3000/)
if echo "$body" | grep -qi 'id="root"'; then
echo "Dashboard served at / ✓"
else
echo "::error::Dashboard HTML not served at http://localhost:3000/"
echo "$body" | head -20
exit 1
fi
- name: Verify Swagger docs are served (informational)
run: |
curl -fsS http://localhost:3000/docs >/dev/null \
&& echo "Swagger served at /docs ✓" \
|| echo "::warning::/docs was not reachable"
- name: Dump compose logs on failure
if: failure()
run: docker compose logs --no-color
- name: Tear down
if: always()
run: docker compose down -v