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 <mukilan@igalia.com>
This commit is contained in:
Mukilan Thiyagarajan 2024-12-14 16:48:43 +05:30 committed by GitHub
parent 1705473caa
commit a87a86f4f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 }}