1+ name : Maestro Test Android
2+
3+ on :
4+ pull_request :
5+ paths :
6+ - examples/expo-example/**
7+
8+ jobs :
9+ build-debug-android :
10+ name : Build Android Debug App
11+ uses : ./.github/workflows/expo-example-build-debug-android.yml
12+
13+ android-e2e :
14+ name : Run Expo Example Android E2E Tests
15+ needs : build-debug-android
16+ runs-on : ubuntu-latest
17+ timeout-minutes : 60
18+ permissions :
19+ checks : read
20+ contents : read
21+ concurrency :
22+ group : ${{ github.workflow }}-${{ github.ref }}
23+ cancel-in-progress : true
24+ env :
25+ API_LEVEL : 34
26+ steps :
27+ - name : 🏗 Checkout repository
28+ uses : actions/checkout@v4
29+
30+ - name : 🐛 Restore debug build from cache
31+ uses : actions/cache/restore@v4
32+ with :
33+ path : android-debug-build/
34+ key : ${{ needs.build-debug-android.outputs.build-cache-key }}
35+
36+ - name : 🌿 Setup Node
37+ uses : actions/setup-node@v4
38+ with :
39+ node-version-file : ' examples/expo-example/.nvmrc'
40+ cache : ' yarn'
41+
42+ - name : ☕ Setup JDK 17
43+ uses : actions/setup-java@v4
44+ with :
45+ java-version : ' 17'
46+ distribution : ' zulu'
47+
48+ - name : 🐘 Setup Gradle 8.8
49+ uses : gradle/actions/setup-gradle@v4
50+ with :
51+ gradle-version : 8.8
52+
53+ - name : 📦 Install dependencies
54+ run : yarn install --immutable
55+
56+ - name : 📦 Install AVD dependencies
57+ run : |
58+ sudo apt update
59+ sudo apt-get install -y libpulse0 libgl1
60+
61+ - name : 📦 Install Maestro
62+ run : |
63+ MAESTRO_VERSION=1.38.1
64+ curl -fsSL "https://get.maestro.mobile.dev" | bash
65+ echo "$HOME/.maestro/bin" >> $GITHUB_PATH
66+
67+ - name : 🏎️ Enable KVM
68+ run : |
69+ echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
70+ sudo udevadm control --reload-rules
71+ sudo udevadm trigger --name-match=kvm
72+
73+ - name : 📱 AVD cache restore
74+ uses : actions/cache/restore@v4
75+ id : avd-cache-restore
76+ with :
77+ path : |
78+ ~/.android/avd/*
79+ ~/.android/adb*
80+ key : avd-${{ env.API_LEVEL }}
81+
82+ - name : 📷 Create AVD and generate snapshot for caching
83+ if : steps.avd-cache-restore.outputs.cache-hit != 'true'
84+ uses : reactivecircus/android-emulator-runner@v2
85+ with :
86+ api-level : ${{ env.API_LEVEL }}
87+ force-avd-creation : false
88+ disable-animations : false
89+ target : google_apis
90+ emulator-options : -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
91+ avd-name : e2e_emulator
92+ arch : x86_64
93+ script : echo "Generated AVD snapshot for caching."
94+
95+ - name : 📱 AVD cache save
96+ if : steps.avd-cache-restore.outputs.cache-hit != 'true'
97+ uses : actions/cache/save@v4
98+ with :
99+ path : |
100+ ~/.android/avd/*
101+ ~/.android/adb*
102+ key : avd-${{ env.API_LEVEL }}
103+
104+ - name : 🚇 Run Metro bundler in the background
105+ uses : miguelteixeiraa/action-run-in-background@v1
106+ with :
107+ script : yarn --cwd examples/expo-example start
108+ readiness-script : |
109+ if curl -sSf http://localhost:8081 > /dev/null; then
110+ echo "curl request to metro was successful."
111+ else
112+ echo "curl request to metro failed."
113+ exit 1
114+ fi
115+
116+ - name : 🧪 Run Maestro tests
117+ uses : reactivecircus/android-emulator-runner@v2
118+ with :
119+ api-level : ${{ env.API_LEVEL }}
120+ force-avd-creation : false
121+ disable-animations : false
122+ target : google_apis
123+ emulator-options : -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -camera-front none
124+ avd-name : e2e_emulator
125+ arch : x86_64
126+ script : |
127+ adb install android-debug-build/android-debug.apk
128+ yarn run test:e2e:android
129+ working-directory : examples/expo-example
0 commit comments