Skip to content

Commit

Permalink
Add CI step to cache emulator snapshots. (#788)
Browse files Browse the repository at this point in the history
* Create emulator snapshot.

* Naming.

* Enable animations for snapshot.

* Tweak options.
  • Loading branch information
colinrtwhite authored Jun 30, 2021
1 parent f437b5b commit b4ce68b
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,38 @@ jobs:
with:
distribution: 'adopt'
java-version: 11

# Restore the cache.
# Intentionally don't set 'restore-keys' so the cache never contains redundant dependencies.
- uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**/**.gradle.kts', '**/gradle/wrapper/gradle-wrapper.properties', '**/buildSrc/src/main/kotlin/Library.kt') }}

- name: Cache AVD snapshot
uses: actions/cache@v2
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}

- name: Create AVD snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
disable-animations: false
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: echo "Generated AVD snapshot for caching."

- name: Instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86
disable-animations: true
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: ./gradlew connectedDebugAndroidTest

deploy-snapshot:
Expand Down

0 comments on commit b4ce68b

Please sign in to comment.