forked from Steel-tech/SteelCFO
-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (83 loc) · 2.56 KB
/
Copy pathci.yml
File metadata and controls
99 lines (83 loc) · 2.56 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
name: CI
on:
push:
pull_request:
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Generate Prisma client
run: npx prisma generate
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
- name: Test
run: npm test
- name: Build
run: npm run build
env:
# Build-time placeholders; pages are force-dynamic so no DB is hit
DATABASE_URL: postgresql://ci:ci@localhost:5432/ci
NEXTAUTH_SECRET: ci-build-secret
NEXTAUTH_URL: http://localhost:3000
smoke:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: steelcfo
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 5s
--health-timeout 5s
--health-retries 10
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/steelcfo
NEXTAUTH_SECRET: ci-smoke-secret
NEXTAUTH_URL: http://localhost:3000
DEMO_MODE: "true"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Generate Prisma client
run: npx prisma generate
- name: Push schema and seed
run: npx prisma db push && npm run db:seed
- name: Build
run: npm run build
- name: Smoke test all routes
run: |
npm run start -- -p 3000 &
for i in $(seq 1 30); do
curl -sf http://localhost:3000/api/health > /dev/null && break
sleep 1
done
fail=0
for path in /api/health / /dashboard /dashboard/jobs /dashboard/cash \
/dashboard/receivables /dashboard/payables /dashboard/risk \
/dashboard/reports /dashboard/chat /login; do
code=$(curl -s -o /dev/null -w "%{http_code}" -L "http://localhost:3000$path")
echo "$code $path"
[ "$code" = "200" ] || fail=1
done
# Rendered pages must not contain NaN/Infinity artifacts
curl -s http://localhost:3000/dashboard | grep -qE "NaN|Infinity" && fail=1
exit $fail