@@ -67,24 +67,46 @@ jobs:
6767
6868 - name : Start backend
6969 working-directory : ./confac/backend
70- run : npm start &
70+ run : |
71+ npm start > backend.log 2>&1 &
72+ echo $! > backend.pid
73+ echo "Backend PID: $(cat backend.pid)"
7174 env :
7275 NODE_ENV : test
7376
7477 - name : Start frontend
7578 working-directory : ./confac/frontend
76- run : npm start &
79+ run : |
80+ npm start > frontend.log 2>&1 &
81+ echo $! > frontend.pid
82+ echo "Frontend PID: $(cat frontend.pid)"
7783 env :
7884 CI : true
7985 BROWSER : none
8086
8187 - name : Wait for services
8288 run : |
83- echo "Waiting for backend..."
84- timeout 60 bash -c 'until curl -s http://localhost:9000/health > /dev/null 2>&1 || curl -s http://localhost:9000 > /dev/null 2>&1; do sleep 2; done' || true
85- echo "Waiting for frontend..."
89+ echo "Waiting for backend on port 9000..."
90+ for i in {1..30}; do
91+ if curl -s http://localhost:9000/api/config > /dev/null 2>&1; then
92+ echo "Backend is ready!"
93+ break
94+ fi
95+ echo "Attempt $i: Backend not ready yet..."
96+ sleep 2
97+ done
98+
99+ echo "Checking backend status..."
100+ curl -v http://localhost:9000/api/config 2>&1 || true
101+
102+ echo ""
103+ echo "Backend log (last 50 lines):"
104+ tail -50 ./confac/backend/backend.log || true
105+
106+ echo ""
107+ echo "Waiting for frontend on port 3000..."
86108 timeout 120 bash -c 'until curl -s http://localhost:3000 > /dev/null 2>&1; do sleep 2; done'
87- echo "Services ready!"
109+ echo "Frontend is ready!"
88110
89111 - name : Seed database
90112 run : npm run seed
@@ -110,6 +132,18 @@ jobs:
110132 path : test-results/
111133 retention-days : 30
112134
135+ - name : Show backend logs on failure
136+ if : failure()
137+ run : |
138+ echo "=== Backend Log ==="
139+ cat ./confac/backend/backend.log || echo "No backend log found"
140+
141+ - name : Show frontend logs on failure
142+ if : failure()
143+ run : |
144+ echo "=== Frontend Log ==="
145+ cat ./confac/frontend/frontend.log || echo "No frontend log found"
146+
113147 - name : Show docker logs on failure
114148 if : failure()
115149 run : docker compose -f docker-compose.test.yml logs
0 commit comments