Skip to content

Makes a directory and sets env variables and reloads the github env. #92

Makes a directory and sets env variables and reloads the github env.

Makes a directory and sets env variables and reloads the github env. #92

name: E2E CI
on:
push:
branches:
- chore/e2e-ci
jobs:
run-tests:
runs-on: ubuntu-22.04-arm64-2cpu
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create Dummy APK
run: |
mkdir -p dummy-apk
echo "This is a dummy APK file." > dummy-apk/dummy.apk
- name: Set up environment variables
run: |
mkdir -p $HOME/lib/android/sdk
echo "ANDROID_HOME=$HOME/lib/android/sdk" >> $GITHUB_ENV
echo "PATH=$PATH:$ANDROID_HOME/emulator" >> $GITHUB_ENV
echo "PATH=$PATH:$ANDROID_HOME/platform-tools" >> $GITHUB_ENV
source $GITHUB_ENV
- name: Install Maestro
run: curl -Ls 'https://get.maestro.mobile.dev' | bash
- name: Set up Android Emulator
uses: ReactiveCircus/android-emulator-runner@v2
with:
api-level: 34
ndk: 25.1.8937393
target: google_apis
arch: arm64-v8a
avd-name: test
force-avd-creation: true
profile: pixel_4
cores: 2
disk-size: 6000M
ram-size: 2048M
heap-size: 4096M
emulator-boot-timeout: 900
disable-animations: true
emulator-options: -no-snapshot -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
pre-emulator-launch-script: |
echo "Running pre emulator launch script. Printing the working directory now:"
pwd
echo "ANDROID_HOME: $ANDROID_HOME"
echo "PATH: $PATH"
script: |
echo "Waiting for the emulator to boot up..."
adb wait-for-device
until adb shell getprop sys.boot_completed | grep -m 1 '1'; do echo "Waiting for device to boot..."; sleep 10; done
echo "Device booted. Listing connected devices:"
adb devices
adb shell input keyevent 82
echo "Installing the APK..."
adb install ${{ github.workspace }}/dummy-apk/dummy.apk || (adb kill-server && adb start-server && adb devices && adb install ${{ github.workspace }}/dummy-apk/dummy.apk)
echo "Waiting for the emulator to fully boot..."
adb wait-for-device
adb shell 'while [[ $(getprop sys.boot_completed) -ne 1 ]]; do sleep 1; done'
adb shell 'while [[ $(pm list packages -3) != *"com.comapeo"* ]]; do sleep 1; done'
echo "Emulator fully booted."
echo "Running Maestro tests..."
$HOME/.maestro/bin/maestro test e2e || true
adb logcat -d > logcat_output.txt
- name: Upload Logcat Output
uses: actions/upload-artifact@v4
with:
name: logcat-output
path: logcat_output.txt
- name: Upload Maestro test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: maestro-test-results
path: /home/runner/.maestro/tests/*/
- name: Upload Screen Recording
if: always()
uses: actions/upload-artifact@v4
with:
name: E2E Screen Recording
path: ${{ github.workspace }}/recording-e2e-flow.*