Run tests on Linux

This commit is contained in:
topjohnwu 2024-01-22 18:10:26 -08:00
parent 86e0020964
commit b44141ae39
2 changed files with 11 additions and 15 deletions

View File

@ -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 }}

View File

@ -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