Skip to content

Commit 0b8be29

Browse files
committed
Fix UI test in ci.yaml
1 parent 8ea3cb4 commit 0b8be29

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

.github/workflows/ci.yaml

+41-9
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,17 @@ jobs:
3232
- name: Build with Gradle
3333
run: ./gradlew build
3434

35-
ui-test:
36-
name: UI tests on Android (API level ${{ matrix.api-level }})
37-
runs-on: macos-latest
35+
mobile-ui-test:
36+
name: Mobile UI tests on Android (API level ${{ matrix.api-level }})
37+
runs-on: ubuntu-latest
3838
strategy:
3939
matrix:
4040
api-level: [ 26, 28, 34 ]
41+
target: [ google_apis ]
42+
arch: [ x86_64 ]
4143
steps:
4244
- name: Checkout
43-
uses: actions/checkout@v3
45+
uses: actions/checkout@v4
4446

4547
- name: Setup JDK 17
4648
uses: actions/setup-java@v3
@@ -49,13 +51,43 @@ jobs:
4951
distribution: 'temurin'
5052
cache: gradle
5153

52-
- name: Setup Android SDK
53-
uses: android-actions/setup-android@v2
54+
- name: Enable KVM
55+
run: |
56+
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
57+
sudo udevadm control --reload-rules
58+
sudo udevadm trigger --name-match=kvm
59+
60+
- name: Gradle cache
61+
uses: gradle/actions/setup-gradle@v3
62+
63+
- name: AVD cache
64+
uses: actions/cache@v4
65+
id: avd-cache
66+
with:
67+
path: |
68+
~/.android/avd/*
69+
~/.android/adb*
70+
key: avd-${{ matrix.api-level }}
71+
72+
- name: Create AVD and generate snapshot for caching
73+
if: steps.avd-cache.outputs.cache-hit != 'true'
74+
uses: reactivecircus/android-emulator-runner@v2
75+
with:
76+
api-level: ${{ matrix.api-level }}
77+
target: ${{ matrix.target }}
78+
arch: ${{ matrix.arch }}
79+
force-avd-creation: false
80+
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
81+
disable-animations: false
82+
script: echo "Generated AVD snapshot for caching."
5483

55-
- name: UI test
84+
- name: Run tests
5685
uses: reactivecircus/android-emulator-runner@v2
5786
with:
5887
api-level: ${{ matrix.api-level }}
88+
target: ${{ matrix.target }}
89+
arch: ${{ matrix.arch }}
90+
force-avd-creation: false
91+
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
5992
disable-animations: true
60-
arch: x86_64
61-
script: ./gradlew connectedCheck
93+
script: ./gradlew connectedAndroidTest -x :app:wear:connectedAndroidTest

0 commit comments

Comments
 (0)