Skip to content

Commit

Permalink
try emulator creation manually
Browse files Browse the repository at this point in the history
export JAVA_HOME="/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home"
  • Loading branch information
sandipndev committed Feb 15, 2024
1 parent ef448a2 commit e62c663
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 92 deletions.
43 changes: 0 additions & 43 deletions .github/workflows/adb-check.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/adb-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: ADB Test
on: push

jobs:
adb-test:
name: Run Detox tests on Android
runs-on: ["self-hosted", "Linux", "X64"]

steps:
- uses: actions/setup-node@v2
with:
node-version: 20
- run: npm i -g yarn

- uses: actions/setup-java@v2
with:
java-version: 17
distribution: temurin
- uses: android-actions/setup-android@v3

- name: Enable KVM group perms
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: 29
arch: x86_64
profile: Nexus 6
avd-name: Pixel_API_29_AOSP
script: |
sleep 99999
84 changes: 35 additions & 49 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
build-e2e-android:
name: Build APK

# Github hosted runner doesn't have enough space
runs-on: ["self-hosted", "Linux", "X64"]

steps:
Expand Down Expand Up @@ -59,14 +61,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 Pixel_API_29_AOSP -k "system-images;android-34;default;x86_64" --device "Nexus 6" --force
echo "Starting Emulator..."
emulator -avd Pixel_API_29_AOSP -no-audio -no-window -accel off &
echo "Will take 3-4 minutes to boot up completely"
- uses: DeterminateSystems/magic-nix-cache-action@v2
- name: Tilt CI
Expand All @@ -77,64 +87,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 e62c663

Please sign in to comment.