Try setting up an emulator in CI

This commit is contained in:
Tim Perry
2025-07-03 20:26:39 +02:00
committed by Tim Perry
parent a07671fbe9
commit 8902cfd399
2 changed files with 108 additions and 1 deletions
+61 -1
View File
@@ -46,4 +46,64 @@ jobs:
asset_name: android-frida-interception-script-${{ github.ref }}.js
file: ./build/android-frida-interception-script.js
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
test-android:
name: Test on Android emulator
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [30]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Frida CLI
run: |
pip install --user frida-tools
echo "$HOME/.local/bin" >> $GITHUB_PATH
# Apparently significantly improves emulator performance:
- name: Enable KVM
run: |
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
# Cache the emulator AVD:
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- name: Create AVD and cache snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: |
echo "Generated AVD snapshot for caching."
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: google_apis
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: |
adb devices
bash test/android/setup-emulator.sh
echo "Emulator ready to test"
adb shell pgrep -f frida-server