-
Notifications
You must be signed in to change notification settings - Fork 25
/
start-emulator-and-run-tests.yml
230 lines (229 loc) · 7.66 KB
/
start-emulator-and-run-tests.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
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
description: |
Creates an AVD, starts an emulator and runs tests.
This is a wrapper command that wraps the
create-avd, start-emulator and run-tests commands.
parameters:
avd-name:
description: |
The name of the AVD to create
type: string
default: test
system-image:
description: |
Name of system image e.g. "system-images;android-29;default;x86".
It should match the name seen in the "sdkmanager --list" output.
type: string
default: system-images;android-29;default;x86
install-system-image:
description: |
Whether to first install the system image via sdkmanager
type: boolean
default: true
additional-avd-args:
description: |
Additional args to be passed directly to the avd creation command
type: string
default: ""
gpu:
description: |
The value to use for the "-gpu" flag.
If set to "", the emulator will be run without the -gpu flag.
type: string
default: "swiftshader_indirect"
camera-front:
description: |
The value to use for the "-camera-front" flag.
If set to "", the emulator will be run without the -camera-front flag.
type: string
default: ""
camera-back:
description: |
The value to use for the "-camera-back" flag.
If set to "", the emulator will be run without the -camera-back flag.
type: string
default: ""
memory:
description: |
The value to use for the "-memory" flag.
If set to -1, the emulator will be run without the -memory flag.
type: integer
default: -1
no-window:
description: |
Whether to run the emulator with the -no-window flag
type: boolean
default: true
no-audio:
description: |
Whether to run the emulator with the -noaudio flag
type: boolean
default: true
no-boot-anim:
description: |
Whether to run the emulator with the -no-boot-anim flag
type: boolean
default: true
no-snapshot:
description: |
Whether to run the emulator with the -no-snapshot flag
type: boolean
default: true
delay-adb:
description: |
Whether to run the emulator with the -delay-adb flag
type: boolean
default: false
verbose:
description: |
Whether to run the emulator with the -verbose flag
type: boolean
default: true
additional-emulator-args:
description: |
Additional args to be passed directly to the emulator command
type: string
default: ""
override-emulator-args:
description: |
If this is set to a non-blank value, the emulator command will be
run with the -avd flag and the value of "override-args" (i.e. none of the defaults
provided by the orb command will be used)
type: string
default: ""
pre-emulator-wait-steps:
description: |
Steps to execute while before beginning to wait for the emulator to start up
type: steps
default: []
post-emulator-launch-assemble-command:
description: |
If this is set to a non-blank value, the configured command will be run
after the emulator has been launched, and before commencing the
wait for the emulator to finish starting up.
type: string
default: "./gradlew assembleDebugAndroidTest"
restore-gradle-cache-post-emulator-launch:
description: |
Whether to restore the gradle cache after the emulator has been launched,
and before commencing the wait for the emulator to finish starting up.
type: boolean
default: true
restore-gradle-cache-prefix:
description: |
Cache prefix used if the "restore-gradle-cache-post-emulator-launch" parameter
is set to true.
type: string
default: "v1"
restore-gradle-cache-find-args:
description: |
Use this to customize how the find command is used to look for relevant
file changes.
type: string
default: ". -name 'build.gradle'"
save-gradle-cache:
description: |
Whether to write to the gradle cache after the tests have run
type: boolean
default: true
post-emulator-wait-steps:
description: |
Steps to execute after waiting for the emulator to start up
type: steps
default: []
wait-for-emulator:
description: |
Whether to wait for the emulator to start up
type: boolean
default: true
run-logcat:
description: |
Whether to run with logcat in the background, after the emulator starts up
type: boolean
default: false
disable-animations:
description: |
Whether to disable animations that may interfere with tests, after the emulator starts up
type: boolean
default: true
pre-run-tests-steps:
description: |
Steps to run before the tests
type: steps
default: []
post-run-tests-steps:
description: |
Steps to run after the tests
type: steps
default: []
test-command:
description: Command to run in order to run the tests
type: string
default: "./gradlew connectedDebugAndroidTest"
run-tests-working-directory:
description: Working directory to run the tests in
type: string
default: "."
max-tries:
description: Max number of tries. To disable retries, set this to 1.
type: integer
default: 2
retry-interval:
description: Duration in seconds to wait before the next try
type: integer
default: 5
no-output-timeout:
description: |
Use this to configure the no_output_timeout value of the test run
type: string
default: 10m
kill-emulators:
description: |
Whether to kill the emulators after the tests complete
type: boolean
default: true
steps:
- create-avd:
avd-name: << parameters.avd-name >>
system-image: <<parameters.system-image>>
install: << parameters.install-system-image >>
additional-args: << parameters.additional-avd-args >>
- start-emulator:
avd-name: << parameters.avd-name >>
gpu: << parameters.gpu >>
camera-front: << parameters.camera-front >>
camera-back: << parameters.camera-back >>
memory: << parameters.memory >>
no-window: << parameters.no-window >>
no-audio: << parameters.no-audio >>
no-boot-anim: << parameters.no-boot-anim >>
no-snapshot: << parameters.no-snapshot >>
delay-adb: << parameters.delay-adb >>
verbose: << parameters.verbose >>
additional-args: << parameters.additional-emulator-args >>
override-args: << parameters.override-emulator-args >>
wait-for-emulator: << parameters.wait-for-emulator >>
pre-emulator-wait-steps: << parameters.pre-emulator-wait-steps >>
post-emulator-launch-assemble-command: << parameters.post-emulator-launch-assemble-command >>
restore-gradle-cache-post-emulator-launch: << parameters.restore-gradle-cache-post-emulator-launch >>
restore-gradle-cache-prefix: << parameters.restore-gradle-cache-prefix >>
restore-gradle-cache-find-args: << parameters.restore-gradle-cache-find-args >>
post-emulator-wait-steps: << parameters.post-emulator-wait-steps >>
run-logcat: << parameters.run-logcat >>
disable-animations: << parameters.disable-animations >>
- << parameters.pre-run-tests-steps >>
- run-tests:
working-directory: << parameters.run-tests-working-directory >>
test-command: << parameters.test-command >>
max-tries: << parameters.max-tries >>
retry-interval: << parameters.retry-interval >>
no-output-timeout: << parameters.no-output-timeout >>
- << parameters.post-run-tests-steps >>
- when:
condition: << parameters.save-gradle-cache >>
steps:
- save-gradle-cache:
cache-prefix: << parameters.restore-gradle-cache-prefix >>
- when:
condition: << parameters.kill-emulators >>
steps:
- kill-emulators