Skip to content

Commit

Permalink
test(perf): allow forced cache refresh, to get fresh AVD snapshot cre…
Browse files Browse the repository at this point in the history
…ated

this will speed up emulator over time, as we won't use progressively older AVD snapshots
if we can clear them, and the new snapshots have less housekeeping to do after boot
  • Loading branch information
mikehardy committed Oct 30, 2022
1 parent 85fb32d commit a9423db
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/tests_e2e_android.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
name: Testing E2E Android

on:
workflow_dispatch:
inputs:
clearCaches:
description: "Clear workflow caches where possible"
required: false
type: string

pull_request:
branches:
- '**'
Expand Down Expand Up @@ -111,10 +118,21 @@ jobs:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}-${{matrix.target}}-v1-${{ hashFiles('~/.android/avd/**/snapshots/**') }}
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}-${{matrix.target}}-v1-${{ github.event.inputs.clearCaches }}
restore-keys: |
avd-${{ matrix.api-level }}-${{ matrix.arch }}-${{matrix.target}}-v1
- name: Clear Caches Optionally
if: "${{ github.event.inputs.clearCaches != '' }}"
shell: bash
run: |
du -sk ~/.gradle
du -sk ~/.android
rm -fr ~/.gradle
rm -fr ~/.android
du -sk ~/.gradle || echo ~/.gradle is gone
du -sk ~/.android || echo ~/.android is gone
- name: Build Android App
uses: nick-invision/retry@v2
with:
Expand Down Expand Up @@ -146,7 +164,7 @@ jobs:
- name: AVD Boot and Snapshot Creation
# Only generate a snapshot with a cache miss
# Comment the if out to generate snapshots on branch for performance testing
if: steps.avd-cache.outputs.cache-hit != 'true'
if: "${{ github.event.inputs.clearCaches != '' || (steps.avd-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main') }}"
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
Expand All @@ -168,7 +186,7 @@ jobs:
# Only generate a snapshot for saving with a cache miss
# Switch the if statements via comment if generating snapshots for performance testing
# if: matrix.first-boot-delay != '0'
if: steps.avd-cache.outputs.cache-hit != 'true'
if: "${{ github.event.inputs.clearCaches != '' || (steps.avd-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/main') }}"
env:
FIRST_BOOT_DELAY: ${{ matrix.first-boot-delay }}
uses: reactivecircus/android-emulator-runner@v2
Expand Down

1 comment on commit a9423db

@vercel
Copy link

@vercel vercel bot commented on a9423db Oct 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.