Skip to content
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

Gradle Configuration Cache on CI #1772

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

SimonMarquis
Copy link
Contributor

And enable parallel Configuration Cache:

This needs a GRADLE_ENCRYPTION_KEY secret to be configured in the repository settings/secrets/actions, otherwise no configuration cache will be saved or restored.
As explained in the docs, you can use this tool to generate a configuration-cache compatible key: openssl rand -base64 16.

This should help reduce the configuration phase for all the main worflow tasks in CI.

- https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#saving-configuration-cache-data
- https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:secrets

And enable parallel Configuration Cache:
- https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:usage:parallel

This needs a `GRADLE_ENCRYPTION_KEY` secret to be configured in the repository [settings/secrets/actions](https://github.com/android/nowinandroid/settings/secrets/actions), otherwise no configuration cache will be saved or restored.
As explained in the docs, you can use this tool to generate a configuration-cache compatible key: `openssl rand -base64 16`.
@SimonMarquis
Copy link
Contributor Author

For example, a regular build spend this much time in configuration phase:

For a total duration of ~6min 30s.

@dturner
Copy link
Collaborator

dturner commented Dec 20, 2024

Secret added:

image

@dturner dturner merged commit 4e17010 into android:main Dec 20, 2024
5 checks passed
@SimonMarquis SimonMarquis deleted the gradle-configuration-cache branch December 20, 2024 18:03
@cdsap
Copy link

cdsap commented Jan 6, 2025

that's great @SimonMarquis. Out of curiosity, were you affected by this issue gradle/actions#21 on included builds?

@SimonMarquis
Copy link
Contributor Author

@cdsap not on my fork, and I don't see it in this repo.
For example, on the latest run of the main branch: Local tests and APKs


./gradlew :build-logic:convention:check
Calculating task graph as configuration cache cannot be reused because an input to task ':build-logic:convention:processResources' has changed.
Configuration cache entry stored.

./gradlew dependencyGuard
Reusing configuration cache.
Configuration cache entry reused.

./gradlew verifyRoborazziDemoDebug
Calculating task graph as configuration cache cannot be reused because file '../../../../../usr/local/lib/android/sdk/platforms/android-35/package.xml' has changed.
Configuration cache entry stored.

./gradlew testDemoDebug :lint:test
Calculating task graph as configuration cache cannot be reused because file '../../../../../usr/local/lib/android/sdk/platforms/android-35/package.xml' has changed.
Configuration cache entry stored.

./gradlew :app:assemble
Calculating task graph as configuration cache cannot be reused because file '../../../../../usr/local/lib/android/sdk/platforms/android-35/package.xml' has changed.
1578 problems were found storing the configuration cache, 6 of which seem unique.
Configuration cache entry stored with 1578 problems.

./gradlew :app:lintProdRelease :app-nia-catalog:lintRelease :lint:lint
Calculating task graph as configuration cache cannot be reused because file '../../../../../usr/local/lib/android/sdk/platforms/android-35/package.xml' has changed.
Configuration cache entry stored.

./gradlew :app:checkProdReleaseBadging
Calculating task graph as configuration cache cannot be reused because file '../../../../../usr/local/lib/android/sdk/platforms/android-35/package.xml' has changed.
Configuration cache entry stored.

Only dependencyGuard re-used it's configuration cache.
The android/sdk/platforms/android-35/package.xml change might be a side effect of recent change.
We should be able to have more concrete data on the next CI build if it does not change too many things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants