Skip to content

[ci] Cache the Android CLI for AndroidDependenciesTests - #13717

Closed
simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-android-cli-ci-cache
Closed

simonrozsival wants to merge 1 commit into
mainfrom
simonrozsival-android-cli-ci-cache

Conversation

@simonrozsival

@simonrozsival simonrozsival commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Context: #13644, #13701

InstallAndroidDependenciesTest downloads the ~90 MB Android CLI from dl.google.com on every run, and each download is another chance to fail on the network. InstallAndroidDependencies.GetAndroidCliAsync already reuses $(_AndroidCliDirectory) when the SHA-256 matches and downloads again otherwise, so caching that directory doesn't change what the test checks.

This adds cache-android-cli.yaml. It points ANDROID_CLI_CACHE_DIR at the per-user CLI directory and restores it with Cache@2. The key is Xamarin.Installer.Common.targets, which pins the CLI version and hashes. The template runs before the Linux AndroidDependenciesTests step in the public and internal pipelines and in stage-linux-tests.yaml.

What isn't cached, and why:

  • SDK packages: android-cli deletes .sdk/arch archives after extracting them, and the test wipes its SDK directory before each attempt.
  • JDK: downloads go to Path.GetTempFileName(). Caching would need a product change and would remove live JDK-download coverage, and that download is where the original flakiness was.

Expected saving is seconds, not minutes; the main gain is less network flakiness. In main build 1693891 the whole AndroidDependenciesTests step took 184s.

Testing: the YAML parses. CI is pending. Check the second run on this PR for a cache hit and for the test reusing the CLI instead of downloading it.

`InstallAndroidDependencies` downloads Google's Android CLI into a
per-user cache directory and reuses it when its SHA-256 matches.
Restore that directory with `Cache@2` before `AndroidDependenciesTests`
so CI does not download the ~90 MB CLI on every run. The cache key
includes `Xamarin.Installer.Common.targets`, which defines the CLI
version and hashes.

SDK packages and the JDK are still downloaded live.

Co-authored-by: Copilot App <[email protected]>
@simonrozsival simonrozsival changed the title simonrozsival android cli ci cache [ci] Cache the Android CLI for AndroidDependenciesTests Nov 23, 2026
@simonrozsival

Copy link
Copy Markdown
Member Author

Closing this cache experiment for now. The measurements so far don't establish a reliable CI improvement.

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.

1 participant