This repository has been archived by the owner on Jun 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
160 lines (136 loc) · 5.49 KB
/
android_emulator_e2e.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: e2e_android
on:
push:
branches:
- locally-e2e-test-automation
- e2e-automate-before-merging-Mikolaj-test-branch
- main
pull_request:
branches:
- locally-e2e-test-automation
- e2e-automate-before-merging-Mikolaj-test-branch
- main
jobs:
e2e_android:
runs-on: ubuntu-latest
timeout-minutes: 40
services:
jellyfish:
image: ghcr.io/jellyfish-dev/jellyfish:0.2.1
env:
JF_CHECK_ORIGIN: false
JF_HOST: localhost:5002
JF_PORT: "5002"
JF_WEBRTC_USED: true
JF_WEBRTC_TURN_PORT_RANGE: 50000-50050
JF_WEBRTC_TURN_IP: 127.0.0.1
JF_WEBRTC_TURN_LISTEN_IP: 0.0.0.0
JF_SERVER_API_TOKEN: development
ports:
- 5002:5002
- 50000-50050:50000-50050/udp
env:
ARCH: "x86_64"
TARGET: "default"
API_LEVEL: "33"
BUILD_TOOLS: "33.0.0"
ANDROID_API_LEVEL: android;33
ANDROID_APIS: google_apis;x86_64
EMULATOR_PACKAGE: system-images;android-33;default;x86_64
EMULATOR_NAME: "nexus"
EMULATOR_DEVICE: "Nexus 6"
PLATFORM_VERSION: platforms;android-33
BUILD_TOOL: "build-tools;33.0.0"
ANDROID_CMD: "commandlinetools-linux-10406996_latest.zip"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create .env file in webdriverio-test directory
run: |
echo -e "
JELLYFISH_URL=ws://10.0.2.2:5002/socket/peer/websocket
ANDROID_DEVICE_NAME=$EMULATOR_DEVICE
ANDROID_APP_PATH=$GITHUB_WORKSPACE/example/android/app/build/outputs/apk/release/app-release.apk
" > $GITHUB_WORKSPACE/example/webdriverio-test/.env
- name: Enable KVM group perms
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: Install dependencies
run: sudo apt-get update && sudo apt install -y curl sudo wget unzip bzip2 libdrm-dev libxkbcommon-dev libgbm-dev libasound-dev libnss3 libxcursor1 libpulse-dev libxshmfence-dev xauth xvfb x11vnc fluxbox wmctrl libdbus-glib-1-2
- name: Setup Java 18
uses: actions/setup-java@v4
with:
java-version: '18'
distribution: 'zulu'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 8512546
- name: Accept licenses
run: echo "y" | sdkmanager --licenses
- name: Install emulator
run: echo "y" | sdkmanager --verbose --no_https $EMULATOR_PACKAGE
- name: Install platform version
run: echo "y" | sdkmanager --verbose --no_https $PLATFORM_VERSION
- name: Install build tool
run: echo "y" | sdkmanager --verbose --no_https $BUILD_TOOL
- name: Setup environment and create AVD
run: echo "y" | avdmanager --verbose create avd --force --name "nexus" --device "Nexus 6" --package "$EMULATOR_PACKAGE"
- name: Install dependencies
run: sudo apt-get update && sudo apt install -y curl sudo wget unzip bzip2 libdrm-dev libxkbcommon-dev libgbm-dev libasound-dev libnss3 libxcursor1 libpulse-dev libxshmfence-dev xauth xvfb x11vnc fluxbox wmctrl libdbus-glib-1-2 xvfb
- name: Start emulator
timeout-minutes: 10
run: |
/usr/local/lib/android/sdk/tools/emulator -list-avds
echo "Starting emulator and waiting for boot to complete...."
xvfb-run -a /usr/local/lib/android/sdk/tools/emulator -avd nexus -grpc 8554 -camera-back emulated -camera-front emulated -no-boot-anim &
while [ "`adb shell getprop sys.boot_completed | tr -d '\r'`" != "1" ]; do echo "Waiting for emulator boot..."; sleep 5; done
adb wait-for-device
echo "Emulator has finished booting"
adb devices
sleep 30
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '18.x'
yarn-version: '1.22.x'
- name: Run yarn install in all directories
run: |
cd $GITHUB_WORKSPACE
yarn install
cd $GITHUB_WORKSPACE/example
yarn install
cd $GITHUB_WORKSPACE/example/webdriverio-test
yarn install
- name: Install appium
run: npm i --location=global appium
- name: Install UIAnimator 2
run: appium driver install uiautomator2
- name: Build app
timeout-minutes: 20
run: |
cd $GITHUB_WORKSPACE/example/android
./gradlew assembleRelease
- name: Logs from app to file
run: |
cd $GITHUB_WORKSPACE/example/webdriverio-test
adb -e logcat "*:S" ReactNative:V ReactNativeJS:V > logs.txt &
- name: Run tests
run: |
cd $GITHUB_WORKSPACE/example/webdriverio-test
npx wdio run ./wdio.conf.ts 2>&1 | tee appium.txt; test ${PIPESTATUS[0]} -eq 0
sleep 10
- name: Upload test output
if: always()
uses: actions/upload-artifact@v3
with:
name: appium.txt
path: /home/runner/work/react-native-client-sdk/react-native-client-sdk/example/webdriverio-test/appium.txt
- name: Upload logs from app
if: always()
uses: actions/upload-artifact@v3
with:
name: logs.txt
path: /home/runner/work/react-native-client-sdk/react-native-client-sdk/example/webdriverio-test/logs.txt