Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding action and workflow #31

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/actions/maestro/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: 'run-maestro'
description: 'draft'

inputs:
apk-path:
description: 'Path to the APK'
required: true
command:
description: 'Command to run on maestro (e.g. maestro {command})'
required: true
test-name:
description: 'Name of the maestro test. The report will have this name.'
required: false
default: 'maestro-test'
bit-rate:
description: 'Bit rate for the screenrecord command'
required: false
default: '3000000'
video-res:
description: 'Resolution of the recorded video'
required: false
default: '360x780'

runs:
using: "composite"
steps:
- name: Install Maestro
shell: bash
run: |
curl -fsSL "https://get.maestro.mobile.dev" | bash
export PATH="$PATH":"$HOME/.maestro/bin"
maestro --version

#todo: disable this step on mac machines
- name: Enable KVM
shell: bash
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

- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 31
profile: pixel_6_pro
ram-size: 8000M
heap-size: 600M
arch: x86_64
disable-animations: true
target: playstore
script: |
#!/bin/bash

adb install ${{ inputs.apk-path }}

# Start screen recording with inputs for bit-rate and video resolution
adb shell "screenrecord --bugreport --size ${{ inputs.video-res }} --bit-rate ${{ inputs.bit-rate }} /data/local/tmp/maestro.mp4 & echo \$! > /data/local/tmp/screenrecord_pid.txt" &

# Run Maestro tests. Still needs to capture the exit status without stopping the script.
$HOME/.maestro/bin/maestro ${{ inputs.command }} || true

# Stop screen recording and pull the video file
adb shell "kill -2 \$(cat /data/local/tmp/screenrecord_pid.txt)" || true
sleep 1
adb pull /data/local/tmp/maestro.mp4 /home/runner/.maestro/tests/ || true


- name: Move test
shell: bash
run: mv /home/runner/.maestro/tests ~

- name: Upload report
uses: actions/upload-artifact@v4
if: always()
with:
name: "report-${{ inputs.test-name }}"
path: |
~/tests/**/*
~/report_${{ inputs.test-name }}.xml
27 changes: 27 additions & 0 deletions .github/workflows/ui_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: UI_tests
on:
pull_request:
types: [ opened, synchronize, reopened ]

jobs:
ui_test:
name: Maestro tests
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
ref: 'maestro-run'

- name: Print root
shell: bash
run: |
pwd
ls

- name: Run Maestro tests
uses: ./.github/actions/run_maestro
with:
apk-path: '~/voyager-debug.apk'
command: 'test ./maestro/android-voyager-flow.yaml'
Binary file added voyager-debug.apk
Binary file not shown.
Loading