File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI
2+ on : [push,pull_request]
3+ jobs :
4+ CI_HEALTH_CHECK :
5+ runs-on : ubuntu-latest
6+ services :
7+ postgres :
8+ image : postgres:15
9+ ports :
10+ - 5432:5432
11+ env :
12+ POSTGRES_USER : postgres
13+ POSTGRES_PASSWORD : postgres
14+ POSTGRES_DB : inquizzitive
15+ options : >-
16+ --health-cmd="pg_isready -U postgres"
17+ --health-interval=10s
18+ --health-timeout=5s
19+ --health-retries=5
20+ env :
21+ DATABASE_URL : " postgresql://postgres:postgres@localhost:5432/inquizzitive"
22+ VITE_SUPABASE_URL : " http://localhost:54321"
23+ VITE_SUPABASE_ANON_KEY : " dummy"
24+ steps :
25+ - name : Checkout
26+ uses : actions/checkout@v4
27+ with :
28+ path : .
29+
30+ - name : Wait for Postgres
31+ run : |
32+ for i in {1..10}; do
33+ if pg_isready -h localhost -U postgres; then
34+ echo "Postgres is ready"
35+ break
36+ fi
37+ echo "Waiting for Postgres..."
38+ sleep 2
39+ done
40+
41+ - name : Setup database schema
42+ run : psql $DATABASE_URL -f database-setup.sql
43+
44+ - name : Setup Node
45+ uses : actions/setup-node@v4
46+ with :
47+ node-version : 22
48+ - name : Install Dependencies
49+ run : npm install
50+ - name : Run Server
51+ run : |
52+ npm run dev > server.log 2>&1 &
53+ server_pid=$!
54+ echo "Server started with PID: $server_pid"
55+
56+ for i in {1..15}; do
57+ if curl -fs http://localhost:5173 > /dev/null; then
58+ echo "Server is up!"
59+ pkill -f "node"
60+ exit 0
61+ fi
62+ echo "Waiting for server... (attempt $i/15)"
63+ sleep 2
64+ done
65+
66+ echo "Server failed to start. Printing logs:"
67+ cat server.log
68+ pkill -f "node"
69+ exit 1
70+
71+
72+
73+
74+
You can’t perform that action at this time.
0 commit comments