Skip to content

Add caching for Android SDK, Gradle, and Expo prebuild#7

Merged
markwatson merged 1 commit into
mainfrom
claude/optimize-build-caching-uo5rR
Mar 16, 2026
Merged

Add caching for Android SDK, Gradle, and Expo prebuild#7
markwatson merged 1 commit into
mainfrom
claude/optimize-build-caching-uo5rR

Conversation

@markwatson
Copy link
Copy Markdown
Owner

Summary

This PR adds GitHub Actions caching for Android build dependencies and generated files across all CI/CD workflows (build, release). This reduces build times by avoiding redundant downloads and regeneration of Android SDK packages, Gradle dependencies, and Expo prebuild artifacts.

Key Changes

  • Android SDK Caching: Added caching for ~/.android/sdk to avoid re-downloading SDK packages on each workflow run
  • Expo Prebuild Caching: Added caching for the generated android/ directory with cache invalidation based on app.json, package-lock.json, and module changes
  • Gradle Caching: Added caching for Gradle caches and wrapper to speed up Android builds
  • Conditional Prebuild: Modified the "Generate Android project" step to only run when the prebuild cache is not hit, avoiding unnecessary regeneration
  • Applied to All Workflows: Implemented consistent caching strategy across build.yml and release.yml workflows

Implementation Details

  • Cache keys are based on runner OS and relevant file hashes to ensure cache invalidation when dependencies or configuration changes
  • Gradle cache includes restore keys for partial cache hits across different dependency versions
  • Each workflow job has its own cache ID to prevent conflicts between test and build jobs

https://claude.ai/code/session_01UttwqGKARJaHeoWyV8J6kA

Addresses three CI performance bottlenecks:
- Gradle caching (~/.gradle/caches + wrapper) with restore-keys fallback
- Expo prebuild caching (android/ dir keyed on app.json, lockfile, modules)
- Android SDK package caching (~/.android/sdk)

Applied to all Android jobs in both build.yml and release.yml.

https://claude.ai/code/session_01UttwqGKARJaHeoWyV8J6kA
@markwatson markwatson merged commit 506ea8c into main Mar 16, 2026
3 checks passed
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.

2 participants