-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Optimize build_instrumented job
#6954
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c379ee9
7c988d1
828f5ee
c06dbf1
a001917
107eacf
3ef66a4
1377083
f3d1741
afe01ee
28ea21e
143de12
9c193f0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - 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 | ||
|
|
@@ -51,29 +44,30 @@ jobs: | |
|
|
||
| - save_cache: | ||
| paths: | ||
| - ~/.gradle/caches | ||
| - ~/.gradle/wrapper | ||
| key: gradle-wrapper-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| key: compile-{{ checksum "gradle/libs.versions.toml" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - save_cache: | ||
| paths: | ||
| - ~/.gradle/caches/modules-2/files-2.1 | ||
| key: compile-deps-{{ checksum "deps.txt" }} | ||
| - ~/work | ||
| key: workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }} | ||
|
|
||
| - persist_to_workspace: | ||
| root: ~/work | ||
| paths: | ||
| - . | ||
| - collect_app/build/outputs/apk | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - compile- | ||
|
|
||
| - run: | ||
| name: Create Maven repo from dependencies | ||
|
|
@@ -85,21 +79,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" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - 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 | ||
|
|
@@ -113,16 +106,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" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - test_modules | ||
| - compile-{{ checksum "gradle/libs.versions.toml" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - compile- | ||
|
|
||
| - run: | ||
| name: Copy gradle config | ||
|
|
@@ -145,23 +138,24 @@ jobs: | |
|
|
||
| - save_cache: | ||
| paths: | ||
| - ~/.gradle/caches/modules-2/files-2.1 | ||
| key: test-modules-deps-{{ checksum "deps.txt" }} | ||
| - ~/.gradle/caches | ||
| - ~/.gradle/wrapper | ||
| key: test_modules-{{ checksum "gradle/libs.versions.toml" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
|
|
||
| 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" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - test_app- | ||
| - compile-{{ checksum "gradle/libs.versions.toml" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - compile- | ||
|
|
||
| - run: | ||
| name: Copy gradle config | ||
|
|
@@ -194,53 +188,54 @@ jobs: | |
|
|
||
| - save_cache: | ||
| paths: | ||
| - ~/.gradle/caches/modules-2/files-2.1 | ||
| key: test-app-deps-{{ checksum "deps.txt" }} | ||
| - ~/.gradle/caches | ||
| - ~/.gradle/wrapper | ||
| key: test_app-{{ checksum "gradle/libs.versions.toml" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
|
|
||
| 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" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - build_instrumented- | ||
| - compile-{{ checksum "gradle/libs.versions.toml" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - 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 | ||
| - ~/.gradle/wrapper | ||
| key: build_instrumented-{{ checksum "gradle/libs.versions.toml" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
|
|
||
| - 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" }}-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }} | ||
| - compile- | ||
|
|
||
| - run: | ||
| name: Copy gradle config | ||
|
|
@@ -265,7 +260,7 @@ jobs: | |
| if [[ -n "$GOOGLE_MAPS_API_KEY" ]]; then \ | ||
| ./check-size.sh 23117869 | ||
| else | ||
| ./check-size.sh 13785543 | ||
| ./check-size.sh 13841204 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: | ||
|
|
@@ -277,6 +272,10 @@ jobs: | |
| test_smoke_instrumented: | ||
| <<: *android_config_small | ||
| steps: | ||
| - checkout | ||
| - restore_cache: | ||
| keys: | ||
| - workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }} | ||
| - attach_workspace: | ||
| at: ~/work | ||
|
|
||
|
|
@@ -306,6 +305,10 @@ jobs: | |
| test_instrumented: | ||
| <<: *android_config_small | ||
| steps: | ||
| - checkout | ||
| - restore_cache: | ||
| keys: | ||
| - workflow-{{ .Environment.CIRCLE_WORKFLOW_ID }} | ||
| - attach_workspace: | ||
| at: ~/work | ||
|
|
||
|
|
@@ -336,7 +339,24 @@ workflows: | |
| version: 2 | ||
| commit: | ||
| jobs: | ||
| - compile | ||
| - hold_pr: | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I often find that I might be committing/pushing quickly and that context, CI will be constantly starting and cancelling workflow runs. Add a manual approval step means we only end up running jobs when we actually care about the result. I'd like to try this, but definitely let me know if you feel like it's getting annoying @grzesiek2010.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with your rationale, but isn’t it possible to differentiate between draft and ready-for-review PRs and trigger jobs only for those that are ready for review?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea! It looks like this might be possible with the new Github triggers, but I'm not sure that we'd be able to have it always run for non-drafts and optionally for drafts (you still probably want CI on request for drafts). We could always just use the GitHub API (probably through I think that's probably a future improvement though: I think we either go with the basic version as-is or remove the |
||
| type: approval | ||
| filters: | ||
| branches: | ||
| ignore: | ||
| - master | ||
| - compile: | ||
| filters: | ||
| branches: | ||
| only: | ||
| - master | ||
| - compile: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to have two jobs with the same name (
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They both reference the |
||
| requires: | ||
| - hold_pr | ||
| filters: | ||
| branches: | ||
| ignore: | ||
| - master | ||
| - check_quality: | ||
| requires: | ||
| - compile | ||
|
|
||
This file was deleted.
| 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 |
| 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 |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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.