From a87a86f4f27cce8a7759ea2eb374bebba131f241 Mon Sep 17 00:00:00 2001 From: Mukilan Thiyagarajan Date: Sat, 14 Dec 2024 16:48:43 +0530 Subject: [PATCH] ci: add retries and caching for `gradle` installation (#34619) This change uses Gradle's official `setup-gradle` action to allow the caching of the downloaded gradle distribution and java dependencies in the GitHub Actions cache. However, since the initial download of gradle distribution is still handled by the `gradlew` wrapper script which doesn't retry on network failures, this change also adds a simple retry mechanism using shell scripting. Fixes #34600 Signed-off-by: Mukilan Thiyagarajan --- .github/workflows/android.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 09ce7281cbf..e77d3679f76 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -79,6 +79,14 @@ jobs: id: setup-ndk with: ndk-version: r26c + - name: Setup Gradle caches + uses: gradle/actions/setup-gradle@v4 + - name: Trigger initial download of Gradle with retries + run: | + for i in {1..4}; do + ./gradlew --version && break || { echo "Downloading Gradle failed (attempt $i)." && sleep $((3 ** $i)); }; + done + working-directory: ./support/android/apk/ - name: Setup Key Store for APK Signing env: KEYSTORE_BASE64: ${{ secrets.APK_KEYSTORE_BASE64 }}