Files
frida-interception-and-unpi…/.github/workflows/ci.yml
T
Tim Perry 7722e20adc Use a large screen test device in CI
Previously not all buttons were being detected by Appium - I strongly
suspect that's becuase the default profile is some tiny phone.

Also added another API test level (just to confirm) and switched arch
because it turns out modern API levels don't support x86, only _64.
2025-07-04 10:02:41 +02:00

121 lines
4.0 KiB
YAML

name: CI
on: [push, pull_request]
jobs:
build:
name: Build & test
runs-on: ubuntu-latest
container:
image: httptoolkit/act-build-base:v3.0.0
steps:
- uses: actions/checkout@v4
- name: Build a single-file Android script
run: |
mkdir -p ./build/
paste -sd'\n' ./config.js \
./native-connect-hook.js \
./native-tls-hook.js \
./android/android-proxy-override.js \
./android/android-system-certificate-injection.js \
./android/android-certificate-unpinning.js \
./android/android-certificate-unpinning-fallback.js \
./android/android-disable-root-detection.js \
> ./build/android-frida-interception-script.js
- uses: actions/upload-artifact@v4
with:
name: android-frida-interception-script.js
path: ./build/android-frida-interception-script.js
if-no-files-found: error
- name: Publish the combined script to GitHub Releases
uses: svenstaro/upload-release-action@v2
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
body: |
The pre-combined scripts for the ${{ github.ref_name }} release.
This contains the same content as the repo, but pre-combined into a single
script for convenient usage.
This script still requires configuration: you'll need to provide the
`CERT_PEM` and typically `PROXY_HOST` and `PROXY_PORT` variables in the
first section of the file.
asset_name: android-frida-interception-script-${{ github.ref }}.js
file: ./build/android-frida-interception-script.js
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
test-android:
name: Test on Android emulator
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [30, 34]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: 'test/android/package-lock.json'
- 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
profile: pixel_c
arch: x86_64
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
profile: pixel_c
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
script: |
adb devices
./test/android/setup-emulator.sh
echo "Emulator ready to test"
cd test/android && npm install && npm test
echo "Tests completed."