Mobile App Testing with Maestro in GitHub Actions
Scale your mobile testing workflow with parallel test execution. Perfect for teams that need fast, reliable mobile testing tools without concurrency limits.
You can use remote Android instances in your GitHub Actions workflows as targets for your Maestro tests. Thanks to no-charge for concurrency, you can utilize Maestro’s sharding capabilities to reduce your test time to the longest individual test!
Acquire an organization token
- Go to
Settings
in Limbar Console. - Choose
API Tokens
in the left sidebar. - Click
Create Token
to create a new token. - Copy the token and save it in Github Secrets as
LIM_TOKEN
.
Use limbario/run-android
action
Here is an example invocation of the limbario/run-android
action that spins up 10 Android instances in seconds and makes them available to access
through adb
.
- name: Run Android instance
uses: limbario/run-android@v0.4.3
with:
token: ${{ secrets.LIM_TOKEN }}
count: 10
Full YAML
The following is an example YAML that tells Maestro tu distribute the tests to all targets evenly.
name: Run Android Tests
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
name: End-to-End tests
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "adopt"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Assemble the project
run: ./gradlew assembleInternalDebug -Pforce-default-variant
- name: Obtain debug apk
run: cp $(find . -regex '.*outputs/apk/.*internal-debug.apk') app.apk
- name: Upload debug apk
uses: actions/upload-artifact@v4
with:
name: app
path: app.apk
if-no-files-found: error
test:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Maestro CLI
uses: dniHze/maestro-test-action@v1
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: app
path: apk/
- name: Start Limbar Android Instance
uses: limbario/run-android@v0.4.3
with:
token: ${{ secrets.LIMBAR_TOKEN }}
count: 10
- name: Install APK
run: |
#!/bin/bash
# Get all connected devices
devices=$(adb devices | grep -v "List" | grep "localhost" | cut -f1)
# Install APK on each device in parallel
for device in $devices; do
(
echo "Installing on device: $device"
adb -s $device install apk/app.apk
) &
done
# Wait for all parallel installations to complete
wait
echo "Installation completed on all devices"
- name: Run Tests
run: |
maestro test .maestro --shard-split=20
Watch while the tests run
You can also watch the device while the test is running for debugging purposes.
In the logs, you will find the randomly generated name for your Android instance. Run the following command to watch the device:
lim connect android <instance-name> --region <region>
You should see success logs like the following and a window popping up:
$ lim connect android 1vnb5vxb1b
✓ Checking your token 📜
✓ Fetching instance information
✓ Tunnel is ready for adb at localhost:34579 🚇
⠹ Ready to control the device 🕹️
Alternatively, you can go to Limbar Console , find
your Android instance, and click Connect
to get the full command you need to connect.
Clicking connect shows you the lim connect
command you can use to stream the emulator instance: