Getting Started

Get SAIR running in your CI pipeline in under 15 minutes.

How it works

SAIR has three components: the Orchestrator (hosted by us), the Proxy and DeviceSource (run on your infrastructure). DeviceSource runs on the machine with USB devices; the Proxy can run on the same host or elsewhere on your network. All CI runners share the same Proxy. Your CI pipeline calls sair-acquire to lock a device, runs tests with stock adb, and calls sair-release when done.

1

Set up Proxy and DeviceSource

DeviceSource must run on the machine with USB-connected devices. The Proxy can run on the same host or any reachable machine on your network. DeviceSource discovers devices and pushes them to the Proxy, which coordinates locks with the Orchestrator. All your CI runners share the same Proxy.

# Install SAIR tools
curl -fsSL https://raw.githubusercontent.com/compscidr/sair/main/install.sh | bash

# Start a dedicated ADB server on a non-default port
adb kill-server
adb -P 5038 start-server

# Start the Proxy and DeviceSource
export SAIR_API_KEY="your-api-key"
sair-proxy &
sair-device-source
2

Install SAIR tools in CI

The sair-acquire and sair-release tools are installed globally via the install script. Add this step to your CI workflow.

curl -fsSL https://raw.githubusercontent.com/compscidr/sair/main/install.sh | bash
3

Update your CI workflow

Add device acquisition around your existing test step. Your connectedCheck command stays exactly the same.

# .github/workflows/test.yml
steps:
  # ... your build steps ...

  - name: Install SAIR tools
    run: curl -fsSL https://raw.githubusercontent.com/compscidr/sair/main/install.sh | bash

  - name: Acquire device lock
    run: sair-acquire | sed 's/^export //' >> $GITHUB_ENV

  - name: Run instrumented tests
    run: ./gradlew connectedCheck

  - name: Release device lock
    if: always() && env.SAIR_LOCK_ID != ''
    run: sair-release

Environment variables

Variable Description Default
SAIR_API_KEY Your API key for authentication dev-key-123
SAIR_PROXY_URL ADB Proxy HTTP API endpoint http://localhost:8550

What sair-acquire exports

After a successful acquisition, these environment variables are set:

Variable Description
SAIR_LOCK_ID Lock identifier (used by sair-release)
SAIR_SERIALS Comma-separated list of acquired device serials
ANDROID_ADB_SERVER_PORT Scoped ADB port (stock adb reads this automatically)
ANDROID_SERIAL First serial (only set when a single device is acquired)