Skip to content

Commit 7281147

Browse files
committed
Merge branch 'automated-tests'
2 parents a07671f + bb0356a commit 7281147

File tree

6 files changed

+13681
-1
lines changed

6 files changed

+13681
-1
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,72 @@ jobs:
4646
asset_name: android-frida-interception-script-${{ github.ref }}.js
4747
file: ./build/android-frida-interception-script.js
4848
tag: ${{ github.ref }}
49-
repo_token: ${{ secrets.GITHUB_TOKEN }}
49+
repo_token: ${{ secrets.GITHUB_TOKEN }}
50+
51+
test-android:
52+
name: Test on Android emulator
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
api-level: [30]
57+
steps:
58+
- uses: actions/checkout@v4
59+
60+
- name: Set up Python
61+
uses: actions/setup-python@v5
62+
with:
63+
python-version: '3.11'
64+
65+
- name: Set up Node.js
66+
uses: actions/setup-node@v4
67+
with:
68+
node-version: '24'
69+
cache: 'npm'
70+
cache-dependency-path: 'test/android/package-lock.json'
71+
72+
- name: Install Frida CLI
73+
run: |
74+
pip install --user frida-tools
75+
echo "$HOME/.local/bin" >> $GITHUB_PATH
76+
77+
# Apparently significantly improves emulator performance:
78+
- name: Enable KVM
79+
run: |
80+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
81+
sudo udevadm control --reload-rules
82+
sudo udevadm trigger --name-match=kvm
83+
84+
# Cache the emulator AVD:
85+
- name: AVD cache
86+
uses: actions/cache@v4
87+
id: avd-cache
88+
with:
89+
path: |
90+
~/.android/avd/*
91+
~/.android/adb*
92+
key: avd-${{ matrix.api-level }}
93+
94+
- name: Create AVD and cache snapshot
95+
if: steps.avd-cache.outputs.cache-hit != 'true'
96+
uses: reactivecircus/android-emulator-runner@v2
97+
with:
98+
api-level: ${{ matrix.api-level }}
99+
target: google_apis
100+
force-avd-creation: false
101+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
102+
script: |
103+
echo "Generated AVD snapshot for caching."
104+
105+
- name: Run tests
106+
uses: reactivecircus/android-emulator-runner@v2
107+
with:
108+
api-level: ${{ matrix.api-level }}
109+
target: google_apis
110+
force-avd-creation: false
111+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
112+
script: |
113+
adb devices
114+
./test/android/setup-emulator.sh
115+
echo "Emulator ready to test"
116+
cd test/android && npm install && npm test
117+
echo "Tests completed."

test/android/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
tmp/

0 commit comments

Comments
 (0)