Skip to content
Merged
123 changes: 61 additions & 62 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,26 @@ references:
working_directory: ~/work
docker:
- image: cimg/android:2025.09
resource_class: medium+
resource_class: large

android_config_large: &android_config_large
working_directory: ~/work
docker:
- image: cimg/android:2025.09
resource_class: large
resource_class: xlarge

jobs:
compile:
<<: *android_config
steps:
- checkout
- run:
name: Generate combined build.gradle file for cache key
command: cat build.gradle */build.gradle */build.gradle.kts .circleci/config.yml gradle/libs.versions.toml > deps.txt
- restore_cache:
keys:
- compile-deps-{{ checksum "deps.txt" }}
- compile-deps-
- restore_cache:
keys:
- gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- compile-{{ checksum "gradle/libs.versions.toml" }}
- compile-
- run:
name: Copy gradle config
command: mkdir -p ~/.gradle && cp .circleci/gradle-compile.properties ~/.gradle/gradle.properties

command: mkdir -p ~/.gradle && cp .circleci/gradle.properties ~/.gradle/gradle.properties
- run:
name: Download Robolectric deps
command: ./download-robolectric-deps.sh
Expand All @@ -51,29 +44,29 @@ jobs:

- save_cache:
paths:
- ~/.gradle/wrapper
key: gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- ~/.gradle/caches
key: compile-{{ checksum "gradle/libs.versions.toml" }}
- save_cache:
paths:
- ~/.gradle/caches/modules-2/files-2.1
key: compile-deps-{{ checksum "deps.txt" }}
- ~/work
Copy link
Copy Markdown
Member Author

@seadowg seadowg Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, saving to cache is much faster than persisting to workspace for large sets of files. Caching makes more sense here as well as we don't need the files we're saving here: they just help speed subsequent jobs in the worklow up.

key: workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}

- persist_to_workspace:
root: ~/work
paths:
- .
- collect_app/build/outputs/apk
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to save the APK so that it can be definitely available to the Test Lab jobs.


create_dependency_backup:
<<: *android_config
<<: *android_config_small
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- compile-deps-{{ checksum "deps.txt" }}
- compile-deps-
- workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- compile-{{ checksum "gradle/libs.versions.toml" }}
- compile-

- run:
name: Create Maven repo from dependencies
Expand All @@ -85,21 +78,20 @@ jobs:
path: maven.tar

check_quality:
<<: *android_config_large
<<: *android_config
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- compile-deps-{{ checksum "deps.txt" }}
- compile-deps-
- workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- compile-{{ checksum "gradle/libs.versions.toml" }}
- compile-

- run:
name: Copy gradle config
command: mkdir -p ~/.gradle && cp .circleci/gradle-large.properties ~/.gradle/gradle.properties
command: mkdir -p ~/.gradle && cp .circleci/gradle.properties ~/.gradle/gradle.properties

- run:
name: Run code quality checks
Expand All @@ -113,16 +105,16 @@ jobs:
<<: *android_config
parallelism: 4
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- test-modules-deps-{{ checksum "deps.txt" }}
- test-modules-deps-
- compile-deps-
- workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- test_modules-{{ checksum "gradle/libs.versions.toml" }}
- test_modules
- compile-{{ checksum "gradle/libs.versions.toml" }}
- compile-

- run:
name: Copy gradle config
Expand All @@ -145,23 +137,23 @@ jobs:

- save_cache:
paths:
- ~/.gradle/caches/modules-2/files-2.1
key: test-modules-deps-{{ checksum "deps.txt" }}
- ~/.gradle/caches
key: test_modules-{{ checksum "gradle/libs.versions.toml" }}

test_app:
<<: *android_config
parallelism: 4
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- test-app-deps-{{ checksum "deps.txt" }}
- test-app-deps-
- compile-deps-
- workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- test_app-{{ checksum "gradle/libs.versions.toml" }}
- test_app-
- compile-{{ checksum "gradle/libs.versions.toml" }}
- compile-

- run:
name: Copy gradle config
Expand Down Expand Up @@ -194,53 +186,52 @@ jobs:

- save_cache:
paths:
- ~/.gradle/caches/modules-2/files-2.1
key: test-app-deps-{{ checksum "deps.txt" }}
- ~/.gradle/caches
key: test_app-{{ checksum "gradle/libs.versions.toml" }}

build_instrumented:
<<: *android_config_large
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- intrumented-deps-{{ checksum "deps.txt" }}
- intrumented-deps-
- compile-deps-
- workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- build_instrumented-{{ checksum "gradle/libs.versions.toml" }}
- build_instrumented-
- compile-{{ checksum "gradle/libs.versions.toml" }}
- compile-

- run:
name: Copy gradle config
command: mkdir -p ~/.gradle && cp .circleci/gradle-large.properties ~/.gradle/gradle.properties

- run:
name: Assemble connected test build
command: ./gradlew assembleDebug assembleDebugAndroidTest
command: ./gradlew assembleDebugAndroidTest

- save_cache:
paths:
- ~/.gradle/caches/modules-2/files-2.1
key: intrumented-deps-{{ checksum "deps.txt" }}
- ~/.gradle/caches
key: build_instrumented-{{ checksum "gradle/libs.versions.toml" }}

- persist_to_workspace:
root: ~/work
paths:
- .
- collect_app/build/outputs/apk

build_release:
<<: *android_config
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- compile-deps-{{ checksum "deps.txt" }}
- compile-deps
- workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}
- compile-{{ checksum "gradle/libs.versions.toml" }}
- compile-

- run:
name: Copy gradle config
Expand All @@ -265,7 +256,7 @@ jobs:
if [[ -n "$GOOGLE_MAPS_API_KEY" ]]; then \
./check-size.sh 23117869
else
./check-size.sh 13785543
./check-size.sh 13841204
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this increase? It's a very small bump though.

fi

- run:
Expand All @@ -277,6 +268,10 @@ jobs:
test_smoke_instrumented:
<<: *android_config_small
steps:
- checkout
- restore_cache:
keys:
- workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- attach_workspace:
at: ~/work

Expand Down Expand Up @@ -306,6 +301,10 @@ jobs:
test_instrumented:
<<: *android_config_small
steps:
- checkout
- restore_cache:
keys:
- workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }}
- attach_workspace:
at: ~/work

Expand Down
5 changes: 0 additions & 5 deletions .circleci/gradle-compile.properties

This file was deleted.

7 changes: 4 additions & 3 deletions .circleci/gradle-large.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
# Gradle config for "X-Large" Circle CI resource (https://circleci.com/pricing/price-list/)

org.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=1g
org.gradle.daemon=false
org.gradle.parallel=true
org.gradle.workers.max=4
org.gradle.workers.max=8
test.heap.max=1g
kotlin.compiler.execution.strategy=in-process
5 changes: 3 additions & 2 deletions .circleci/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Gradle config for "Large" Circle CI resource (https://circleci.com/pricing/price-list/)

org.gradle.jvmargs=-Xmx2560m -XX:MaxMetaspaceSize=1g
org.gradle.daemon=false
org.gradle.parallel=true
org.gradle.workers.max=2
org.gradle.workers.max=4
test.heap.max=1g
kotlin.compiler.execution.strategy=in-process