-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
100 lines (85 loc) · 3.32 KB
/
action.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Appium & AVD action ubuntu (a&a-u)
description: Run APPIUM and AVD at ubuntu latest
author: Gabriel Reinisch Faleiro
branding:
icon: "terminal"
color: "purple"
runs:
using: 'composite'
steps:
- name: Set up Android environment variables
shell: bash
run: |
echo "Setting up Android environment variables"
echo "ANDROID_HOME=~/Android/Sdk" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=~/Android/Sdk" >> $GITHUB_ENV
echo "ANDROID_AVD_HOME=/home/runner/.config/.android/avd/" >> $GITHUB_ENV
- name: Update apt
shell: bash
run: sudo apt-get update
- name: Install KVM
shell: bash
run: |
sudo apt-get install cpu-checker
sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
- name: Set chmod KVM /dev/kvm
shell: bash
run: |
sudo chmod o+rw /dev/kvm
- name: Install Node v18
shell: bash
run: |
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
- name: Install Appium
shell: bash
run: |
npm install -g appium
- name: Install UiAutomator2
shell: bash
run: |
appium driver install uiautomator2
- name: Curl cmdline-tools from Android.tar.gz
shell: bash
run: |
cd && curl -O -L https://github.com/fahleiro/appium-avd-action-ubuntu/releases/download/appium-avd-action-ubuntu-1.0.0/Android.tar.gz
- name: Untar Android.tar.gz
shell: bash
run: |
tar -xzf ~/Android.tar.gz -C ~
- name: Install Android dependencies
shell: bash
run: |
chmod +x ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager
yes | ~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --licenses
~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "platform-tools"
~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "emulator"
~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "build-tools;30.0.3"
~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "platforms;android-27"
~/Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "system-images;android-30;default;x86_64"
- name: Create AVD
shell: bash
run: |
chmod +x ~/Android/Sdk/cmdline-tools/latest/bin/avdmanager
~/Android/Sdk/cmdline-tools/latest/bin/avdmanager create avd -n device-name -k "system-images;android-30;default;x86_64" -d pixel_4
- name: Run AVD
shell: bash
run: |
chmod +x ~/Android/Sdk/emulator/emulator
chmod +x ~/Android/Sdk/emulator
~/Android/Sdk/emulator/emulator -avd device-name -port 5554 -no-window -no-audio -no-boot-anim &
- name: Validating AVD ready
shell: bash
run: |
chmod +x ~/Android/Sdk/platform-tools/adb
status=$(~/Android/Sdk/platform-tools/adb devices | grep -v "List of devices attached")
while ! echo "$status" | grep -q "device"; do
echo "Emulator is not ready, waiting..."
sleep 5
status=$(~/Android/Sdk/platform-tools/adb devices | grep -v "List of devices attached")
done
echo "Emulator is online!"
echo "$status"
- name: Run Appium
shell: bash
run: appium &