Skip to content
Prev Previous commit
Next Next commit
Use caching instead of workspace for speeding up builds
  • Loading branch information
seadowg committed Nov 4, 2025
commit f3d1741ec5eea7110864aa0d9515cbb5bbf985d8
51 changes: 38 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,23 @@ jobs:
paths:
- ~/.gradle/caches
key: compile-{{ checksum "gradle/libs.versions.toml" }}
- save_cache:
paths:
- ~/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-{{ echo $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_small
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- workflow-{{ echo $CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- compile-{{ checksum "gradle/libs.versions.toml" }}
Expand All @@ -73,8 +80,10 @@ jobs:
check_quality:
<<: *android_config
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- workflow-{{ echo $CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- compile-{{ checksum "gradle/libs.versions.toml" }}
Expand All @@ -96,8 +105,10 @@ jobs:
<<: *android_config
parallelism: 4
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- workflow-{{ echo $CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- test_modules-{{ checksum "gradle/libs.versions.toml" }}
Expand Down Expand Up @@ -133,8 +144,10 @@ jobs:
<<: *android_config
parallelism: 4
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- workflow-{{ echo $CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- test_app-{{ checksum "gradle/libs.versions.toml" }}
Expand Down Expand Up @@ -179,8 +192,10 @@ jobs:
build_instrumented:
<<: *android_config_large
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- workflow-{{ echo $CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- build_instrumented-{{ checksum "gradle/libs.versions.toml" }}
Expand Down Expand Up @@ -209,8 +224,10 @@ jobs:
build_release:
<<: *android_config
steps:
- attach_workspace:
at: ~/work
- checkout
- restore_cache:
keys:
- workflow-{{ echo $CIRCLE_WORKFLOW_ID }}
- restore_cache:
keys:
- compile-{{ checksum "gradle/libs.versions.toml" }}
Expand Down Expand Up @@ -251,6 +268,10 @@ jobs:
test_smoke_instrumented:
<<: *android_config_small
steps:
- checkout
- restore_cache:
keys:
- workflow-{{ echo $CIRCLE_WORKFLOW_ID }}
- attach_workspace:
at: ~/work

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

Expand Down