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

[Dependency Cache] Use Custom Init Gradle Task to Download Dependencies #13391

Merged

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Jan 24, 2025

Project Thread: paaHJt-7CE-p2
Test PR: #13387
Depends On: buildkite-ci#585


Description

This PR uses the custom init.gradle.kts related file, defined within the Android AMI itself (see buildkite-ci#585), which now contains this custom downloadDependencies task.

With this change, instead of individually calling a number of assemble/lint related tasks to download as many dependencies as possible prior to saving the cache, any project can now utilize this globally defined downloadDependencies task to replace all this boilerplate and streamline the overall dependency cache process.

Notably, with this change, the dependency cache process:

  1. Will no longer be broken on issues like this, making the process more robust.
  2. Will no longer require an associated entry save-cache.sh entry (example) for newly defined jobs/commands, making the process more maintainable.
  3. Will no longer have any missing dependencies that would require extra network activity, making the process faster (just a second or two, but faster nevertheless).
  4. Will no longer take a significant amount of time to save the cache, as it will no longer run any assemble/lint tasks, just that single downloadDependencies task, making the build process faster (for scheduled builds).

Testing information

Just verify the below:

  1. Triggering schedules/dependency-cache.yml manually via this build:
  2. CI is working as expected:

Note

The only drawback to this change, but an expected one, is that the size of the dependency cache is considerably bigger than before, 784.61 MB now, 625.74 MB before, which is more than 150 MB a diff, and this makes the cache restoration a few seconds slower (12s before, 15s now, ish). Having said that, we believe that the low cost of maintaining the cache saving process is worth the extra seconds (context).


Merge Instructions


  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@ParaskP7 ParaskP7 added status: do not merge Dependent on another PR, ready for review but not ready for merge. category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. Core labels Jan 24, 2025
@ParaskP7 ParaskP7 added this to the 21.6 milestone Jan 24, 2025
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 24, 2025

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit20c13f9
Direct Downloadwoocommerce-wear-prototype-build-pr13391-20c13f9.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Jan 24, 2025

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit20c13f9
Direct Downloadwoocommerce-prototype-build-pr13391-20c13f9.apk

This custom 'downloadDependencies' task is part of the Android AMI,
that is utilized by the 'android' agents, and it is becoming available
to all project via the 'init.gradle.kts' script that is included in it.
@ParaskP7 ParaskP7 force-pushed the ci/use-custom-init-gradle-task-to-download-dependencies branch from 640132d to d950365 Compare January 28, 2025 12:08
…to ci/use-custom-init-gradle-task-to-download-dependencies
@ParaskP7 ParaskP7 removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Jan 29, 2025
@ParaskP7 ParaskP7 marked this pull request as ready for review January 29, 2025 14:43
@ParaskP7 ParaskP7 requested a review from wzieba January 29, 2025 14:43
@ParaskP7 ParaskP7 merged commit b45f1e6 into trunk Jan 30, 2025
26 of 27 checks passed
@ParaskP7 ParaskP7 deleted the ci/use-custom-init-gradle-task-to-download-dependencies branch January 30, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: tooling Anything that involves building & maintaining the project, including scripts, `Fastfile`, etc. Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants