-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (139 loc) · 5.26 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
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 * * *'
jobs:
run_tests:
name: Performance measures for Android
runs-on: ubuntu-latest
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@v3
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
#working-directory: e2e
#- name: Install Appium
# run: npm install -g appium
#- name: Install uiautomator2 driver
# run: appium driver install uiautomator2
- name: Add Entur private registry credentials
run: bash ./scripts/add-entur-private-registry.sh
env:
ENTUR_REGISTRY_USER: ${{ secrets.ENTUR_REGISTRY_USER }}
ENTUR_REGISTRY_TOKEN: ${{ secrets.ENTUR_REGISTRY_TOKEN }}
- 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
# E2E run
- name: Run tests on Android emulator
uses: reactivecircus/android-emulator-runner@v2
continue-on-error: true
with:
avd-name: emulator-api${{ env.INPUT_API_LEVEL }}
api-level: ${{ env.INPUT_API_LEVEL }}
arch: x86_64
profile: pixel_5
emulator-build: 11237101
emulator-boot-timeout: 900
disable-spellchecker: true
script: /home/runner/.flashlight/bin/flashlight test --bundleId no.mittatb.staging --testCommand "yarn test:android --spec test/flashlight/performanceMeasures.e2e.ts" --resultsTitle performance_measures --iterationCount ${{ env.INPUT_TEST_ITERATIONS }} --maxRetries ${{ env.INPUT_MAX_RETRIES }}
pre-emulator-launch-script: ./e2e/scripts/restart-adb.sh
working-directory: e2e
env:
APP_PATH: ${{ github.workspace }}
IS_CI: "true"
# 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@v3
with:
name: performance_measures
path: |
./e2e/performance_measures_*.json
retention-days: 1
- name: Upload performance summary
if: always()
uses: actions/upload-artifact@v3
with:
name: performance_measures_summary
path: |
./e2e/performance/performance_measures_summary.json
retention-days: 1
- name: Upload screenshots
if: failure()
uses: actions/upload-artifact@v3
with:
name: test-screenshots
path: ./e2e/screenshots/*.png
retention-days: 1