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: test:
name: Test on ${{ matrix.api }} name: Test on ${{ matrix.api }}
runs-on: macos-13 runs-on: ubuntu-latest
needs: build needs: build
strategy: strategy:
fail-fast: false fail-fast: false
@ -126,7 +126,11 @@ jobs:
name: ${{ github.sha }} name: ${{ github.sha }}
path: out path: out
- name: AVD test - name: Enable KVM group perms
run: | run: |
brew install coreutils bash echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
scripts/avd_test.sh ${{ matrix.api }} 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" 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' 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' 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 boot_timeout=600
emu_pid= emu_pid=
export PATH="$PATH:$ANDROID_SDK_ROOT/platform-tools"
# We test these API levels for the following reason # We test these API levels for the following reason
# API 23: legacy rootfs w/o Treble # API 23: legacy rootfs w/o Treble
@ -214,16 +215,7 @@ esac
yes | "$sdk" --licenses > /dev/null yes | "$sdk" --licenses > /dev/null
curl -L $lsposed_url -o out/lsposed.zip curl -L $lsposed_url -o out/lsposed.zip
"$sdk" --channel=3 tools platform-tools emulator
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
if [ -n "$1" ]; then if [ -n "$1" ]; then
run_test $1 run_test $1