Skip to content

Commit c526fb1

Browse files
add emulator step action
1 parent 6d28d54 commit c526fb1

2 files changed

Lines changed: 30 additions & 13 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: 'Emulator Step'
2+
description: 'Run Android emulator with common configuration.'
3+
inputs:
4+
api-level:
5+
description: 'API level for the emulator.'
6+
required: true
7+
script:
8+
description: 'Script to run inside the emulator.'
9+
required: true
10+
runs:
11+
using: 'composite'
12+
steps:
13+
- uses: reactivecircus/android-emulator-runner@v2
14+
with:
15+
api-level: ${{ inputs.api-level }}
16+
arch: x86_64
17+
profile: Medium Phone
18+
force-avd-creation: false
19+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
20+
disable-animations: true
21+
script: ${{ inputs.script }}

.github/workflows/android-emulator-test.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
api-level: [29, 35]
18+
api-level: [35]
1919
steps:
2020
- uses: actions/checkout@v4
2121
- uses: ./.github/actions/common-setup
@@ -36,26 +36,22 @@ jobs:
3636
key: avd-${{ matrix.api-level }}
3737
- name: Create AVD and generate snapshot for caching
3838
if: steps.avd-cache.outputs.cache-hit != 'true'
39-
uses: reactivecircus/android-emulator-runner@v2
39+
uses: ./.github/actions/emulator-step
4040
with:
4141
api-level: ${{ matrix.api-level }}
42-
arch: x86_64
43-
device: Medium Phone
44-
force-avd-creation: false
45-
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
46-
disable-animations: true
4742
script: echo "Generated AVD snapshot for caching."
43+
- name: Show AVD details
44+
run: |
45+
echo "Listing available AVDs:"
46+
avdmanager list avd || true
47+
echo "Dumping AVD .ini files:"
48+
cat ~/.android/avd/*.ini || true
4849
- name: Build app and test APKs
4950
run: ./gradlew assembleDebug assembleDebugAndroidTest
5051
- name: Run instrumented tests
51-
uses: reactivecircus/android-emulator-runner@v2
52+
uses: ./.github/actions/emulator-step
5253
with:
5354
api-level: ${{ matrix.api-level }}
54-
arch: x86_64
55-
device: Medium Phone
56-
force-avd-creation: false
57-
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
58-
disable-animations: true
5955
script: ./gradlew connectedDebugAndroidTest -x assembleDebug -x assembleDebugAndroidTest
6056
- name: Upload test results
6157
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)