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 Sep 28, 2023
1 parent 741480f commit b8ff5f7
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 39 deletions.
79 changes: 41 additions & 38 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,20 @@ jobs:
~/.android/adb*
key: aosp-33

# - name: Seedvault test data cache
# uses: actions/cache@v3
# with:
# path: backup.tar.gz
# key: backup-1
- 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
Expand All @@ -58,8 +63,8 @@ jobs:
./app/development/scripts/provision_emulator.sh "test" "system-images;android-33;default;x86_64"
echo "Generated AVD snapshot for caching."
# - name: Assemble tests
# run: ./gradlew :app:assembleAndroidTest
- name: Assemble tests
run: ./gradlew :app:assembleAndroidTest

- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
Expand All @@ -74,39 +79,37 @@ jobs:
ram-size: '4096M'
disk-size: '14G'
sdcard-path-or-size: '4096M'
cores: 3
disable-animations: false
script: |
adb shell ls /sdcard
adb shell ls -a /sdcard/seedvault_baseline
# 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 1; fi
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 1; fi
- name: Upload screenshots and videos
if: always()
Expand Down
6 changes: 5 additions & 1 deletion app/development/scripts/provision_emulator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ sleep 5
$ADB shell bmgr transport com.stevesoltys.seedvault.transport.ConfigurableBackupTransport

echo "Downloading and extracting test backup to '/sdcard/seedvault_baseline'..."
wget --quiet https://github.com/seedvault-app/seedvault-test-data/releases/download/1/backup.tar.gz

if [ ! -f backup.tar.gz ]; then
echo "Downloading test backup..."
wget --quiet https://github.com/seedvault-app/seedvault-test-data/releases/download/1/backup.tar.gz
fi

$ADB root
sleep 3 # wait for adb to restart
Expand Down

0 comments on commit b8ff5f7

Please sign in to comment.