From b44141ae393393dac4b5f0ebc842baf6066ccf3d Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Mon, 22 Jan 2024 18:10:26 -0800 Subject: [PATCH] Run tests on Linux --- .github/workflows/build.yml | 12 ++++++++---- scripts/avd_test.sh | 14 +++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0ed551c7f..fa061c4e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,7 +102,7 @@ jobs: test: name: Test on ${{ matrix.api }} - runs-on: macos-13 + runs-on: ubuntu-latest needs: build strategy: fail-fast: false @@ -126,7 +126,11 @@ jobs: name: ${{ github.sha }} path: out - - name: AVD test + - name: Enable KVM group perms run: | - brew install coreutils bash - scripts/avd_test.sh ${{ matrix.api }} + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules + sudo udevadm control --reload-rules + sudo udevadm trigger --name-match=kvm + + - name: AVD test + run: scripts/avd_test.sh ${{ matrix.api }} diff --git a/scripts/avd_test.sh b/scripts/avd_test.sh index c2fcaaf59..6a00efc42 100755 --- a/scripts/avd_test.sh +++ b/scripts/avd_test.sh @@ -5,10 +5,11 @@ avd="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/avdmanager" sdk="$ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager" emu_args='-no-window -no-audio -no-boot-anim -gpu swiftshader_indirect -read-only -no-snapshot -show-kernel -memory 8192' lsposed_url='https://github.com/LSPosed/LSPosed/releases/download/v1.9.2/LSPosed-v1.9.2-7024-zygisk-release.zip' -emu_url='https://github.com/topjohnwu/magisk-files/releases/download/files/emulator-darwin-x86-34.2.1.zip' boot_timeout=600 emu_pid= +export PATH="$PATH:$ANDROID_SDK_ROOT/platform-tools" + # We test these API levels for the following reason # API 23: legacy rootfs w/o Treble @@ -214,16 +215,7 @@ esac yes | "$sdk" --licenses > /dev/null curl -L $lsposed_url -o out/lsposed.zip - -if [ -n "$GITHUB_ACTIONS" ]; then - # Download the specially built emulator to run on GitHub action runners - curl -L $emu_url -o emulator.zip - unzip emulator.zip - emu='./emulator/emulator' -else - # Directly use the official emulator - "$sdk" --channel=3 emulator -fi +"$sdk" --channel=3 tools platform-tools emulator if [ -n "$1" ]; then run_test $1