-
-
Notifications
You must be signed in to change notification settings - Fork 266
158 lines (136 loc) · 4.84 KB
/
test-suite-native-e2e-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
name: "[Test] suite-native Android E2E"
on:
schedule:
- cron: "0 0 * * *"
pull_request:
paths:
- "suite-native/**"
- "suite-common/**"
- "packages/connect/**"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_android_test_app:
runs-on: ubuntu-latest
env:
EXPO_PUBLIC_ENVIRONMENT: "debug"
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
submodules: "true"
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# The free GH runner has limited disk space, so we need to uninstall some preinstalled tools.
dotnet: true
haskell: true
tool-cache: false
android: false
swap-storage: false
large-packages: false
- name: Install node and yarn
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
- name: Setup node_modules cache
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ github.ref }}
- name: Install Yarn dependencies
run: yarn install
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Sign message system config
working-directory: ./suite-common/message-system
run: yarn sign-config
- name: Prebuild native expo project
working-directory: ./suite-native/app
run: yarn prebuild --platform android --clean
- name: Build Detox test .apk
run: ../../node_modules/.bin/detox build -PreactNativeArchitectures=x86_64 --configuration android.emu.release
working-directory: ./suite-native/app
- name: Save build to cache
uses: actions/cache/save@v4
with:
path: |
suite-native/app/android/app/build/
key: android_test_build-${{ github.ref }}
run_android_e2e_tests:
runs-on: ubuntu-latest
needs: build_android_test_app
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
submodules: "true"
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
# Combination of android emulator and trezor-user-env is using a too much disk space
# of a free tier GH action runner, some preinstalled packages have to be removed.
dotnet: true
haskell: true
tool-cache: false
android: false
swap-storage: false
large-packages: false
- name: Install node and yarn
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: yarn
- name: Load node modules cache
uses: actions/cache@v4
with:
path: node_modules
key: node_modules-${{ github.ref }}
- name: Install Yarn dependencies
run: yarn install
- name: Get device name from detox config file
id: device
run: node -e "console.log('AVD_NAME=' + require('./suite-native/app/.detoxrc').devices.emulator.device.avdName)" >> $GITHUB_OUTPUT
- name: Run trezor-user-env
env:
COMPOSE_FILE: ./docker/docker-compose.suite-native-ci.yml
run: |
docker compose pull trezor-user-env-unix trezor-user-env-regtest
docker compose up --detach trezor-user-env-unix trezor-user-env-regtest
- name: Read test .apk from cache
uses: actions/cache/restore@v4
with:
path: |
suite-native/app/android/app/build/
key: android_test_build-${{ github.ref }}
- name: Enable Android emulator KVM optimalization
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 Detox E2E Android tests
uses: reactivecircus/android-emulator-runner@v2
env:
RUNNER_TEMP: /tmp
with:
api-level: 31
profile: pixel_3a
arch: x86_64
working-directory: suite-native/app
ram-size: 4096M
force-avd-creation: true
avd-name: ${{ steps.device.outputs.AVD_NAME }}
emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -grpc 8554
script: yarn test:e2e android.emu.release --headless --take-screenshots failing --record-videos failing --retries 2
- name: "Store failed test screenshot artifacts"
if: ${{failure()}}
uses: actions/upload-artifact@v4
with:
name: failed-android-tests-screenshots
path: suite-native/app/artifacts