diff --git a/.github/workflows/run-integration-test-sequentially-postgresql.yml b/.github/workflows/run-integration-test-sequentially-postgresql.yml new file mode 100644 index 000000000..57d187069 --- /dev/null +++ b/.github/workflows/run-integration-test-sequentially-postgresql.yml @@ -0,0 +1,104 @@ +name: Fineract Cargo & Unit- & Integration tests - Sequential Execution - PostgreSQL + +on: + push: + branches: + - develop + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-24.04 + timeout-minutes: 180 + + 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=3 + + mock-oauth2-server: + image: ghcr.io/navikt/mock-oauth2-server:2.1.10 + 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 }} + 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 + + steps: + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v4 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Set up JDK 21 + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v4 + with: + java-version: '21' + distribution: 'zulu' + + - name: Cache Gradle dependencies + uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + + - name: Setup Gradle and Validate Wrapper + uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 + 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 + ./gradlew --no-daemon -q createPGDB -PdbName=fineract_default + + - name: Start LocalStack + 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 + + - name: Run Gradle Task + run: | + ./gradlew test -PdbType=postgresql -x :fineract-e2e-tests-runner:test -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer + - name: Archive test results + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: test-results + path: '**/build/reports/' + retention-days: 5 + + - name: Archive server logs + if: always() + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: server-logs + path: '**/build/cargo/' + retention-days: 5