Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 163 additions & 0 deletions .github/workflows/verify-liquibase-backward-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
name: Verify Liquibase Backward Compatibility

on: [pull_request]

permissions:
contents: read

jobs:
liquibase-backward-compatibility-check:
runs-on: ubuntu-24.04
timeout-minutes: 30

services:
postgresql:
image: postgres:17.4
ports:
- 5432:5432
env:
POSTGRES_USER: root
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd="pg_isready -q -d postgres -U root"
--health-interval=5s
--health-timeout=2s
--health-retries=5

env:
DB_USER: root
DB_PASSWORD: postgres
DB_NAME: fineract_default
TZ: Asia/Kolkata

steps:
- name: Checkout the base branch (`develop`)
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems Ok just asking if i run this check in forked branch on push event which develop branch will it checkout? That forks develop eg. forkedRepo/develop or only apache/develop?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it takes the origin which would be "apache", but i can double check.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/Aman-Mittal/fineract/actions/runs/20916627097/job/60091598962?pr=4

Im running this workflow in my forked repo to crosscheck, will confirm you with results. what it is doing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just crosschecked

When we create PR- it checks the forked branch repo, based on to where PR is trying to merge when i raised the pr against my forked develop it checked out to my forked develop branch

https://github.com/Aman-Mittal/fineract/actions/runs/20916627097/job/60091598962?pr=4

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ok to merge. Behaviour is based on where the GA is ran. For anyone who wants to tests this new GA check i think we should add this on md file. where forked develop must be synced with upstream develop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I think it would be safer to use the PR base repo and ref here... let me rework.

with:
repository: ${{ github.event.pull_request.base.repo.full_name }}
ref: ${{ github.event.pull_request.base.ref }}
fetch-depth: 0

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'

- name: Wait for PostgreSQL
run: |
until pg_isready -h localhost -U $DB_USER; do
echo "Waiting for postgres..."
sleep 2
done

- name: Init base schema
run: |
./gradlew --no-daemon createPGDB -PdbName=fineract_tenants
./gradlew --no-daemon createPGDB -PdbName=$DB_NAME

- name: Start backend on base branch
run: |
./gradlew :fineract-provider:devRun --args="\
--spring.datasource.hikari.driverClassName=org.postgresql.Driver \
--spring.datasource.hikari.jdbcUrl=jdbc:postgresql://localhost:5432/fineract_tenants \
--spring.datasource.hikari.username=root \
--spring.datasource.hikari.password=postgres \
--fineract.tenant.host=localhost \
--fineract.tenant.port=5432 \
--fineract.tenant.username=root \
--fineract.tenant.password=postgres" &
BACKEND_PID=$!
echo $BACKEND_PID > backend.pid

# Wait for Actuator to come up (adjust host/port/path if needed)
ACTUATOR_URL="https://localhost:8443/fineract-provider/actuator/health"
TIMEOUT_SECONDS=600
INTERVAL_SECONDS=2

echo "Waiting for backend Actuator: $ACTUATOR_URL (timeout ${TIMEOUT_SECONDS}s)..."

start_ts=$(date +%s)
while true; do
# If the process died, fail fast
if ! kill -0 "$BACKEND_PID" 2>/dev/null; then
echo "Backend process exited before Actuator became available."
exit 1
fi

# Check endpoint
if curl -kfsS "$ACTUATOR_URL" >/dev/null 2>&1; then
echo "Actuator is up."
break
fi

# Timeout
now_ts=$(date +%s)
if [ $((now_ts - start_ts)) -ge "$TIMEOUT_SECONDS" ]; then
echo "Timed out waiting for Actuator."
exit 1
fi

sleep "$INTERVAL_SECONDS"
done

- name: Stop backend
run: |
kill $(cat backend.pid)
sleep 10

- name: Checkout the PR branch
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v5
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Start backend on PR branch
run: |
./gradlew :fineract-provider:devRun --args="\
--spring.datasource.hikari.driverClassName=org.postgresql.Driver \
--spring.datasource.hikari.jdbcUrl=jdbc:postgresql://localhost:5432/fineract_tenants \
--spring.datasource.hikari.username=root \
--spring.datasource.hikari.password=postgres \
--fineract.tenant.host=localhost \
--fineract.tenant.port=5432 \
--fineract.tenant.username=root \
--fineract.tenant.password=postgres" &
BACKEND_PID=$!
echo $BACKEND_PID > backend.pid

# Wait for Actuator to come up (adjust host/port/path if needed)
ACTUATOR_URL="https://localhost:8443/fineract-provider/actuator/health"
TIMEOUT_SECONDS=600
INTERVAL_SECONDS=2

echo "Waiting for backend Actuator: $ACTUATOR_URL (timeout ${TIMEOUT_SECONDS}s)..."

start_ts=$(date +%s)
while true; do
# If the process died, fail fast
if ! kill -0 "$BACKEND_PID" 2>/dev/null; then
echo "Backend process exited before Actuator became available."
exit 1
fi

# Check endpoint
if curl -kfsS "$ACTUATOR_URL" >/dev/null 2>&1; then
echo "Actuator is up."
break
fi

# Timeout
now_ts=$(date +%s)
if [ $((now_ts - start_ts)) -ge "$TIMEOUT_SECONDS" ]; then
echo "Timed out waiting for Actuator."
exit 1
fi

sleep "$INTERVAL_SECONDS"
done
- name: Stop backend
run: |
kill $(cat backend.pid)
sleep 10
Loading