blob: e9d9a9bd5dd2cafaf94c3f01baa18db9f1bb3fdc [file]
name: Fineract Cargo & Unit- & Integration tests - Sequential Execution - PostgreSQL
on:
workflow_dispatch:
workflow_call:
secrets:
DEVELOCITY_ACCESS_KEY:
required: false
permissions:
contents: read
jobs:
build:
if: >-
${{
github.event_name == 'push' &&
(
github.ref_name == 'develop' ||
startsWith(github.ref_name, 'release/') ||
startsWith(github.ref_name, '1.')
)
}}
runs-on: ubuntu-24.04
timeout-minutes: 180
services:
postgresql:
image: postgres:18.3
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=12
mock-oauth2-server:
image: ghcr.io/navikt/mock-oauth2-server:3.0.3
ports:
- 9000:9000
env:
SERVER_PORT: 9000
JSON_CONFIG: '{ "interactiveLogin": true, "httpServer": "NettyWrapper", "tokenCallbacks": [ { "issuerId": "auth/realms/fineract", "tokenExpiry": 120, "requestMappings": [{ "requestParam": "scope", "match": "fineract", "claims": { "sub": "mifos", "scope": [ "test" ] } } ] } ] }'
env:
TZ: Asia/Kolkata
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
steps:
- name: Set up JDK 21
uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5
with:
java-version: '21'
distribution: 'zulu'
- name: Download workspace
id: download-workspace
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
continue-on-error: true
with:
name: fineract-workspace-${{ github.run_id }}
path: .
- name: Extract workspace
if: steps.download-workspace.outcome == 'success'
run: tar -xf fineract-workspace.tar
- name: Checkout
if: steps.download-workspace.outcome != 'success'
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
fetch-depth: 0
fetch-tags: true
- name: Build workspace fallback
if: steps.download-workspace.outcome != 'success'
uses: ./.github/actions/setup-and-build-fineract
with:
cache-read-only: false
- name: Setup Gradle and Validate Wrapper
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
with:
validate-wrappers: true
- name: Verify PostgreSQL connection
run: |
while ! pg_isready -d postgres -U root -h 127.0.0.1 -p 5432 ; do
sleep 1
done
- name: Initialise databases
run: |
./gradlew --no-daemon -q createPGDB -PdbName=fineract_tenants -x buildJavaSdk
./gradlew --no-daemon -q createPGDB -PdbName=fineract_default -x buildJavaSdk
- name: Start LocalStack
env:
AWS_ENDPOINT_URL: http://localhost:4566
AWS_ACCESS_KEY_ID: localstack
AWS_SECRET_ACCESS_KEY: localstack
AWS_REGION: us-east-1
run: |
docker run -d --name localstack -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack:2.1
sleep 10
docker exec localstack awslocal s3api create-bucket --bucket fineract-reports
echo "LocalStack initialization complete"
- name: Build & Test
env:
AWS_ENDPOINT_URL: http://localhost:4566
AWS_ACCESS_KEY_ID: localstack
AWS_SECRET_ACCESS_KEY: localstack
AWS_REGION: us-east-1
FINERACT_REPORT_EXPORT_S3_ENABLED: true
FINERACT_REPORT_EXPORT_S3_BUCKET_NAME: fineract-reports
run: |
./gradlew --no-daemon --console=plain cucumber -x :fineract-e2e-tests-runner:cucumber -x buildJavaSdk
./gradlew --no-daemon --console=plain test -x :twofactor-tests:test -x :oauth2-test:test -x :fineract-e2e-tests-runner:test -PdbType=postgresql -x buildJavaSdk
./gradlew --no-daemon --console=plain :twofactor-tests:test -PdbType=postgresql -x buildJavaSdk
./gradlew --no-daemon --console=plain :oauth2-tests:test -PdbType=postgresql -x buildJavaSdk
- name: Archive test results
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: test-results
retention-days: 5
compression-level: 9
path: |
build/reports/
integration-tests/build/reports/
twofactor-tests/build/reports/
oauth2-tests/build/reports/
- name: Archive server logs
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: server-logs
retention-days: 5
compression-level: 9
path: |
integration-tests/build/cargo/
twofactor-tests/build/cargo/
oauth2-tests/build/cargo/