From 3495b82499a0cdfb782f300016428709a8bbb803 Mon Sep 17 00:00:00 2001 From: Joining7943 <111500881+Joining7943@users.noreply.github.com> Date: Sat, 15 Apr 2023 13:22:51 +0200 Subject: [PATCH] ci/android: Use different caching strategy --- .github/workflows/android.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 06c39f961..97e1e60f1 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -32,15 +32,15 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.3 - - name: AVD cache - uses: actions/cache@v3 + - name: Restore AVD cache + uses: actions/cache/restore@v3 id: avd-cache with: path: | ~/.android/avd/* ~/.android/avd/*/snapshots/* ~/.android/adb* - key: avd-${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }} + key: avd-${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}+nextest - name: Create and cache emulator image if: steps.avd-cache.outputs.cache-hit != 'true' uses: reactivecircus/android-emulator-runner@v2 @@ -53,11 +53,21 @@ jobs: force-avd-creation: true emulator-options: -no-snapshot-load -noaudio -no-boot-anim -camera-back none script: | + set -e wget https://github.com/termux/termux-app/releases/download/${{ env.TERMUX }}/termux-app_${{ env.TERMUX }}+github-debug_${{ matrix.arch }}.apk util/android-commands.sh snapshot termux-app_${{ env.TERMUX }}+github-debug_${{ matrix.arch }}.apk adb -s emulator-5554 emu avd snapshot save ${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }} echo "Emulator image created." pkill -9 qemu-system-x86_64 + - name: Save AVD cache + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + path: | + ~/.android/avd/* + ~/.android/avd/*/snapshots/* + ~/.android/adb* + key: avd-${{ matrix.api-level }}-${{ matrix.arch }}+termux-${{ env.TERMUX }}+nextest - name: Build and Test uses: reactivecircus/android-emulator-runner@v2 with: