Run Appium tests in GitHub Actions without an emulator
To run Appium tests in GitHub Actions without an emulator, upload the APK to a hosted Android device and point your suite at its WebDriver URL. The Spawndroid Action does the upload, waits for the device, runs your test command with the endpoint in the environment, and tears the device down.
At a glance
- Workflow change
- One step: spawndroid/cli@v0.3.1 with your API key
- Test code change
- Read the WebDriver URL from SPAWNDROID_WD_URL
- Device
- Android 12 to 16 on ARM64, Appium 3 with UiAutomator2
- Free tier
- 200 device-minutes a month, 1 runner, no card
Summary
- Remove the emulator step. Add spawndroid/cli@v0.3.1 and pass your test command.
- Your suite connects to the URL in SPAWNDROID_WD_URL. The APK is already installed, so drop appium:app.
- The device boots on Spawndroid's ARM64 hosts. Your runner needs no KVM, no system image and no AVD.
- Exit code 0 means tests passed, 1 means tests failed, 2 means setup or infrastructure failed.
- Limits: Android only, Appium and WebDriver suites only, no adb access from the test.
The workflow
Create an API key with the upload scope under API & CI/CD, API keys, and save it as the repository secret SPAWNDROID_API_KEY. Then run npx spawndroid init once in the repository. It reads your Gradle, Maven, WebdriverIO or pytest setup and writes spawndroid.yaml, which names the APK, the test command and where the JUnit report lands.
name: Android UI tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- run: ./gradlew assembleDebug
- uses: spawndroid/cli@v0.3.1
id: spawndroid
with:
api-key: ${{ secrets.SPAWNDROID_API_KEY }}
- if: always()
run: echo "Run: ${{ steps.spawndroid.outputs.run-url }}"The Action runs spawndroid run --config spawndroid.yaml. That uploads the APK, starts a session, waits for the device, runs your command, attaches the JUnit report, and tears the device down even when the job fails. The run URL is a step output, so the last step prints a link to the run page with the result, logcat and recording.

If you would rather not commit a spec, pass the APK and the command as inputs instead:
- uses: spawndroid/cli@v0.3.1
with:
api-key: ${{ secrets.SPAWNDROID_API_KEY }}
app: app/build/outputs/apk/debug/app-debug.apk
command: npx wdio run wdio.conf.mjsWhat changes in your tests
One thing: the address of the Appium server. Your command runs on the GitHub runner with these variables set.
| Variable | Value |
|---|---|
| SPAWNDROID_WD_URL | W3C WebDriver endpoint for this session |
| SPAWNDROID_UDID | Device serial |
| SPAWNDROID_APP_PACKAGE | Package name of the installed app |
| SPAWNDROID_APP | App slug in your workspace |
| SPAWNDROID_SESSION_ID | Session id, for the API |
In WebdriverIO, build the connection from the URL and set the package so Appium can launch the app:
// wdio.conf.mjs
const wd = new URL(process.env.SPAWNDROID_WD_URL)
export const config = {
protocol: wd.protocol.replace(":", ""),
hostname: wd.hostname,
port: Number(wd.port || (wd.protocol === "https:" ? 443 : 80)),
path: wd.pathname,
capabilities: [{
platformName: "Android",
"appium:automationName": "UiAutomator2",
"appium:udid": process.env.SPAWNDROID_UDID,
"appium:appPackage": process.env.SPAWNDROID_APP_PACKAGE,
"appium:noReset": true,
}],
// specs, framework and reporters stay as they are
}Do not set appium:app. The build is installed before your command starts, and uploading it again from the runner would only add time. The Python, Java and Robot Framework examples in the CLI repository follow the same pattern.
Why the emulator is the slow part on CI
The usual way to get a device on GitHub Actions is ReactiveCircus/android-emulator-runner. It works, and its README is honest about what it needs. On Linux runners you first add a step that opens /dev/kvm to the runner user with a udev rule, because the emulator relies on hardware acceleration to be usable. The README recommends Ubuntu runners and says they are 2 to 3 times faster than the macOS ones.
Then every job pays for the same setup again. The runner downloads or restores a system image, creates an AVD, cold boots it, and waits for boot to complete. The Action's default emulator-boot-timeout is 600 seconds, and its default options render with swiftshader_indirect, a software GPU. Teams add snapshot caching to shorten the boot, which is more YAML to maintain and another cache to invalidate.
The flakiness usually comes from the same place. A cold-booted emulator on a shared VM is still starting system services when the first test runs, so the first test times out, an animation is still running, or the package manager is busy. The Action disables animations by default and its examples turn off the boot animation, which helps, but none of this is about your app.
There is also the instruction set. The Action's default arch is x86, the README recommends the x86 and x86_64 images, and it notes that arm64-v8a images are limited to fewer API levels. Phones are ARM64. If your APK ships native libraries, the x86 emulator runs the x86 build of them, so a crash that only happens in your arm64-v8a code does not show up.
Before and after
| android-emulator-runner | Spawndroid Action | |
|---|---|---|
| Workflow steps for the device | Enable KVM, cache AVD, boot emulator, run script inside the action | One step with your API key |
| Where Android runs | On the GitHub runner, in an emulator (x86 by default) | On Spawndroid's ARM64 hosts, as a container |
| Native arm64 libraries | The x86 or x86_64 build of them runs instead | Run natively |
| Runner requirements | KVM access, disk for the system image | Node 20 or newer, which the Action sets up |
| Test framework | Anything, adb available | Appium or WebDriver only, no adb |
| Artifacts | Whatever you upload yourself | Run page with result, JUnit, logcat and recording |
| Cost | GitHub runner minutes while the emulator boots and runs | Runner minutes while waiting, plus device-minutes from device-ready to teardown |
android-emulator-runner facts are from its README, linked below. GitHub runner minutes still tick while the Spawndroid Action waits for the device; device boot itself is not billed as device-minutes.
What a run costs
A device-minute is one minute of a running device, measured from device-ready to teardown. Provisioning and boot are not counted, and a boot that fails is free. A suite that keeps the device for 6 minutes uses 6 device-minutes.
| Plan | Price | Parallel runners | Device-minutes a month |
|---|---|---|---|
| Hobby | Free, no card | 1 | 200, then stops |
| Indie | $5 a month | 1 | 350, then stops |
| Personal | $19 a month | 2 | 2,500, then $0.015 a minute up to $25 |
| Team | $99 a month | 5 | 10,000, then $0.01 a minute up to $250 |
A second session beyond your runner limit is refused with HTTP 429; there is no queue. Pass wait-for-runner to the Action to retry until a runner frees up.
Exit codes and retries
spawndroid run exits 0 when tests pass, 1 when tests fail and 2 when setup or infrastructure failed. Retry on 2 if you want, and never on 1: a real test failure should stay a failure. A capacity 429 is retried up to 3 times over about 90 seconds before the CLI gives up; plan limits fail immediately with the session that holds the runner.
Limits
- Android 12 to 16 only. There is no iOS.
- Appium and W3C WebDriver suites only. Espresso and other instrumented tests that need adb do not run here.
- One APK per session. Split APKs are not supported; use a universal APK.
- The APK needs arm64-v8a libraries if it has native code. An x86-only build fails to install.
- Pull requests from forks get no secrets on GitHub, so the Action notes that in the job summary and passes.
If you only want to know whether each pull request's build opens without crashing, you do not need a test suite at all. The same Action has a smoke mode, covered in the guide to testing every pull request.
Frequently asked questions
No. The device runs on Spawndroid's servers, so a standard ubuntu-latest runner works. The runner only builds the APK and runs your test command.
Yes. Point the client at SPAWNDROID_WD_URL, set appium:udid and appium:appPackage from the environment, and remove appium:app. Everything else stays.
Appium 3 with the UiAutomator2 8.x driver, pinned in the image so a rebuild cannot move your pipeline to a new major version.
No. Sessions expose a WebDriver endpoint, not adb, so instrumented tests such as Espresso do not run. Keep those on an emulator or a device farm.
Use a GitHub Actions matrix over the profile input, for example android-13-phone and android-15-phone. Each leg uses a runner, so your plan's parallel runners set how many run at once.
Keep reading
Start free
Run your suite without the emulator step.
Create a workspace, add the API key as a secret, and add one step. Hobby includes 200 device-minutes a month and needs no card.