From ee85212b3b418c733d9393abcc255e9cab1442f3 Mon Sep 17 00:00:00 2001 From: Sandipan Dey Date: Thu, 15 Feb 2024 11:58:05 +0530 Subject: [PATCH] try emulator creation manually --- .github/workflows/e2e.yml | 82 ++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 49 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index b2eb609fba..34b1119462 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -59,14 +59,22 @@ jobs: java-version: 17 distribution: temurin - uses: gradle/actions/setup-gradle@v3 - - uses: actions/cache@v2 - with: - path: | - node_modules - ios/Pods - key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock', '**/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-deps- + + - uses: android-actions/setup-android@v3 + - name: Create and Start Android Emulator + run: | + echo "Enabling KVM..." + 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 + + echo "Creating AVD..." + avdmanager create avd -n test -k "system-images;android-34;default;x86_64" --force + + echo "Starting Emulator..." + emulator -avd test -no-audio -no-window & + + echo "Will take 3-4 minutes to boot up completely" - uses: DeterminateSystems/magic-nix-cache-action@v2 - name: Tilt CI @@ -77,64 +85,40 @@ jobs: done exit 1 - - run: npm i -g yarn - - uses: android-actions/setup-android@v3 + - uses: actions/cache@v2 + with: + path: | + node_modules + ios/Pods + key: ${{ runner.os }}-deps-${{ hashFiles('**/yarn.lock', '**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-deps- + - run: npm i -g yarn - run: yarn install - name: Start Metro run: | yarn start & echo "METRO_PID=$!" >> $GITHUB_ENV - - name: Enable KVM - 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 Detox Tests + run: yarn e2e:test android.emu.debug --headless -d -R 3 --take-screenshots all --record-videos all --record-logs all --headless - - name: Run Detox Tests (test attempt 1) - continue-on-error: true - id: test1 - uses: reactivecircus/android-emulator-runner@v2 + - uses: actions/upload-artifact@v4 with: - api-level: 29 - avd-name: Pixel_API_29_AOSP - force-avd-creation: true - arch: x86_64 - script: yarn e2e:test android.emu.debug --headless -d -R 3 --take-screenshots all --record-videos all --record-logs all --headless + name: android-recordings + path: artifacts - - name: Run Detox Tests (test attempt 2) + - name: Destroy Android Emulator + if: always() continue-on-error: true - id: test2 - if: steps.test1.outcome != 'success' - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: 29 - avd-name: Pixel_API_29_AOSP - force-avd-creation: false - arch: x86_64 - script: yarn e2e:test android.emu.debug --headless -d -R 3 --take-screenshots all --record-videos all --record-logs all --headless - - - name: Run Detox Tests (test attempt 3) - if: steps.test1.outcome != 'success' && steps.test2.outcome != 'success' - uses: reactivecircus/android-emulator-runner@v2 - with: - api-level: 29 - avd-name: Pixel_API_29_AOSP - force-avd-creation: false - arch: x86_64 - script: yarn e2e:test android.emu.debug --headless -d -R 3 + run: adb devices | grep emulator | cut -f1 | while read -r line; do adb -s $line emu kill; done - name: Terminate Metro if: always() continue-on-error: true run: kill $METRO_PID - - uses: actions/upload-artifact@v4 - with: - name: android-recordings - path: artifacts - - name: Destroy backend if: always() continue-on-error: true