From 3733c9a091c497fcdf21604e0da5ec8529824a12 Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Tue, 25 Apr 2023 04:54:46 +0800 Subject: [PATCH] CI: add avd test --- .github/workflows/build.yml | 6 ++++++ scripts/avd_patch.sh | 4 ++-- scripts/avd_test.sh | 14 +++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index afefd0cfb..efedf082e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -106,3 +106,9 @@ jobs: with: name: ${{ github.sha }}-symbols path: app/build/outputs + + - name: AVD test + if: runner.os == 'macOS' + run: | + brew install coreutils + scripts/avd_test.sh diff --git a/scripts/avd_patch.sh b/scripts/avd_patch.sh index 579345395..2fa311a4a 100644 --- a/scripts/avd_patch.sh +++ b/scripts/avd_patch.sh @@ -52,7 +52,7 @@ done ./magiskboot decompress ramdisk.cpio.tmp ramdisk.cpio cp ramdisk.cpio ramdisk.cpio.orig -export KEEPVERITY=false +export KEEPVERITY=true export KEEPFORCEENCRYPT=true echo "KEEPVERITY=$KEEPVERITY" > config @@ -67,6 +67,7 @@ fi [ $API = "28" ] && echo 'RECOVERYMODE=true' >> config RANDOMSEED=$(tr -dc 'a-f0-9' < /dev/urandom | head -c 16) echo "RANDOMSEED=0x$RANDOMSEED" >> config +cat config ./magiskboot compress=xz magisk32 magisk32.xz ./magiskboot compress=xz magisk64 magisk64.xz @@ -86,4 +87,3 @@ echo "RANDOMSEED=0x$RANDOMSEED" >> config rm -f ramdisk.cpio.orig config magisk*.xz stub.xz ./magiskboot compress=gzip ramdisk.cpio ramdisk.cpio.gz -pm install magisk.apk || true diff --git a/scripts/avd_test.sh b/scripts/avd_test.sh index ec4c6db95..23db19198 100755 --- a/scripts/avd_test.sh +++ b/scripts/avd_test.sh @@ -3,7 +3,7 @@ emu="$ANDROID_SDK_ROOT/emulator/emulator" avd="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager" sdk="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" -emu_args='-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim' +emu_args='-no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -show-kernel' # Should be either 'google_apis' or 'default' type='google_apis' @@ -33,7 +33,7 @@ cleanup() { wait_for_boot() { while true; do - if [ -n "$(adb shell getprop sys.boot_completed)" ]; then + if [ "stopped" = "$(adb exec-out getprop init.svc.bootanim)" ]; then break fi sleep 2 @@ -68,7 +68,8 @@ run_test() { restore_avd "$emu" @test $emu_args & pid=$! - timeout 60 adb wait-for-device + timeout 180 bash -c wait_for_boot + ./build.py avd_patch -s "$ramdisk" kill -INT $pid wait $pid @@ -76,8 +77,7 @@ run_test() { # Test if it boots properly "$emu" @test $emu_args & pid=$! - timeout 60 adb wait-for-device - timeout 60 bash -c wait_for_boot + timeout 180 bash -c wait_for_boot adb shell magisk -v kill -INT $pid @@ -101,8 +101,8 @@ case $(uname -m) in ;; esac -# Build our executables -./build.py all +yes | "$sdk" --licenses +"$sdk" --channel=3 --update for api in $api_list; do set_api_env $api