@@ -57,10 +57,48 @@ jobs:
5757
5858 - name : Start backend on base branch
5959 run : |
60- ./gradlew devRun --args='--spring.profiles.active=test' &
60+ ./gradlew :fineract-provider:devRun --args="\
61+ --spring.datasource.hikari.driverClassName=org.postgresql.Driver \
62+ --spring.datasource.hikari.jdbcUrl=jdbc:postgresql://localhost:5432/fineract_tenants \
63+ --spring.datasource.hikari.username=root \
64+ --spring.datasource.hikari.password=postgres \
65+ --fineract.tenant.host=localhost \
66+ --fineract.tenant.port=5432 \
67+ --fineract.tenant.username=root \
68+ --fineract.tenant.password=postgres" &
6169 BACKEND_PID=$!
6270 echo $BACKEND_PID > backend.pid
63- sleep 30 # wait for backend to be up
71+
72+ # Wait for Actuator to come up (adjust host/port/path if needed)
73+ ACTUATOR_URL="https://localhost:8443/actuator/health"
74+ TIMEOUT_SECONDS=300
75+ INTERVAL_SECONDS=2
76+
77+ echo "Waiting for backend Actuator: $ACTUATOR_URL (timeout ${TIMEOUT_SECONDS}s)..."
78+
79+ start_ts=$(date +%s)
80+ while true; do
81+ # If the process died, fail fast
82+ if ! kill -0 "$BACKEND_PID" 2>/dev/null; then
83+ echo "Backend process exited before Actuator became available."
84+ exit 1
85+ fi
86+
87+ # Check endpoint
88+ if curl -fsS "$ACTUATOR_URL" >/dev/null 2>&1; then
89+ echo "Actuator is up."
90+ break
91+ fi
92+
93+ # Timeout
94+ now_ts=$(date +%s)
95+ if [ $((now_ts - start_ts)) -ge "$TIMEOUT_SECONDS" ]; then
96+ echo "Timed out waiting for Actuator."
97+ exit 1
98+ fi
99+
100+ sleep "$INTERVAL_SECONDS"
101+ done
64102
65103 - name : Stop backend
66104 run : |
@@ -75,5 +113,43 @@ jobs:
75113
76114 - name : Start backend on PR branch
77115 run : |
78- ./gradlew devRun --args='--spring.profiles.active=test' &
79- sleep 30 # wait for backend to be up again
116+ ./gradlew :fineract-provider:devRun --args="\
117+ --spring.datasource.hikari.driverClassName=org.postgresql.Driver \
118+ --spring.datasource.hikari.jdbcUrl=jdbc:postgresql://localhost:5432/fineract_tenants \
119+ --spring.datasource.hikari.username=root \
120+ --spring.datasource.hikari.password=postgres \
121+ --fineract.tenant.host=localhost \
122+ --fineract.tenant.port=5432 \
123+ --fineract.tenant.username=root \
124+ --fineract.tenant.password=postgres" &
125+
126+ # Wait for Actuator to come up (adjust host/port/path if needed)
127+ ACTUATOR_URL="https://localhost:8443/actuator/health"
128+ TIMEOUT_SECONDS=300
129+ INTERVAL_SECONDS=2
130+
131+ echo "Waiting for backend Actuator: $ACTUATOR_URL (timeout ${TIMEOUT_SECONDS}s)..."
132+
133+ start_ts=$(date +%s)
134+ while true; do
135+ # If the process died, fail fast
136+ if ! kill -0 "$BACKEND_PID" 2>/dev/null; then
137+ echo "Backend process exited before Actuator became available."
138+ exit 1
139+ fi
140+
141+ # Check endpoint
142+ if curl -fsS "$ACTUATOR_URL" >/dev/null 2>&1; then
143+ echo "Actuator is up."
144+ break
145+ fi
146+
147+ # Timeout
148+ now_ts=$(date +%s)
149+ if [ $((now_ts - start_ts)) -ge "$TIMEOUT_SECONDS" ]; then
150+ echo "Timed out waiting for Actuator."
151+ exit 1
152+ fi
153+
154+ sleep "$INTERVAL_SECONDS"
155+ done
0 commit comments