More attempts to install the emulator package. #100
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- 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:$ANDROID_HOME/platform-tools:$ANDROID_HOME/cmdline-tools/latest/bin" >> $GITHUB_ENV | |
source $GITHUB_ENV | |
- name: Install Android SDK Command Line Tools | |
run: | | |
mkdir -p $ANDROID_HOME/cmdline-tools | |
cd $ANDROID_HOME/cmdline-tools | |
wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip -O commandlinetools.zip | |
unzip commandlinetools.zip | |
rm commandlinetools.zip | |
mkdir -p $ANDROID_HOME/cmdline-tools/latest | |
mv cmdline-tools latest | |
- name: Accept SDK Licenses | |
run: | | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_HOME --update | |
- name: Install SDK Components | |
run: | | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_HOME "platform-tools" | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_HOME "build-tools;34.0.0" | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_HOME "platforms;android-34" | |
for i in {1..5}; do yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_HOME "emulator" && break || sleep 15; done | |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_HOME "system-images;android-34;google_apis;arm64-v8a" | |
- 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 | |
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.* |