@@ -31,12 +31,20 @@ jobs:
3131 TZ : Asia/Kolkata
3232
3333 steps :
34- - name : Checkout the base branch (`develop`)
34+ - name : Checkout base commit
3535 uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3636 with :
3737 repository : ${{ github.event.pull_request.base.repo.full_name }}
38- ref : ${{ github.event.pull_request.base.ref }}
38+ ref : ${{ github.event.pull_request.base.sha }}
3939 fetch-depth : 0
40+ path : baseline
41+
42+ - name : Checkout PR merge commit
43+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44+ with :
45+ ref : ${{ github.sha }}
46+ fetch-depth : 0
47+ path : current
4048
4149 - name : Set up JDK 21
4250 uses : actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
@@ -52,11 +60,29 @@ jobs:
5260 done
5361
5462 - name : Init base schema
63+ working-directory : baseline
5564 run : |
5665 ./gradlew --no-daemon createPGDB -PdbName=fineract_tenants
5766 ./gradlew --no-daemon createPGDB -PdbName=$DB_NAME
5867
59- - name : Start backend on base branch
68+ - name : Print checked out revisions
69+ run : |
70+ echo "Base branch ref: ${{ github.event.pull_request.base.ref }}"
71+ echo "Base branch event SHA:"
72+ echo "${{ github.event.pull_request.base.sha }}"
73+ echo "PR head SHA:"
74+ echo "${{ github.event.pull_request.head.sha }}"
75+ echo "GitHub merge SHA:"
76+ echo "${{ github.sha }}"
77+ echo "Baseline revision:"
78+ git -C baseline rev-parse HEAD
79+ git -C baseline log -1 --oneline
80+ echo "Merged PR revision:"
81+ git -C current rev-parse HEAD
82+ git -C current log -1 --oneline
83+
84+ - name : Start backend on base commit
85+ working-directory : baseline
6086 run : |
6187 ./gradlew :fineract-provider:devRun --args="\
6288 --spring.datasource.hikari.driverClassName=org.postgresql.Driver \
@@ -79,19 +105,16 @@ jobs:
79105
80106 start_ts=$(date +%s)
81107 while true; do
82- # If the process died, fail fast
83108 if ! kill -0 "$BACKEND_PID" 2>/dev/null; then
84109 echo "Backend process exited before Actuator became available."
85110 exit 1
86111 fi
87112
88- # Check endpoint
89113 if curl -kfsS "$ACTUATOR_URL" >/dev/null 2>&1; then
90114 echo "Actuator is up."
91115 break
92116 fi
93117
94- # Timeout
95118 now_ts=$(date +%s)
96119 if [ $((now_ts - start_ts)) -ge "$TIMEOUT_SECONDS" ]; then
97120 echo "Timed out waiting for Actuator."
@@ -101,19 +124,15 @@ jobs:
101124 sleep "$INTERVAL_SECONDS"
102125 done
103126
104- - name : Stop backend
127+ - name : Stop baseline backend
128+ if : always()
129+ working-directory : baseline
105130 run : |
106131 kill $(cat backend.pid)
107132 sleep 10
108133
109- - name : Checkout the PR branch
110- uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
111- with :
112- repository : ${{ github.event.pull_request.head.repo.full_name }}
113- ref : ${{ github.event.pull_request.head.sha }}
114- fetch-depth : 0
115-
116- - name : Start backend on PR branch
134+ - name : Start backend on merged PR commit
135+ working-directory : current
117136 run : |
118137 ./gradlew :fineract-provider:devRun --args="\
119138 --spring.datasource.hikari.driverClassName=org.postgresql.Driver \
@@ -136,19 +155,16 @@ jobs:
136155
137156 start_ts=$(date +%s)
138157 while true; do
139- # If the process died, fail fast
140158 if ! kill -0 "$BACKEND_PID" 2>/dev/null; then
141159 echo "Backend process exited before Actuator became available."
142160 exit 1
143161 fi
144162
145- # Check endpoint
146163 if curl -kfsS "$ACTUATOR_URL" >/dev/null 2>&1; then
147164 echo "Actuator is up."
148165 break
149166 fi
150167
151- # Timeout
152168 now_ts=$(date +%s)
153169 if [ $((now_ts - start_ts)) -ge "$TIMEOUT_SECONDS" ]; then
154170 echo "Timed out waiting for Actuator."
@@ -157,7 +173,10 @@ jobs:
157173
158174 sleep "$INTERVAL_SECONDS"
159175 done
160- - name : Stop backend
176+
177+ - name : Stop PR backend
178+ if : always()
179+ working-directory : current
161180 run : |
162181 kill $(cat backend.pid)
163182 sleep 10
0 commit comments