modernize locale instantiations (fixes an error found by the modernizer plugin) - use Locale.of() instead of new Locale() use recommended gradle toolchain syntax to specify Java class file format version see https://docs.gradle.org/current/userguide/java_plugin.html#toolchain_and_compatibility mark html5 for later fix (it's the default) use dummy byte arrays to work around mockito exception ``` org.mockito.exceptions.base.MockitoException: Mockito cannot mock this class: class java.nio.ByteBuffer. If you're not sure why you're getting this error, please open an issue on GitHub. Java : 21 JVM vendor name : Ubuntu JVM vendor version : 21.0.6+7-Ubuntu-122.04.1 JVM name : OpenJDK 64-Bit Server VM JVM version : 21.0.6+7-Ubuntu-122.04.1 JVM info : mixed mode, sharing OS name : Linux OS version : 5.15.0-136-generic You are seeing this disclaimer because Mockito is configured to create inlined mocks. You can learn about inline mocks and their limitations under item #39 of the Mockito class javadoc. Underlying exception : org.mockito.exceptions.base.MockitoException: Unsupported settings with this type 'java.nio.ByteBuffer' at app//org.apache.fineract.infrastructure.event.external.jobs.SendAsynchronousEventsTaskletTest.givenBatchSize2WhenEventSendFailsThenExecutionStops(SendAsynchronousEventsTaskletTest.java:170) at java.base@21.0.6/java.lang.reflect.Method.invoke(Method.java:580) at java.base@21.0.6/java.util.ArrayList.forEach(ArrayList.java:1596) at java.base@21.0.6/java.util.ArrayList.forEach(ArrayList.java:1596) Caused by: org.mockito.exceptions.base.MockitoException: Unsupported settings with this type 'java.nio.ByteBuffer' at app//net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:168) at app//net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:399) at app//net.bytebuddy.TypeCache.findOrInsert(TypeCache.java:190) at app//net.bytebuddy.TypeCache$WithInlineExpunction.findOrInsert(TypeCache.java:410) ... 4 more ``` see also: https://stackoverflow.com/questions/47046996/java-lang-unsupportedoperationexception-when-mocking-java-nio-bytebuffer-class wrap byte arrays with ByteBuffer fix: ``` /home/adamm/git/apache/fineract/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/jobs/SendAsynchronousEventsTaskletTest.java:148: error: incompatible types: byte[] cannot be converted to ByteBuffer "anidempotencyKey", "aSchema", "dummy".getBytes()); ^ /home/adamm/git/apache/fineract/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/jobs/SendAsynchronousEventsTaskletTest.java:170: error: incompatible types: byte[] cannot be converted to ByteBuffer "anidempotencyKey", "aSchema", "dummy".getBytes()); ^ /home/adamm/git/apache/fineract/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/jobs/SendAsynchronousEventsTaskletTest.java:189: error: incompatible types: byte[] cannot be converted to ByteBuffer "anidempotencyKey", "aSchema", "dummy".getBytes()); ^ /home/adamm/git/apache/fineract/fineract-provider/src/test/java/org/apache/fineract/infrastructure/event/external/jobs/SendAsynchronousEventsTaskletTest.java:210: error: incompatible types: byte[] cannot be converted to ByteBuffer "anidempotencyKey", "aSchema", "dummy".getBytes()); ``` ...and use StandardCharsets with getBytes
94 lines
3.9 KiB
YAML
94 lines
3.9 KiB
YAML
name: Fineract Build & Test - PostgreSQL
|
|
on: [push, pull_request]
|
|
permissions:
|
|
contents: read
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-24.04
|
|
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 }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up JDK 21
|
|
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4
|
|
with:
|
|
java-version: '21'
|
|
distribution: 'zulu'
|
|
- name: Setup Gradle and Validate Wrapper
|
|
uses: gradle/actions/setup-gradle@06832c7b30a0129d7fb559bcc6e43d26f6374244 # v4.3.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
|
|
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 build -x cucumber -x test -x doc
|
|
./gradlew --no-daemon --console=plain cucumber -x :fineract-e2e-tests-runner:cucumber
|
|
./gradlew --no-daemon --console=plain test -x :twofactor-tests:test -x :oauth2-test:test :fineract-e2e-tests-runner:test -PdbType=postgresql
|
|
./gradlew --no-daemon --console=plain :twofactor-tests:test -PdbType=postgresql
|
|
./gradlew --no-daemon --console=plain :oauth2-tests:test -PdbType=postgresql
|
|
- name: Archive test results
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: test-results
|
|
path: |
|
|
build/reports/
|
|
integration-tests/build/reports/
|
|
twofactor-tests/build/reports/
|
|
oauth2-tests/build/reports/
|
|
- name: Archive server logs
|
|
if: always()
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
|
|
with:
|
|
name: server-logs
|
|
path: |
|
|
integration-tests/build/cargo/
|
|
twofactor-tests/build/cargo/
|
|
oauth2-tests/build/cargo/
|