Skip to content

Commit

Permalink
Switch to GitHub actions for E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stevesoltys committed Oct 7, 2023
1 parent 71f9751 commit 40b736b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
File renamed without changes.
26 changes: 17 additions & 9 deletions .github/workflows/e2e.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run end-to-end tests
name: Run instrumented tests

on:
push:
Expand All @@ -11,15 +11,19 @@ on:
- '**/*.properties'
- '**/*.kt'
- '**/*.xml'
- '.github/workflows/e2e.yml'
- '.github/workflows/test.yml'

jobs:
instrumentation_tests:
runs-on: macos-11
strategy:
fail-fast: false
matrix:
android_target: [33, 34]
emulator_type: [default, google_apis]
exclude:
- android_target: 34
emulator_type: default
steps:
- name: Checkout Code
uses: actions/checkout@v3
Expand All @@ -37,7 +41,7 @@ jobs:
path: |
~/.android/avd/*
~/.android/adb*
key: aosp-${{ matrix.emulator_type }}-33
key: aosp-${{ matrix.emulator_type }}-${{ matrix.android_target }}-${{ runner.os }}

- name: Build Release APK
run: ./gradlew :app:assembleRelease
Expand All @@ -46,14 +50,14 @@ jobs:
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
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-33;${{ matrix.emulator_type }};x86_64"
./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
Expand All @@ -62,7 +66,7 @@ jobs:
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
api-level: ${{ matrix.android_target }}
target: ${{ matrix.emulator_type }}
arch: x86_64
force-avd-creation: false
Expand Down Expand Up @@ -98,12 +102,16 @@ jobs:
adb shell tar xzf /sdcard/seedvault_baseline/backup.tar.gz --directory=/sdcard/seedvault_baseline
adb shell rm /sdcard/seedvault_baseline/backup.tar.gz
gradle_exit_code=0
./gradlew --stacktrace -Pinstrumented_test_size=large :app:connectedAndroidTest || gradle_exit_code=$?
large_test_exit_code=0
./gradlew --stacktrace -Pinstrumented_test_size=large :app:connectedAndroidTest || large_test_exit_code=$?
medium_test_exit_code=0
./gradlew --stacktrace -Pinstrumented_test_size=medium :app:connectedAndroidTest || medium_test_exit_code=$?
adb pull /sdcard/seedvault_test_videos
if [ $gradle_exit_code -ne 0 ]; then echo 'Gradle test failed.'; exit 0; fi
if [ $large_test_exit_code -ne 0 ]; then echo 'Gradle test failed.'; exit 0; fi
if [ $medium_test_exit_code -ne 0 ]; then echo 'Gradle test failed.'; exit 0; fi
- name: Upload screenshots and videos
if: always()
Expand Down
2 changes: 1 addition & 1 deletion app/development/DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ This task depends on `app:assembleRelease` and runs the script in `scripts/insta
./app/development/scripts/install_app.sh
```

There's also an Andriod Studio [runtime configuration](https://developer.android.com/studio/run/rundebugconfig) `app-emulator` which will build, install, and automatically launch the `com.stevesoltys.seedvault.settings.SettingsActivity` as if you clicked `Backup` in settings.
There's also an Android Studio [runtime configuration](https://developer.android.com/studio/run/rundebugconfig) `app-emulator` which will build, install, and automatically launch the `com.stevesoltys.seedvault.settings.SettingsActivity` as if you clicked `Backup` in settings.

### Notes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ internal interface LargeRestoreTestBase : LargeTestBase {
val restoreResultValue = spyRestoreViewModel.installResult.value
?: error("Restore APKs timed out")

// TODO: Fix this, with current test an app or two breaks on install with AOSP image.
// Just need to update the test data to work with the AOSP image.
// assert(!restoreResultValue.hasFailed) { "Failed to install packages" }
}

Expand Down

0 comments on commit 40b736b

Please sign in to comment.