-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathaction.yml
More file actions
111 lines (94 loc) 路 3.05 KB
/
Copy pathaction.yml
File metadata and controls
111 lines (94 loc) 路 3.05 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: "Create and launch AVD"
description: "Creates and launches a headless Android Virtual Device for Instrumentation testing purposes"
author: "Mikkel Schl盲ger"
inputs:
apiLevel:
description: "Android API level"
required: true
avdName:
description: "Name of the AVD"
required: false
default: "ci_avd"
runs:
using: composite
steps:
- name: Setup environment
shell: bash
run: |
echo "$ANDROID_SDK_ROOT/platform-tools" >> $GITHUB_PATH
echo "$ANDROID_SDK_ROOT/emulator" >> $GITHUB_PATH
echo "$ANDROID_SDK_ROOT/cmdline-tools/latest/bin" >> $GITHUB_PATH
echo "SYSTEM_IMAGE=system-images;android-${{ inputs.apiLevel }};google_apis;x86_64" >> $GITHUB_ENV
echo "ANDROID_AVD_HOME=${{ github.workspace }}/.android/avd" >> $GITHUB_ENV
- name: Accept licenses
shell: bash
run: yes | sdkmanager --licenses || true
- name: Install emulator
shell: bash
run: sdkmanager --install emulator
- name: Enable KVM group perms
shell: bash
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: KVM diagnostics
shell: bash
run: |
# Check CPU hardware virtualization flags required for KVM support
# Will print number of cores that has the flag, >0 is required
# vmx=Intel VT-x
# svm=AMD-V
egrep -c '(vmx|svm)' /proc/cpuinfo || true
# Check if KVM is installed
if [ -e /dev/kvm ]; then
ls -la /dev/kvm
else
echo "/dev/kvm does not exist"
fi
# Check if runner user is in KVM group
groups $(whoami)
# Emulator acceleration check
emulator -accel-check || true
- name: Download system image
shell: bash
run: sdkmanager --install "$SYSTEM_IMAGE"
- name: Install dependencies
shell: bash
run: |
# PulseAudio (libpulse0) is a sound server required by the Android emulator,
# even though we are running with the -no-audio param.
sudo apt-get update
sudo apt-get install -y libpulse0
- name: Create AVD
shell: bash
run: |
mkdir -p $ANDROID_AVD_HOME
echo "no" | avdmanager create avd \
-n "${{ inputs.avdName }}" \
-k "$SYSTEM_IMAGE" \
--force
- name: AVD Diagnostics
shell: bash
run: |
ls -la $ANDROID_AVD_HOME
emulator -list-avds
- name: Start adb
shell: bash
run: |
adb kill-server || true
adb start-server
adb devices
- name: Launch AVD
shell: bash
run: |
nohup emulator -avd "${{ inputs.avdName }}" \
-no-window \
-no-audio \
-no-boot-anim \
-no-metrics \
-accel on \
> avd.log 2>&1 &
- name: Wait for device
shell: bash
run: adb wait-for-device