Skip to content

Commit

Permalink
try emulator creation manually
Browse files Browse the repository at this point in the history
  • Loading branch information
sandipndev committed Feb 15, 2024
1 parent ef448a2 commit ee85212
Showing 1 changed file with 33 additions and 49 deletions.
82 changes: 33 additions & 49 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ee85212

Please sign in to comment.