Run tests in Cirrus CI again
This commit is contained in:
parent
3fd615477d
commit
4aeb05813d
5 changed files with 70 additions and 20 deletions
72
.cirrus.yml
72
.cirrus.yml
|
@ -1,13 +1,61 @@
|
||||||
task:
|
container:
|
||||||
name: Build with AOSP
|
image: ghcr.io/cirruslabs/android-sdk:34
|
||||||
only_if: $CIRRUS_PR_LABELS =~ ".*aosp-build.*"
|
kvm: true
|
||||||
timeout_in: 70m
|
cpu: 8
|
||||||
container:
|
memory: 16G
|
||||||
image: ubuntu:23.04
|
|
||||||
cpu: 8
|
instrumentation_tests_task:
|
||||||
memory: 32G
|
name: "Cirrus CI Instrumentation Tests"
|
||||||
build_script:
|
start_avd_background_script:
|
||||||
- ./.github/scripts/build_aosp.sh aosp_arm64 ap1a userdebug android-14.0.0_r29
|
sdkmanager --install "system-images;android-34;default;x86_64" "emulator";
|
||||||
|
echo no | avdmanager create avd -n seedvault -k "system-images;android-34;default;x86_64";
|
||||||
|
$ANDROID_HOME/emulator/emulator
|
||||||
|
-avd seedvault
|
||||||
|
-no-audio
|
||||||
|
-no-boot-anim
|
||||||
|
-gpu swiftshader_indirect
|
||||||
|
-no-snapshot
|
||||||
|
-no-window
|
||||||
|
-writable-system;
|
||||||
|
provision_avd_background_script:
|
||||||
|
wget https://github.com/seedvault-app/seedvault-test-data/releases/download/3/backup.tar.gz;
|
||||||
|
|
||||||
|
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;';
|
||||||
|
adb root;
|
||||||
|
sleep 5;
|
||||||
|
adb remount;
|
||||||
|
adb reboot;
|
||||||
|
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;';
|
||||||
|
adb root;
|
||||||
|
sleep 5;
|
||||||
|
adb remount;
|
||||||
|
sleep 5;
|
||||||
|
assemble_script:
|
||||||
|
./gradlew :app:assembleRelease :app:assembleAndroidTest
|
||||||
|
install_app_script:
|
||||||
|
timeout 180s bash -c 'while [[ -z $(adb shell mount | grep "/system " | grep "(rw,") ]]; do sleep 1; done;';
|
||||||
|
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;';
|
||||||
|
|
||||||
|
adb shell mkdir -p /sdcard/seedvault_baseline;
|
||||||
|
adb push backup.tar.gz /sdcard/seedvault_baseline/backup.tar.gz;
|
||||||
|
adb shell tar xzf /sdcard/seedvault_baseline/backup.tar.gz --directory=/sdcard/seedvault_baseline;
|
||||||
|
|
||||||
|
adb shell mkdir -p /system/priv-app/Seedvault;
|
||||||
|
adb push app/build/outputs/apk/release/app-release.apk /system/priv-app/Seedvault/Seedvault.apk;
|
||||||
|
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;
|
||||||
|
adb shell bmgr enable true;
|
||||||
|
adb reboot;
|
||||||
|
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;';
|
||||||
|
adb shell bmgr transport com.stevesoltys.seedvault.transport.ConfigurableBackupTransport;
|
||||||
|
adb reboot;
|
||||||
|
adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done;';
|
||||||
|
run_large_tests_script: ./gradlew -Pinstrumented_test_size=large :app:connectedAndroidTest
|
||||||
|
run_medium_tests_script: ./gradlew -Pinstrumented_test_size=medium :app:connectedAndroidTest
|
||||||
always:
|
always:
|
||||||
seedvault_artifacts:
|
pull_screenshots_script:
|
||||||
path: Seedvault.apk
|
adb pull /sdcard/seedvault_test_results
|
||||||
|
screenshots_artifacts:
|
||||||
|
path: "seedvault_test_results/**/*.mp4"
|
||||||
|
logcat_artifacts:
|
||||||
|
path: "seedvault_test_results/**/*.log"
|
||||||
|
|
|
@ -49,14 +49,14 @@ internal interface LargeTestBase : KoinComponent {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val TEST_STORAGE_FOLDER = "seedvault_test"
|
private const val TEST_STORAGE_FOLDER = "seedvault_test"
|
||||||
private const val TEST_VIDEO_FOLDER = "seedvault_test_results"
|
private const val TEST_RESULT_FOLDER = "seedvault_test_results"
|
||||||
}
|
}
|
||||||
|
|
||||||
val externalStorageDir: String get() = Environment.getExternalStorageDirectory().absolutePath
|
val externalStorageDir: String get() = Environment.getExternalStorageDirectory().absolutePath
|
||||||
|
|
||||||
val testStoragePath get() = "$externalStorageDir/$TEST_STORAGE_FOLDER"
|
val testStoragePath get() = "$externalStorageDir/$TEST_STORAGE_FOLDER"
|
||||||
|
|
||||||
val testVideoPath get() = "$externalStorageDir/$TEST_VIDEO_FOLDER"
|
val testResultPath get() = "$externalStorageDir/$TEST_RESULT_FOLDER"
|
||||||
|
|
||||||
val targetContext: Context
|
val targetContext: Context
|
||||||
get() = InstrumentationRegistry.getInstrumentation().targetContext
|
get() = InstrumentationRegistry.getInstrumentation().targetContext
|
||||||
|
@ -123,7 +123,7 @@ internal interface LargeTestBase : KoinComponent {
|
||||||
keepRecordingScreen: AtomicBoolean,
|
keepRecordingScreen: AtomicBoolean,
|
||||||
testName: String,
|
testName: String,
|
||||||
) {
|
) {
|
||||||
val folder = testVideoPath
|
val folder = testResultPath
|
||||||
runCommand("mkdir -p $folder")
|
runCommand("mkdir -p $folder")
|
||||||
|
|
||||||
val fileName = testResultFilename(testName)
|
val fileName = testResultFilename(testName)
|
||||||
|
@ -149,7 +149,7 @@ internal interface LargeTestBase : KoinComponent {
|
||||||
|
|
||||||
// write logcat to file
|
// write logcat to file
|
||||||
val fileName = testResultFilename(testName)
|
val fileName = testResultFilename(testName)
|
||||||
runCommand("logcat -d -f $testVideoPath/$fileName.log")
|
runCommand("logcat -d -f $testResultPath/$fileName.log")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun uninstallPackages(packages: Collection<PackageInfo>) {
|
fun uninstallPackages(packages: Collection<PackageInfo>) {
|
||||||
|
@ -162,7 +162,7 @@ internal interface LargeTestBase : KoinComponent {
|
||||||
|
|
||||||
fun clearTestBackups() {
|
fun clearTestBackups() {
|
||||||
File(testStoragePath).deleteRecursively()
|
File(testStoragePath).deleteRecursively()
|
||||||
File(testVideoPath).deleteRecursively()
|
File(testResultPath).deleteRecursively()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun changeBackupLocation(
|
fun changeBackupLocation(
|
||||||
|
@ -225,6 +225,7 @@ internal interface LargeTestBase : KoinComponent {
|
||||||
|
|
||||||
fun confirmCode() {
|
fun confirmCode() {
|
||||||
RecoveryCodeScreen {
|
RecoveryCodeScreen {
|
||||||
|
startNewBackupButton.click()
|
||||||
confirmCodeButton.click()
|
confirmCodeButton.click()
|
||||||
|
|
||||||
verifyCodeButton.scrollTo().click()
|
verifyCodeButton.scrollTo().click()
|
||||||
|
|
|
@ -45,9 +45,8 @@ internal abstract class SeedvaultLargeTest :
|
||||||
clearTestBackups()
|
clearTestBackups()
|
||||||
|
|
||||||
runCommand("bmgr enable true")
|
runCommand("bmgr enable true")
|
||||||
sleep(60_000)
|
|
||||||
runCommand("bmgr transport com.stevesoltys.seedvault.transport.ConfigurableBackupTransport")
|
runCommand("bmgr transport com.stevesoltys.seedvault.transport.ConfigurableBackupTransport")
|
||||||
sleep(60_000)
|
sleep(5000)
|
||||||
|
|
||||||
startRecordingTest(keepRecordingScreen, name.methodName)
|
startRecordingTest(keepRecordingScreen, name.methodName)
|
||||||
restoreBaselineBackup()
|
restoreBaselineBackup()
|
||||||
|
|
|
@ -24,7 +24,7 @@ object BackupScreen : UiDeviceScreen<BackupScreen>() {
|
||||||
|
|
||||||
val internalStorageButton = findObject { textContains(Build.MODEL) }
|
val internalStorageButton = findObject { textContains(Build.MODEL) }
|
||||||
|
|
||||||
val useAnywayButton = findObject { text("USE ANYWAY") }
|
val useAnywayButton = findObject { text("Use anyway") }
|
||||||
|
|
||||||
val initializingText: BySelector = By.textContains("Initializing backup location")
|
val initializingText: BySelector = By.textContains("Initializing backup location")
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import com.stevesoltys.seedvault.e2e.screen.UiDeviceScreen
|
||||||
|
|
||||||
object RecoveryCodeScreen : UiDeviceScreen<RecoveryCodeScreen>() {
|
object RecoveryCodeScreen : UiDeviceScreen<RecoveryCodeScreen>() {
|
||||||
|
|
||||||
|
val startNewBackupButton = findObject { text("Start new") }
|
||||||
|
|
||||||
val confirmCodeButton = findObject { text("Confirm code") }
|
val confirmCodeButton = findObject { text("Confirm code") }
|
||||||
|
|
||||||
val verifyCodeButton = findObject { text("Verify") }
|
val verifyCodeButton = findObject { text("Verify") }
|
||||||
|
|
Loading…
Reference in a new issue