Skip to content

Commit

Permalink
Don't cache AVD for e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stevesoltys committed Oct 11, 2023
1 parent e250214 commit 670f723
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 30 deletions.
9 changes: 5 additions & 4 deletions .github/scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ adb shell rm /sdcard/seedvault_baseline/backup.tar.gz
large_test_exit_code=0
./gradlew --stacktrace -Pinstrumented_test_size=large :app:connectedAndroidTest || large_test_exit_code=$?

adb pull /sdcard/seedvault_test_results

[ -n "$large_test_exit_code" ] && [ "$large_test_exit_code" -ne 0 ] && { echo 'Large tests failed.'; exit 1; }

medium_test_exit_code=0
./gradlew --stacktrace -Pinstrumented_test_size=medium :app:connectedAndroidTest || medium_test_exit_code=$?

adb pull /sdcard/seedvault_test_results

[ -n "$large_test_exit_code" ] && [ "$large_test_exit_code" -ne 0 ] && { echo 'Large test failed.'; exit 1; }
[ -n "$medium_test_exit_code" ] && [ "$medium_test_exit_code" -ne 0 ] && { echo 'Medium test failed.'; exit 1; }
[ -n "$medium_test_exit_code" ] && [ "$medium_test_exit_code" -ne 0 ] && { echo 'Medium tests failed.'; exit 1; }
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build
on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build
Expand Down
31 changes: 5 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,9 @@ jobs:
java-version: '17'
cache: 'gradle'

- name: AVD cache
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.emulator_type }}-${{ matrix.android_target }}

- name: Build Release APK
run: ./gradlew :app:assembleRelease

- name: Create AVD snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.android_target }}
target: ${{ matrix.emulator_type }}
arch: x86_64
force-avd-creation: false
emulator-options: -writable-system -no-snapshot-load -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
./app/development/scripts/provision_emulator.sh "test" "system-images;android-${{ matrix.android_target }};${{ matrix.emulator_type }};x86_64"
echo "Generated AVD snapshot for caching."
- name: Assemble tests
run: ./gradlew :app:assembleAndroidTest

Expand All @@ -74,15 +51,17 @@ jobs:
target: ${{ matrix.emulator_type }}
arch: x86_64
force-avd-creation: false
emulator-options: -writable-system -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-options: -writable-system -no-snapshot-load -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
profile: pixel_6a
heap-size: '512M'
ram-size: '4096M'
disk-size: '14G'
sdcard-path-or-size: '4096M'
cores: 2
cores: 3
disable-animations: true
script: ./.github/scripts/run_tests.sh
script: |
./app/development/scripts/provision_emulator.sh "test" "system-images;android-${{ matrix.android_target }};${{ matrix.emulator_type }};x86_64"
./.github/scripts/run_tests.sh
- name: Upload test results
if: always()
Expand Down

0 comments on commit 670f723

Please sign in to comment.