46
46
asset_name : android-frida-interception-script-${{ github.ref }}.js
47
47
file : ./build/android-frida-interception-script.js
48
48
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."
0 commit comments