-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to GitHub actions for E2E tests
- Loading branch information
1 parent
2bbeece
commit a3b8b1b
Showing
14 changed files
with
265 additions
and
81 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
name: Run end-to-end tests | ||
|
||
on: | ||
push: | ||
paths: | ||
- '*.gradle' | ||
- '*.gradle.kts' | ||
- '**/*.gradle' | ||
- '**/*.gradle.kts' | ||
- '*.properties' | ||
- '**/*.properties' | ||
- '**/*.kt' | ||
- '**/*.xml' | ||
- '.github/workflows/e2e.yml' | ||
|
||
jobs: | ||
instrumentation_tests: | ||
runs-on: macos-11 | ||
strategy: | ||
matrix: | ||
emulator_type: [default, google_apis] | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
cache: 'gradle' | ||
|
||
- name: AVD cache | ||
uses: actions/cache@v3 | ||
id: avd-cache | ||
with: | ||
path: | | ||
~/.android/avd/* | ||
~/.android/adb* | ||
key: aosp-${{ matrix.emulator_type }}-33 | ||
|
||
- name: Test data cache | ||
uses: actions/cache@v3 | ||
id: test-data-cache | ||
with: | ||
path: backup.tar.gz | ||
key: test-data-1 | ||
|
||
- name: Build Release APK | ||
run: ./gradlew :app:assembleRelease | ||
|
||
- name: Download test data | ||
if: steps.test-data-cache.outputs.cache-hit != 'true' | ||
run: wget --quiet https://github.com/seedvault-app/seedvault-test-data/releases/download/1/backup.tar.gz | ||
|
||
- name: Create AVD snapshot | ||
if: steps.avd-cache.outputs.cache-hit != 'true' | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 33 | ||
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" | ||
echo "Generated AVD snapshot for caching." | ||
- name: Assemble tests | ||
run: ./gradlew :app:assembleAndroidTest | ||
|
||
- name: Run tests | ||
uses: reactivecircus/android-emulator-runner@v2 | ||
with: | ||
api-level: 33 | ||
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 | ||
profile: pixel_6a | ||
heap-size: '512M' | ||
ram-size: '4096M' | ||
disk-size: '14G' | ||
sdcard-path-or-size: '4096M' | ||
cores: 3 | ||
disable-animations: false | ||
script: | | ||
adb root | ||
sleep 5 | ||
adb remount | ||
echo "Installing Seedvault app..." | ||
adb shell mkdir -p /system/priv-app/Seedvault | ||
adb push app/build/outputs/apk/release/app-release.apk /system/priv-app/Seedvault/Seedvault.apk | ||
echo "Installing Seedvault permissions..." | ||
adb push permissions_com.stevesoltys.seedvault.xml /system/etc/permissions/privapp-permissions-seedvault.xml | ||
adb push allowlist_com.stevesoltys.seedvault.xml /system/etc/sysconfig/allowlist-seedvault.xml | ||
echo "Setting Seedvault transport..." | ||
sleep 10 | ||
adb shell bmgr transport com.stevesoltys.seedvault.transport.ConfigurableBackupTransport | ||
adb shell mkdir -p /sdcard/seedvault_baseline | ||
adb push backup.tar.gz /sdcard/seedvault_baseline | ||
adb wait-for-device | ||
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=$? | ||
adb pull /sdcard/seedvault_test_videos | ||
if [ $gradle_exit_code -ne 0 ]; then echo 'Gradle test failed.'; exit 0; fi | ||
- name: Upload screenshots and videos | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: seedvault_test_videos | ||
path: seedvault_test_videos/**/*.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.