Skip to content

Instantly share code, notes, and snippets.

@sjchmiela
Created January 7, 2026 16:47
Show Gist options
  • Select an option

  • Save sjchmiela/aac9ef9a8499ba755d3dd90db1860b9b to your computer and use it in GitHub Desktop.

Select an option

Save sjchmiela/aac9ef9a8499ba755d3dd90db1860b9b to your computer and use it in GitHub Desktop.
name: Maestro Tests
on:
workflow_dispatch:
inputs:
build_id:
description: "ID of the build to run tests on"
type: string
required: true
flow_path:
description: "Path to a Maestro flow file or directory (string)"
type: string
required: true
shards:
description: "Number of shards to split the tests into"
type: number
required: false
retries:
description: "Number of times to retry failed tests"
type: number
required: false
record_screen:
description: "Whether to record the screen (may affect performance)"
type: boolean
required: false
default: false
include_tags:
description: "Tags to include (string or comma-separated list)"
type: string
required: false
exclude_tags:
description: "Tags to exclude (string or comma-separated list)"
type: string
required: false
maestro_version:
description: "Version of Maestro to use (defaults to latest)"
type: string
required: false
output_format:
description: "Maestro test report format (e.g., 'junit')"
type: string
required: false
android_system_image_package:
description: "Android Emulator system image package (x86_64), e.g. system-images;android-35;google_apis;x86_64"
type: string
required: false
device_identifier:
description: "Device identifier (e.g., 'pixel_6' or 'iPhone 16 Plus')"
type: string
required: false
skip_build_check:
description: "Skip validation of the build (e.g., iOS simulator check)"
type: boolean
required: false
reuse_devices:
description: "Reuse a single set of devices for all tests"
type: boolean
required: false
default: true
jobs:
maestro:
name: Run Maestro Tests
type: maestro
environment: preview
hooks:
before_maestro_tests:
- run: adb emu kill
name: Stop running emulators
# https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository
- name: Install Docker
run: |
set -x
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io --yes
- name: Start Cuttlefish
run: |
set -x
sudo docker pull us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-cloud-orchestrator:unstable
wget -O conf.toml https://artifactregistry.googleapis.com/download/v1/projects/android-cuttlefish-artifacts/locations/us/repositories/cloud-orchestrator-config/files/on-premise-single-server:unstable:conf.toml:download?alt=media
sudo docker run -d \
-p 8080:8080 \
-e CONFIG_FILE="/conf.toml" \
-v $PWD/conf.toml:/conf.toml \
-v /var/run/docker.sock:/var/run/docker.sock \
-t us-docker.pkg.dev/android-cuttlefish-artifacts/cuttlefish-orchestration/cuttlefish-cloud-orchestrator:unstable
- name: Install CVDR
run: |
set -x
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://us-apt.pkg.dev/doc/repo-signing-key.gpg -o /etc/apt/keyrings/android-cuttlefish-artifacts.asc
sudo chmod a+r /etc/apt/keyrings/android-cuttlefish-artifacts.asc
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/android-cuttlefish-artifacts.asc] \
https://us-apt.pkg.dev/projects/android-cuttlefish-artifacts android-cuttlefish-unstable main" | \
sudo tee /etc/apt/sources.list.d/android-cuttlefish-artifacts.list > /dev/null
sudo apt update
sudo apt install cuttlefish-cvdremote --yes
- name: Configure CVDR
run: |
mkdir -p ~/.config/cvdr
curl --output ~/.config/cvdr/cvdr.toml https://raw.githubusercontent.com/google/cloud-android-orchestration/refs/heads/main/scripts/on-premises/single-server/cvdr.toml
- name: Start Cuttlefish emulator
run: |
set -x
cvdr --branch=aosp-main --build_target=aosp_cf_x86_64_phone-trunk_staging-userdebug create
cvdr list
adb devices
adb shell input keyevent 82
- name: Install application on the Emulator
run: |
set -x
EMULATOR_SERIALS=$(adb devices -l | grep -v 'List of devices attached' | awk '{print $1}')
for SERIAL in $(printf '%s\n' $EMULATOR_SERIALS); do
echo "Installing app on emulator $SERIAL..."
adb -s $SERIAL install "${{ steps.prepare_application.outputs.artifact_path }}"
done
# - name: Start tmate
# run: |
# set -x
# sudo apt install tmate --yes
# tmate -F || true
# after_maestro_tests:
# - name: Start tmate
# if: ${{ always() }}
# run: |
# tmate -F || true
params:
build_id: ${{ inputs.build_id }}
flow_path: ${{ inputs.flow_path }}
# Note: integer/boolean params cannot be interpolated due to strict schema typing.
# To customize, set literals below or omit to use defaults.
# shards: 1 # optional - defaults to job's default
# retries: 1 # optional - defaults to job's default
record_screen: ${{ inputs.record_screen }} # optional - defaults to false
include_tags: ${{ inputs.include_tags }}
exclude_tags: ${{ inputs.exclude_tags }}
maestro_version: ${{ inputs.maestro_version }}
output_format: ${{ inputs.output_format }}
android_system_image_package: ${{ inputs.android_system_image_package }}
device_identifier: ${{ inputs.device_identifier }}
skip_build_check: false # optional - defaults to false
reuse_devices: true # optional - defaults to true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment