Skip to content

Commit 5dda254

Browse files
authored
Merge pull request #5799
FINERACT-2421: Optimize github actions workflow
2 parents dc209af + e1644a3 commit 5dda254

24 files changed

Lines changed: 763 additions & 284 deletions

.github/workflows/build-core.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Fineract Build Core
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
build-core:
11+
runs-on: ubuntu-24.04
12+
timeout-minutes: 60
13+
14+
env:
15+
TZ: Asia/Kolkata
16+
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
21+
with:
22+
fetch-depth: 0
23+
fetch-tags: true
24+
25+
- name: Set up JDK 21
26+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
27+
with:
28+
java-version: '21'
29+
distribution: 'zulu'
30+
31+
- name: Cache Gradle dependencies
32+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
33+
with:
34+
path: |
35+
~/.gradle/caches
36+
~/.gradle/wrapper
37+
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
38+
39+
- name: Setup Gradle and Validate Wrapper
40+
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
41+
with:
42+
validate-wrappers: true
43+
44+
- name: Build Avro Java SDK
45+
run: ./gradlew --no-daemon :fineract-avro-schemas:buildJavaSdk -x test -x cucumber -x doc -x javadoc -x javadocJar -x checkstyleMain -x checkstyleTest -x checkstyleJmh -x spotbugsMain -x spotbugsTest -x spotlessCheck -x spotlessApply -x rat
46+
47+
- name: Compile Fineract Provider
48+
run: ./gradlew --no-daemon :fineract-provider:compileJava -x test -x cucumber -x doc -x buildJavaSdk -x javadoc -x javadocJar -x checkstyleMain -x checkstyleTest -x checkstyleJmh -x spotbugsMain -x spotbugsTest -x spotlessCheck -x spotlessApply -x rat
49+
50+
- name: Generate Fineract Git Properties
51+
run: ./gradlew --no-daemon :fineract-provider:generateGitProperties -x javadoc -x javadocJar -x checkstyleMain -x checkstyleTest -x checkstyleJmh -x spotbugsMain -x spotbugsTest -x spotlessCheck -x spotlessApply -x rat
52+
53+
- name: Verify generated git.properties
54+
run: test -f fineract-provider/build/resources/main/git.properties
55+
56+
- name: Build Fineract Client Java SDK
57+
run: ./gradlew --no-daemon :fineract-client:buildJavaSdk -x test -x cucumber -x doc -x javadoc -x javadocJar -x checkstyleMain -x checkstyleTest -x checkstyleJmh -x spotbugsMain -x spotbugsTest -x spotlessCheck -x spotlessApply -x rat
58+
59+
- name: Build Fineract Client Feign Java SDK
60+
run: ./gradlew --no-daemon :fineract-client-feign:buildJavaSdk -x test -x cucumber -x doc -x javadoc -x javadocJar -x checkstyleMain -x checkstyleTest -x checkstyleJmh -x spotbugsMain -x spotbugsTest -x spotlessCheck -x spotlessApply -x rat
61+
62+
- name: Build Fineract
63+
run: ./gradlew --no-daemon build -x test -x cucumber -x doc -x javadoc -x javadocJar -x checkstyleMain -x checkstyleTest -x checkstyleJmh -x spotbugsMain -x spotbugsTest -x spotlessCheck -x spotlessApply -x rat
64+
65+
- name: Pack workspace
66+
run: |
67+
tar --exclude='./fineract-workspace.tar' -cf fineract-workspace.tar .
68+
69+
- name: Upload workspace
70+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
71+
with:
72+
name: fineract-workspace-${{ github.run_id }}
73+
path: fineract-workspace.tar
74+
retention-days: 1
75+
76+
- name: Archive test results
77+
if: always()
78+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
79+
with:
80+
name: test-results-build-core
81+
path: '**/build/reports/'
82+
if-no-files-found: ignore
83+
retention-days: 5
84+
85+
- name: Archive server logs
86+
if: always()
87+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
88+
with:
89+
name: server-logs-build-core
90+
path: '**/build/cargo/'
91+
retention-days: 5
Lines changed: 16 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,57 @@
1-
name: Fineract Build & Cucumber tests (without E2E tests)
1+
name: Fineract Cucumber tests (without E2E tests)
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_call:
45

56
permissions:
67
contents: read
78

89
jobs:
9-
verify:
10+
cucumber:
1011
runs-on: ubuntu-24.04
1112
timeout-minutes: 60
1213

13-
strategy:
14-
fail-fast: false
15-
matrix:
16-
include:
17-
- task: build-core
18-
job_type: main
19-
- task: cucumber
20-
job_type: main
21-
- task: build-progressive-loan
22-
job_type: progressive-loan
23-
2414
env:
2515
TZ: Asia/Kolkata
2616
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
2717

2818
steps:
29-
- name: Checkout
30-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
31-
with:
32-
fetch-depth: 0
33-
fetch-tags: true
34-
3519
- name: Set up JDK 21
3620
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
3721
with:
3822
java-version: '21'
3923
distribution: 'zulu'
4024

41-
- name: Cache Gradle dependencies
42-
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
25+
- name: Download workspace
26+
uses: actions/download-artifact@v5
4327
with:
44-
path: |
45-
~/.gradle/caches
46-
~/.gradle/wrapper
47-
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
28+
name: fineract-workspace-${{ github.run_id }}
29+
path: .
30+
31+
- name: Extract workspace
32+
run: tar -xf fineract-workspace.tar
4833

4934
- name: Setup Gradle and Validate Wrapper
5035
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
5136
with:
5237
validate-wrappers: true
5338

54-
- name: Run Gradle Task
55-
if: matrix.job_type == 'main'
56-
run: |
57-
set -e # Fail the script if any command fails
58-
59-
case "${{ matrix.task }}" in
60-
build-core)
61-
./gradlew --no-daemon build -x test -x cucumber -x doc
62-
;;
63-
cucumber)
64-
./gradlew --no-daemon cucumber -x :fineract-e2e-tests-runner:cucumber -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer
65-
;;
66-
esac
67-
68-
- name: Build and Test Progressive Loan
69-
if: matrix.job_type == 'progressive-loan'
70-
run: |
71-
# Build the JAR
72-
./gradlew --no-daemon --console=plain :fineract-progressive-loan-embeddable-schedule-generator:shadowJar
73-
74-
# Store the JAR filename in an environment variable
75-
EMBEDDABLE_JAR_FILE=$(ls fineract-progressive-loan-embeddable-schedule-generator/build/libs/*-all.jar | head -n 1)
76-
echo "EMBEDDABLE_JAR_FILE=$EMBEDDABLE_JAR_FILE" >> $GITHUB_ENV
77-
echo "JAR file: $EMBEDDABLE_JAR_FILE"
78-
79-
# Run unit tests
80-
./gradlew --no-daemon --console=plain :fineract-progressive-loan-embeddable-schedule-generator:test
81-
82-
# Build and run sample application
83-
mkdir -p sample-app
84-
javac -cp "$EMBEDDABLE_JAR_FILE" -d sample-app fineract-progressive-loan-embeddable-schedule-generator/misc/Main.java
85-
java -cp "$EMBEDDABLE_JAR_FILE:sample-app" Main
86-
java -cp "$EMBEDDABLE_JAR_FILE:sample-app" Main 25
39+
- name: Run Cucumber
40+
run: ./gradlew --no-daemon cucumber -x :fineract-e2e-tests-runner:cucumber -x checkstyleJmh -x checkstyleMain -x checkstyleTest -x spotlessCheck -x spotlessApply -x spotbugsMain -x spotbugsTest -x javadoc -x javadocJar -x modernizer -x buildJavaSdk
8741

8842
- name: Archive test results
8943
if: always()
9044
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
9145
with:
92-
name: test-results-${{ matrix.task }}
93-
path: |
94-
**/build/reports/
95-
**/fineract-progressive-loan-embeddable-schedule-generator/build/reports/
46+
name: test-results-cucumber
47+
path: '**/build/reports/'
9648
if-no-files-found: ignore
9749
retention-days: 5
9850

99-
- name: Archive Progressive Loan JAR
100-
if: matrix.job_type == 'progressive-loan' && always()
101-
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
102-
with:
103-
name: progressive-loan-jar
104-
path: ${{ env.EMBEDDABLE_JAR_FILE }}
105-
retention-days: 5
106-
if-no-files-found: ignore
107-
10851
- name: Archive server logs
10952
if: always()
11053
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
11154
with:
112-
name: server-logs-${{ matrix.task }}
55+
name: server-logs-cucumber
11356
path: '**/build/cargo/'
11457
retention-days: 5

.github/workflows/build-docker.yml

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Fineract Docker Builds
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_call:
45

56
permissions:
67
contents: read
@@ -26,21 +27,32 @@ jobs:
2627
IMAGE_NAME: fineract
2728

2829
steps:
29-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
30-
with:
31-
fetch-depth: 0
32-
3330
- name: Set up JDK 21
3431
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
3532
with:
3633
java-version: '21'
3734
distribution: 'zulu'
3835

36+
- name: Download workspace
37+
uses: actions/download-artifact@v5
38+
with:
39+
name: fineract-workspace-${{ github.run_id }}
40+
path: .
41+
42+
- name: Extract workspace
43+
run: tar -xf fineract-workspace.tar
44+
3945
- name: Setup Gradle
4046
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
4147

4248
- name: Build the image
43-
run: ./gradlew --no-daemon --console=plain :fineract-provider:jibDockerBuild -Djib.to.image=$IMAGE_NAME -x test -x cucumber
49+
run: ./gradlew --no-daemon --console=plain :fineract-provider:jibDockerBuild -Djib.to.image=$IMAGE_NAME -x test -x cucumber -x buildJavaSdk
50+
51+
- name: Verify git.properties in image
52+
run: |
53+
docker create --name fineract-inspect $IMAGE_NAME
54+
docker export fineract-inspect | tar -tf - | grep 'git.properties'
55+
docker rm fineract-inspect
4456
4557
- name: Start the ${{ matrix.db_type }} stack
4658
run: docker compose -f ${{ matrix.compose_file }} up -d
@@ -52,4 +64,7 @@ jobs:
5264
run: curl -f -k --retry 60 --retry-all-errors --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health
5365

5466
- name: Check info Manager
55-
run: (( $(curl -f -k --retry 5 --retry-all-errors --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 ))
67+
run: |
68+
curl -f -k --retry 5 --retry-all-errors --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info -o actuator-info.json
69+
cat actuator-info.json
70+
jq -e '.git | type == "object"' actuator-info.json

.github/workflows/build-documentation.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Fineract Documentation build
2-
on: [push, pull_request]
2+
on:
3+
workflow_call:
34
permissions:
45
contents: read
56
jobs:
@@ -9,15 +10,18 @@ jobs:
910
env:
1011
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
1112
steps:
12-
- name: Checkout
13-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
14-
with:
15-
fetch-depth: 0
1613
- name: Set up JDK 21
1714
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
1815
with:
1916
java-version: '21'
2017
distribution: 'zulu'
18+
- name: Download workspace
19+
uses: actions/download-artifact@v5
20+
with:
21+
name: fineract-workspace-${{ github.run_id }}
22+
path: .
23+
- name: Extract workspace
24+
run: tar -xf fineract-workspace.tar
2125
- name: Setup Gradle
2226
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
2327
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
@@ -32,4 +36,4 @@ jobs:
3236
sudo apt-get update
3337
sudo apt-get install ghostscript graphviz -y
3438
- name: Documentation build
35-
run: ./gradlew --no-daemon --console=plain doc
39+
run: ./gradlew --no-daemon --console=plain doc -x buildJavaSdk

.github/workflows/build-e2e-tests.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: Fineract E2E Tests
22

3-
on: [push, pull_request]
3+
on:
4+
workflow_call:
45

56
permissions:
67
contents: read
@@ -32,17 +33,21 @@ jobs:
3233
ACTIVEMQ_TOPIC_NAME: events
3334

3435
steps:
35-
- name: Checkout code
36-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
37-
with:
38-
fetch-depth: 0
39-
4036
- name: Set up JDK 21
4137
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5
4238
with:
4339
java-version: '21'
4440
distribution: 'zulu'
4541

42+
- name: Download workspace
43+
uses: actions/download-artifact@v5
44+
with:
45+
name: fineract-workspace-${{ github.run_id }}
46+
path: .
47+
48+
- name: Extract workspace
49+
run: tar -xf fineract-workspace.tar
50+
4651
- name: Setup Gradle
4752
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5.0.2
4853

@@ -57,7 +62,7 @@ jobs:
5762
cat feature_shard_${{ matrix.shard_index }}.txt
5863
5964
- name: Build the image
60-
run: ./gradlew --no-daemon --console=plain :fineract-provider:jibDockerBuild -Djib.to.image=$IMAGE_NAME -x test -x cucumber
65+
run: ./gradlew --no-daemon --console=plain :fineract-provider:jibDockerBuild -Djib.to.image=$IMAGE_NAME -x test -x cucumber -x buildJavaSdk
6166

6267
- name: Start the Fineract stack
6368
run: docker compose -f docker-compose-postgresql-test-activemq.yml up -d
@@ -116,7 +121,11 @@ jobs:
116121
:fineract-e2e-tests-runner:cucumber \
117122
-Pcucumber.features="$feature_file" \
118123
-Dallure.results.directory="allure-results-shard-${{ matrix.shard_index }}/$safe_name" \
119-
allureReport; then
124+
allureReport \
125+
-x buildJavaSdk \
126+
-x :fineract-client:buildJavaSdk \
127+
-x :fineract-client-feign:buildJavaSdk \
128+
-x :fineract-avro-schemas:buildJavaSdk; then
120129
121130
echo "::error::Test failed for $feature_file"
122131
FAILED=1

0 commit comments

Comments
 (0)