-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (71 loc) · 2.33 KB
/
kaan.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Android CI
on:
push:
branches:
- "*"
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
sudo adduser $USER kvm
- name: Clear SDK Repository Cache
run: |
rm -rf $HOME/.android/cache
- name: Setup JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: "zulu"
- name: Setup Android SDK
uses: android-actions/setup-android@v2
with:
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3.3.2
- name: checkout
uses: actions/checkout@v4
- name: Enable KVM (not applicable on macOS)
if: runner.os == 'Linux'
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: Enable KVM
run: |
sudo apt-get update
sudo apt-get install qemu-kvm
sudo adduser $USER kvm
sudo chmod 666 /dev/kvm
- name: Start Emulators and Check Readiness
run: |
sdkmanager --install "emulator"
for i in {1..4}
do
echo "no" | avdmanager create avd -n "testAVD$i" -k "system-images;android-30;google_apis;x86_64" --force
$ANDROID_HOME/emulator/emulator -avd "testAVD$i" -no-audio -no-window -no-boot-anim &
done
sleep 30
adb wait-for-device
let port=5554
for i in {1..4}
do
until adb -s emulator-$port shell 'getprop sys.boot_completed' | grep -m 1 '1'; do
echo "Waiting for emulator-$port to fully boot..."
sleep 10
done
let port+=2
done
echo "All emulators are ready."
- name: Execute Control Script
run: |
bash main.sh
- name: Cleanup Emulators
if: always()
run: |
adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done