Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support AVD snapshot caching #159

Merged
merged 3 commits into from
Jun 19, 2021
Merged

Conversation

ychescale9
Copy link
Member

@ychescale9 ychescale9 commented Jun 17, 2021

Add force-avd-creation which when set to false will skip avd creation if avd with same name exists.

Setting force-avd-creation to false allows cached AVD to be used when starting emulator which significantly reduces emulator startup time from 1-3 minutes down to ~15 seconds.

Snapshot caching can be done by running the action with snapshot (no -no-snapshot in emulator-options) if no snapshot cache is found, before running the action again (with -no-snapshot-save to make sure the cache won't be updated after running tests) to run to actual tests:

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

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

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

Related to #76.

@ychescale9 ychescale9 force-pushed the yc/support-avd-snapshot-caching branch 4 times, most recently from bc18a19 to 7ab823e Compare June 17, 2021 21:47
…sts. Update workflow to test snapshot caching.
@ychescale9 ychescale9 force-pushed the yc/support-avd-snapshot-caching branch from 7ab823e to ee11183 Compare June 18, 2021 06:44
@ychescale9 ychescale9 force-pushed the yc/support-avd-snapshot-caching branch from 3dd53fa to 0e25a53 Compare June 19, 2021 12:53
@ychescale9 ychescale9 merged commit 6fa2695 into main Jun 19, 2021
@ychescale9 ychescale9 deleted the yc/support-avd-snapshot-caching branch June 19, 2021 15:41
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.

1 participant