-
Notifications
You must be signed in to change notification settings - Fork 0
246 lines (223 loc) · 8.15 KB
/
test.yaml
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: Test App
on:
workflow_dispatch:
inputs:
job:
description: Job to run
required: true
type: choice
options:
- ios
- android
default: ios
flavor:
description: Build Flavor
type: choice
default: stg
options:
- stg
- prod
max-parallel:
description: The maximum number of jobs that can run simultaneously
default: '1'
type: choice
options:
- '1'
- '2'
- '3'
slack:
description: Send report info to Slack
type: boolean
default: false
jobs:
test-ios:
runs-on: macos-latest
if: ${{ github.event.inputs.job == 'ios'}}
permissions:
contents: write
actions: write
strategy:
max-parallel: ${{fromJson(github.event.inputs.max-parallel)}}
matrix:
os: [17.5]
model: [iPhone 15,iPhone SE (3rd generation)]
env:
APP_PATH: ${{ github.workspace }}/finna.app
ZIP_PATH: ${{ github.workspace }}/finna.zip
XCODE_VERSION: 15.4
PROD: ${{github.event.inputs.flavor == 'prod' && 'true' || 'false'}}
steps:
- uses: actions/checkout@v4
- name: Download APP file from AWS S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
aws s3 cp s3://appium-finna/${{github.event.inputs.flavor == 'stg' && 'finna.zip' || 'finna-prod.zip' }} \
${{ env.ZIP_PATH }}
- name: Unzip the app
run: |
unzip ${{ env.ZIP_PATH }} -d ${{ github.workspace }}
# Add Appium cache
- name: Cache Appium
uses: actions/cache@v4
with:
path: ~/.appium
key: ${{ runner.os }}-appium-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-appium-
- name: Setup Appium
run: |
npm install -g appium
appium driver install xcuitest || true
- name: Install wdio dependencies
run: npm install
- name: Set Xcode Version
uses: maxim-lobanov/[email protected]
with:
xcode-version: ${{ env.XCODE_VERSION }}
- name: Launch iOS Simulator
uses: futureware-tech/simulator-action@v4
with:
os_version: ${{ matrix.os }}
model: ${{ matrix.model }}
wait_for_boot: 'true'
- name: Run iOS test suite
continue-on-error: true
env:
FINNA_USER_EMAIL: ${{ secrets.FINNA_USER_EMAIL }}
FINNA_USER_PASSWORD: ${{ secrets.FINNA_USER_PASSWORD }}
FINNA_USER_PIN: ${{ secrets.FINNA_USER_PIN }}
MAILOSAUR_ID: ${{ secrets.MAILOSAUR_ID }}
MAILOSAUR_KEY: ${{ secrets.MAILOSAUR_KEY }}
BUNDLE_ID: 'com.finna.protocol.stg'
OS_VERSION: ${{ matrix.os }}
DEVICE_NAME: ${{ matrix.model }}
PLATFORM: 'iOS'
run: |
xcrun simctl list devices "${{ matrix.model }}" | grep -i "booted\|shutdown" || true
npm run ios${{github.event.inputs.flavor == 'prod' && '-prod' || '' }}
- name: Deploy Allure report
uses: cybersokari/[email protected]
with:
allure_results_path: ${{ github.workspace }}/allure-results
target: firebase
google_credentials_json: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
gcs_bucket: ${{ secrets.GCS_BUCKET }}
gcs_bucket_prefix: 'finna-ci-ios/${{github.event.inputs.flavor}}/${{matrix.os}}'
show_history: 'true'
retries: 5
slack_token: ${{ github.event.inputs.slack == 'true' && secrets.SLACK_TOKEN || '' }}
slack_channel: ${{ github.event.inputs.slack == 'true' && secrets.SLACK_CHANNEL || '' }}
report_name: 'iOS Finna'
test-android:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.job == 'android'}}
permissions:
contents: write
actions: write
strategy:
max-parallel: ${{fromJson(github.event.inputs.max-parallel)}}
matrix:
api-level: [31, 32, 33]
device: [Nexus 6]
env:
APK_PATH: ${{ github.workspace }}/app-finna.apk
PROD: ${{github.event.inputs.flavor == 'prod' && 'true' || 'false'}}
steps:
- uses: actions/checkout@v4
- name: Download APK from AWS S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
run: |
aws s3 cp s3://appium-finna/${{github.event.inputs.flavor == 'stg' && 'finna.apk' || 'finna-prod.apk' }} \
${{ env.APK_PATH }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# Add Node modules caching
- name: Cache Node modules
uses: actions/cache@v4
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Java JDK
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
with:
log-accepted-android-sdk-licenses: 'false'
# Add Android SDK cache
- name: Cache Android SDK
uses: actions/cache@v4
with:
path: |
~/.android/cache
~/.android/repositories
key: ${{ runner.os }}-android-sdk-${{ hashFiles('~/.android/repositories') }}
restore-keys: |
${{ runner.os }}-android-sdk-
# Add Appium cache
- name: Cache Appium
uses: actions/cache@v4
with:
path: ~/.appium
key: ${{ runner.os }}-appium-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-appium-
- name: Setup Appium
run: |
npm install -g appium
appium driver install uiautomator2 || true
- name: Install wdio dependencies
run: npm install
- name: Enable KVM
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: Run test in Emulator
uses: ReactiveCircus/[email protected]
continue-on-error: true
env:
FINNA_USER_EMAIL: ${{ secrets.FINNA_USER_EMAIL }}
FINNA_USER_PASSWORD: ${{ secrets.FINNA_USER_PASSWORD }}
FINNA_USER_PIN: ${{ secrets.FINNA_USER_PIN }}
MAILOSAUR_ID: ${{ secrets.MAILOSAUR_ID }}
MAILOSAUR_KEY: ${{ secrets.MAILOSAUR_KEY }}
PACKAGE_NAME: ${{ secrets.PACKAGE_NAME }}
OS_VERSION: ${{ matrix.api-level }}
DEVICE_NAME: ${{matrix.device}}
PLATFORM: 'Android'
with:
api-level: ${{ matrix.api-level }}
target: 'google_apis'
arch: 'x86_64'
profile: ${{matrix.device}}
ram-size: 2048M
script: |
$ANDROID_HOME/cmdline-tools/latest/bin/avdmanager list device || true
npm run android${{github.event.inputs.flavor == 'prod' && '-prod' || '' }}
- name: Deploy Allure report
uses: cybersokari/[email protected]
with:
allure_results_path: ${{ github.workspace }}/allure-results
target: firebase
google_credentials_json: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS}}
gcs_bucket: ${{ secrets.GCS_BUCKET }}
gcs_bucket_prefix: 'finna-ci-android/${{github.event.inputs.flavor}}/${{matrix.api-level}}'
show_history: 'true'
retries: 5
slack_token: ${{ github.event.inputs.slack == 'true' && secrets.SLACK_TOKEN || '' }}
slack_channel: ${{ github.event.inputs.slack == 'true' && secrets.SLACK_CHANNEL || '' }}
report_name: 'Android Finna'