Open
Conversation
Add CI via Github Actions for PRs
Implements several build speed improvements: **gradle.properties (#1, #2, #8, #9):** - Add org.gradle.caching=true (local build cache for all environments) - Add org.gradle.configuration-cache=true (Gradle 9+ compatible) - Fix -Xss1024m → -Xss4m (was 1GB per thread stack; 4MB is standard) - Add -XX:+HeapDumpOnOutOfMemoryError and -XX:MaxMetaspaceSize=512m - Add kotlin.incremental=true and kotlin.incremental.useClasspathSnapshot=true **GH Actions workflows (#4, #8) — aaps-ci.yml, pr-ci.yml, cherry-pick-ci.yml:** - Replace actions/setup-java cache:gradle with gradle/actions/setup-gradle@v4 for better Gradle dependency and build output caching - Fix -Xss1024m → -Xss4m in all Build APKs steps - Remove redundant -Dorg.gradle.caching=true CLI flag (now in gradle.properties) **CircleCI config (#6, #8):** - Fix -Xss1024m → -Xss4m in all gradlew invocations - Restructure single build-and-test job into parallel pipeline: compile → unit-test + instrumented-test (parallel) → coverage Reduces wall time ~3 min by overlapping unit and instrumented tests https://claude.ai/code/session_01GskFzaoUj9aa5LEz86NjKb
Replace ProcessBuilder calls with Gradle's providers.exec() API to make git commands compatible with configuration cache in Gradle 9. https://claude.ai/code/session_01GskFzaoUj9aa5LEz86NjKb
Include app/build/reports/androidTests/** so the HTML test report from connectedFullDebugAndroidTest is available as a CI artifact. https://claude.ai/code/session_01GskFzaoUj9aa5LEz86NjKb
Split the single sequential build-and-test job into two parallel jobs: - unit-tests: runs testFullDebugUnitTest (~11min) - connected-tests: runs connectedFullDebugAndroidTest + jacoco (~14min) Previously these ran sequentially with a redundant compileFullDebugAndroidTestSources step, totaling ~37min. Now they run in parallel, so wall-clock time drops to ~14min. Also fix flaky LoopTest by increasing waitFor timeout from 40s to 120s at step4, which was timing out on slow CI emulators. https://claude.ai/code/session_01GskFzaoUj9aa5LEz86NjKb
The parallel unit-tests and connected-tests jobs only compile code in their dependency graphs, leaving a gap where production code with no test coverage could silently have compile errors. Add a parallel compile job that runs assembleFullDebug (validates all production code, resources, and manifests) plus compileFullDebugAndroidTestSources (validates all instrumentation test code). This runs in ~7min alongside the test jobs, so wall-clock time remains ~15min. https://claude.ai/code/session_01GskFzaoUj9aa5LEz86NjKb
Switch to gradle/actions/setup-gradle for cross-job build cache sharing. The compile job writes all task outputs to the cache; unit-tests and connected-tests restore it with cache-read-only: true, so all compile tasks are cache hits — no recompilation on the test runners. Timeline: compile (~7min) → unit-tests + connected-tests in parallel (~3min and ~8min respectively, compile tasks skipped via cache). Same ~15min wall-clock as before but 1x compile work instead of 3x. https://claude.ai/code/session_01GskFzaoUj9aa5LEz86NjKb
Adds continue-on-error: true so the check doesn't block PRs for developers who don't have CLAUDE_CODE_OAUTH_TOKEN credentials.
The first cold build can exceed the 30m limit before the Gradle build cache is populated. Once warm, subsequent runs should be well under 30 minutes.
- Add -Dkotlin.compiler.execution.strategy=in-process: runs Kotlin compiler inside the Gradle daemon instead of a separate Kotlin daemon process, eliminating IPC overhead (matching aaps-ci.yml) - Add -Dorg.gradle.workers.max=4: matches GitHub runner CPU count instead of the gradle.properties value of 12 which causes context-switching overhead on 4-core runners - Add gradle-home-cache-cleanup: true to prevent Gradle cache from growing unboundedly and slowing cache restore over time
- Increase timeout-minutes from 20 to 30: cold builds with cache restore overhead were timing out at 21m, below the hard limit - Remove sdkmanager "platforms;android-36" from unit-tests: unit tests are pure JVM; they don't need the Android platform SDK downloaded since compilation already occurred in the compile job. setup-android still runs to set ANDROID_HOME for Gradle config.
gradle.properties: - Remove MaxMetaspaceSize=512m: in-process Kotlin compilation loads the entire compiler into the Gradle daemon's metaspace. 512m was exhausted during kaptFullDebugKotlin, causing the daemon to expire mid-build and likely contributing to the QEMU emulator crash. Removing the cap lets the JVM manage metaspace naturally. - Remove kotlin.incremental.useClasspathSnapshot: deprecated and removed in Gradle 9.0 (was generating warnings each build). pr-ci-untrusted.yml (connected-tests): - Pass -Dorg.gradle.jvmargs=-Xmx5g for connected tests instead of inheriting the 8g gradle.properties default. The Android emulator needs ~3-4g of RAM on the same runner; 8g Gradle heap + emulator was causing QEMU to hang. - Drop in-process Kotlin compiler for connected tests: most tasks should be FROM-CACHE; running in-process on a memory-constrained runner (with emulator active) adds unnecessary risk. Use the separate Kotlin daemon (2g cap) instead.
By default gradle/actions/setup-gradle@v4 is read-only on non-default branches, so the cache was completely non-functional on PRs: 0 entries restored, 0 entries saved, every run a full cold build. Set cache-read-only: false on the compile job so it saves the Gradle user home (including the build cache) after each run. Unit-tests and connected-tests remain read-only and restore via the broad fallback restore key, sharing the compile job's cached artifacts. This means the first run on a PR branch pays full compile cost; all subsequent pushes to that PR get most tasks FROM-CACHE.
…e-Nor95 Gradle/CI build optimizations: enable gradle caching, fix jvm settings, produce test reports
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



No description provided.