Skip to content

Commit 4ba9e57

Browse files
committed
optimize build action to ensure it does not take alot of time
1 parent a2061e0 commit 4ba9e57

2 files changed

Lines changed: 21 additions & 11 deletions

File tree

.github/workflows/android.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
env:
14-
JAVA_TOOL_OPTIONS: "-Xmx4g"
14+
JAVA_TOOL_OPTIONS: "-Xmx2g"
1515

1616
steps:
1717
- name: Checkout repository
18-
uses: actions/checkout@v3
19-
with:
20-
fetch-depth: 0
18+
uses: actions/checkout@v4
2119

2220
- name: Set up JDK 17
23-
uses: actions/setup-java@v3
21+
uses: actions/setup-java@v4
2422
with:
2523
distribution: 'temurin'
2624
java-version: 17
@@ -49,8 +47,11 @@ jobs:
4947
- name: Make gradlew executable
5048
run: chmod +x ./gradlew
5149

50+
- name: Setup Gradle
51+
uses: gradle/actions/setup-gradle@v3
52+
5253
- name: Cache Gradle packages
53-
uses: actions/cache@v3
54+
uses: actions/cache@v4
5455
with:
5556
path: |
5657
~/.gradle/caches
@@ -62,8 +63,12 @@ jobs:
6263
- name: Write google-services.json
6364
run: echo '${{ secrets.GOOGLE_SERVICES_JSON }}' > app/google-services.json
6465

65-
- name: Build and run unit tests
66-
run: ./gradlew clean assembleDebug assembleRelease testDebugUnitTest --no-daemon --stacktrace
66+
- name: Build Debug and run tests
67+
run: ./gradlew assembleDebug testDebugUnitTest --no-daemon --stacktrace
68+
69+
- name: Build Release
70+
if: github.event_name == 'push'
71+
run: ./gradlew assembleRelease --no-daemon --stacktrace
6772

6873
- name: Debug Show APK files
6974
run: ls -R app/build/outputs/apk
@@ -75,6 +80,7 @@ jobs:
7580
path: app/build/outputs/apk/debug/app-debug.apk
7681

7782
- name: Upload Release APK artifact
83+
if: github.event_name == 'push'
7884
uses: actions/upload-artifact@v4
7985
with:
8086
name: UgandaEMR-Mobile-release-apk
@@ -90,7 +96,7 @@ jobs:
9096

9197
steps:
9298
- name: Checkout repository
93-
uses: actions/checkout@v3
99+
uses: actions/checkout@v4
94100

95101
- name: Download Debug APK artifact
96102
uses: actions/download-artifact@v4

gradle.properties

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,15 @@
66
# http://www.gradle.org/docs/current/userguide/build_environment.html
77
# Specifies the JVM arguments used for the daemon process.
88
# The setting is particularly useful for tweaking memory settings.
9-
org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
9+
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
1010
# When configured, Gradle will run in incubating parallel mode.
1111
# This option should only be used with decoupled projects. For more details, visit
1212
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects
13-
# org.gradle.parallel=true
13+
org.gradle.parallel=true
14+
# Enable configuration cache for faster builds
15+
org.gradle.configuration-cache=true
16+
# Kotlin compiler memory settings
17+
kotlin.daemon.jvmargs=-Xmx1024m
1418
# AndroidX package structure to make it clearer which packages are bundled with the
1519
# Android operating system, and which are packaged with your app's APK
1620
# https://developer.android.com/topic/libraries/support-library/androidx-rn

0 commit comments

Comments
 (0)