-
Notifications
You must be signed in to change notification settings - Fork 1
170 lines (163 loc) · 6.05 KB
/
test-performance-android.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
161
162
163
164
165
166
167
168
169
170
name: Performance measures for Android
on:
workflow_dispatch:
inputs:
test_iterations:
description: 'How many test iterations to run'
required: true
default: 1
max_retries:
description: 'Max retries if there is any test errors'
required: true
default: 1
api_level:
description: 'Define API level'
required: true
default: 30
branch:
description: 'Define branch to test'
required: true
default: 'master'
schedule:
- cron: '0 7 * * 1-5'
jobs:
run_tests:
name: Performance measures for Android
runs-on: ubuntu-24.04
outputs:
TESTED_VERSION: ${{ steps.get-appcenter-apk.outputs.TESTED_VERSION }}
environment: atb
timeout-minutes: 90
steps:
- name: Set env variables
env:
DEFAULT_BRANCH: 'master'
DEFAULT_API_LEVEL: 30
DEFAULT_TEST_ITERATIONS: 1
DEFAULT_MAX_RETRIES: 1
run: |
echo "INPUT_BRANCH=${{ github.event.inputs.branch || env.DEFAULT_BRANCH }}" >> $GITHUB_ENV
echo "INPUT_API_LEVEL=${{ github.event.inputs.api_level || env.DEFAULT_API_LEVEL }}" >> $GITHUB_ENV
echo "INPUT_TEST_ITERATIONS=${{ github.event.inputs.test_iterations || env.DEFAULT_TEST_ITERATIONS }}" >> $GITHUB_ENV
echo "INPUT_MAX_RETRIES=${{ github.event.inputs.max_retries || env.DEFAULT_MAX_RETRIES }}" >> $GITHUB_ENV
echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV
- name: Checkout project
uses: actions/checkout@v4
with:
ref: ${{ env.INPUT_BRANCH }}
# Download APK
- name: Get AppCenter APK
id: get-appcenter-apk
run: bash ./scripts/get-appcenter-apk.sh
working-directory: e2e
env:
APPCENTER_APP_SECRET: ${{ secrets.APPCENTER_ANDROID_APP_SECRET }}
APPCENTER_USER_API_TOKEN: ${{ secrets.APPCENTER_USER_API_TOKEN }}
# E2E init
- 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: Install Flashlight
#run: sh ./scripts/install-flashlight.sh
run: curl https://get.flashlight.dev | bash
- name: Setup Python and its dependencies
uses: ./.github/actions/python-setup
- name: Install E2E tests
run: yarn install
working-directory: e2e
- name: tsc
working-directory: e2e
run: ./node_modules/typescript/bin/tsc --noEmit --noErrorTruncation --pretty false --incremental false
# Emulator cache
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-pixel_5-default-${{ env.INPUT_API_LEVEL }}
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
avd-name: emulator-api${{ env.INPUT_API_LEVEL }}
api-level: ${{ env.INPUT_API_LEVEL }}
arch: x86_64
target: default
profile: pixel_5
emulator-build: 12414864
emulator-boot-timeout: 900
disable-spellchecker: true
disable-animations: false
script: echo "Generated AVD snapshot for caching."
# E2E run
- name: Run tests on Android emulator
uses: reactivecircus/android-emulator-runner@v2
continue-on-error: true
with:
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
avd-name: emulator-api${{ env.INPUT_API_LEVEL }}
api-level: ${{ env.INPUT_API_LEVEL }}
arch: x86_64
target: default
profile: pixel_5
emulator-build: 12414864
emulator-boot-timeout: 900
disable-spellchecker: true
disable-animations: true
script: ./scripts/run-flashlight-tests.sh ${{ env.INPUT_TEST_ITERATIONS }} ${{ env.INPUT_MAX_RETRIES }}
pre-emulator-launch-script: ./scripts/remove-navigation-bar.sh
working-directory: e2e
env:
APP_PATH: ${{ github.workspace }}
IS_CI: "true"
TESTED_VERSION: ${{ steps.get-appcenter-apk.outputs.TESTED_VERSION }}
# Results
#- name: Check for performance report
# run: |
# if [ ! -f ./e2e/performance_measures_*.json ];
# then
# exit 1
# else
# cp -f ./e2e/performance_measures_*.json ./e2e/performance/performance_measures.json
# fi
#- name: Create performance summary
# working-directory: e2e/performance
# run: npx tsx createPerformanceSummary.ts
# env:
# TESTED_VERSION: ${{ steps.get-appcenter-apk.outputs.TESTED_VERSION }}
#- name: Print performance summary
# working-directory: e2e/performance
# run: cat performance_measures_summary.json | jq .
# Uploads
- name: Upload performance reports
if: always()
uses: actions/upload-artifact@v4
with:
name: performance_measures
path: |
./e2e/performance_measures_*.json
retention-days: 1
- name: Upload performance summary
if: always()
uses: actions/upload-artifact@v4
with:
name: performance_measures_summary
path: |
./e2e/performance_measures_summary_*.json
retention-days: 1
- name: Upload screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-screenshots
path: ./e2e/screenshots/*.png
retention-days: 1