Skip to content

Commit aa03ebc

Browse files
utkarshdalalUtkarsh Dalal
andauthored
Keep the master build runner from being OOM-killed and give unit tests a bigger heap (#1895)
Every recent failure of the Android CI workflow ends with "The runner has received a shutdown signal" 17-20 minutes in, while one flavour's R8 pass overlaps another flavour's bundle packaging. That is the 16 GB runner VM being killed for memory: the Gradle daemon runs with -Xmx8g and the Kotlin daemon inherits the same 8g. Build the three bundles in separate Gradle invocations so packaging of one flavour never overlaps R8 of the next, cap the Kotlin daemon at 3g on CI, and add an 8 GB swapfile as a safety net. The PR check has separately been failing with OutOfMemoryError in testModernDebugUnitTest; the Gradle test worker default is 512m and the Robolectric suite is over 1200 tests, so raise it to 4g. Co-authored-by: Utkarsh Dalal <utkarsh.dalal@toptal.com>
1 parent 58ec930 commit aa03ebc

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/app-release-signed.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ jobs:
2323

2424
steps:
2525
- uses: actions/checkout@v4
26+
- name: Add swap
27+
run: |
28+
sudo fallocate -l 8G /mnt/swapfile.ci
29+
sudo chmod 600 /mnt/swapfile.ci
30+
sudo mkswap /mnt/swapfile.ci
31+
sudo swapon /mnt/swapfile.ci
32+
free -m
2633
- name: set up Java 17
2734
uses: actions/setup-java@v4
2835
with:
@@ -81,7 +88,11 @@ jobs:
8188
yes | "$SDKMANAGER" --install "build-tools;34.0.0"
8289
8390
- name: Build with Gradle
84-
run: ./gradlew :app:bundleLegacyRelease :app:bundleModernRelease :app:bundleLegacyXrRelease
91+
run: |
92+
./gradlew -Pkotlin.daemon.jvmargs=-Xmx3g :app:bundleLegacyRelease
93+
./gradlew -Pkotlin.daemon.jvmargs=-Xmx3g :app:bundleModernRelease
94+
./gradlew -Pkotlin.daemon.jvmargs=-Xmx3g :app:bundleLegacyXrRelease
95+
free -m
8596
8697
- name: Stage bundles
8798
run: |

app/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ android {
229229
testOptions {
230230
unitTests {
231231
isIncludeAndroidResources = true
232+
all { it.maxHeapSize = "4g" }
232233
}
233234
}
234235

0 commit comments

Comments
 (0)