Use CircleCI version 2.1 at the top of your .circleci/config.yml file.
1
version: 2.1
Add the orbs
stanza below your version, invoking the orb:
1
2
orbs:
genymotion-saas: genymotion/genymotion-saas@2.0.0
Use genymotion-saas
elements in your existing workflows and jobs.
Opt-in to use of uncertified orbs on your organization’s Security settings page.
How to : - Configure your Genymotion Cloud SaaS account by overriding default credentials (GMCLOUD_SAAS_APITOKEN environment variables). In this example, you can use API TOKEN credentials which have been set as environment variables. Credentials must be set as environment variables. - Start Android instance, test your app and stop instance.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
version: '2.1'
orbs:
genymotion-saas: genymotion/genymotion-saas@x.y
jobs:
build:
executor: genymotion-saas/default
steps:
- genymotion-saas/setup:
api_token: API_TOKEN
- genymotion-saas/start-instance:
recipe_uuid: ''
- run: echo "Run your tests here"
- genymotion-saas/stop-instance
workflows: null
How to : - Configure your Genymotion Cloud SaaS account. Credentials are set as environment variables (GMCLOUD_SAAS_EMAIL & GMCLOUD_SAAS_PASSWORD) - Start Android instance, connect through ADB with a specific ADB serial port, test your app and stop instance.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
version: '2.1'
orbs:
genymotion-saas: genymotion/genymotion-saas@x.y
jobs:
build:
executor: genymotion-saas/default
steps:
- genymotion-saas/setup
- genymotion-saas/start-instance:
adb_serial_port: ''
recipe_uuid: ''
- run: echo "Run your tests here"
- genymotion-saas/stop-instance
workflows: null
How to : - Configure your Genymotion Cloud SaaS account. Credentials are set as environment variables (GMCLOUD_SAAS_EMAIL & GMCLOUD_SAAS_PASSWORD) - Start Android instance, test your app and stop instance.
1
2
3
4
5
6
7
8
9
10
11
12
13
version: '2.1'
orbs:
genymotion-saas: genymotion/genymotion-saas@x.y
jobs:
build:
executor: genymotion-saas/default
steps:
- genymotion-saas/setup
- genymotion-saas/start-instance:
recipe_uuid: ''
- run: echo "Run your tests here"
- genymotion-saas/stop-instance
workflows: null
Easily start and stop Genymotion Cloud Saas instance with a single job supplied by this orb.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
version: '2.1'
orbs:
genymotion-saas: genymotion/genymotion-saas@x.y
workflows:
basic_workflow:
jobs:
- genymotion-saas/run_tests:
recipe_uuid: c52fdfc2-6914-4266-aa6e-50258f50ef91
steps:
- run: echo "run your test here"
- genymotion-saas/run_tests:
adb_serial_port: 12345
recipe_uuid: c52fdfc2-6914-4266-aa6e-50258f50ef91
steps:
- run: echo "run your test here"
Start Android instance, test your app and stop instance.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
adb_serial_port | ADB serial port to use when the instance is connected to ADB. | No | -1 | integer |
recipe_uuid | Instance recipe to use. Recipes can be listed with command line 'gmsaas recipes list',
or check https://support.genymotion.com/hc/en-us/articles/360007473658-Supported-Android-devices-templates-for-Genymotion-Cloud-SaaS
for a comprehensive list of all currently available recipes UUIDs.
| No | '' | string |
steps | Steps to execute once the Genymotion Cloud SaaS instance is available | Yes | - | steps |
tag | Pick a specific circleci/android image tag: https://hub.docker.com/r/cimg/android/tags
| No | 2024.11.1 | string |
Download gmsaas cli and authenticate the user.
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
api_token | API Token of your Genymotion Cloud SaaS account. Set this to the name of the environment variable: GMCLOUD_SAAS_APITOKEN. | No | GMCLOUD_SAAS_APITOKEN | env_var_name |
gmsaas_version | Install a specific version of gmsaas, default is the latest | No | '' | string |
Start Android instance on Genymotion Cloud SaaS
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
adb_serial_port | ADB serial port to use when the instance is connected to ADB. | No | -1 | integer |
recipe_uuid | Instance recipe to use. Recipes can be listed with command line 'gmsaas recipes list',
or check https://support.genymotion.com/hc/en-us/articles/360007473658-Supported-Android-devices-templates-for-Genymotion-Cloud-SaaS
for a comprehensive list of all currently available recipes UUIDs.
| Yes | - | string |
Stop Android instance on Genymotion Cloud SaaS
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
instance_uuid | Instance to stop. The UUID of the instance to stop is automatically retrieved. No need to set manually. | No | $INSTANCE_UUID | string |
Android SDK tools are required for this orb, so we will use Circle CI image for Android: https://hub.docker.com/r/cimg/android/tags
PARAMETER | DESCRIPTION | REQUIRED | DEFAULT | TYPE |
---|---|---|---|---|
tag | Pick a specific android image tag: https://hub.docker.com/r/cimg/android/tags
| No | 2024.11.1 | string |
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
# This code is licensed from CircleCI to the user under the MIT license.
# See here for details: https://circleci.com/developer/orbs/licensing
version: 2.1
description: |
Start Genymotion Android virtual device, connect through ADB and stop device on Genymotion Cloud SaaS for mobile automation testing.
display:
home_url: https://cloud.geny.io
source_url: https://github.com/Genymobile/genymotion-saas-orb
commands:
setup:
description: |
Download gmsaas cli and authenticate the user.
parameters:
api_token:
default: GMCLOUD_SAAS_APITOKEN
description: 'API Token of your Genymotion Cloud SaaS account. Set this to the name of the environment variable: GMCLOUD_SAAS_APITOKEN.'
type: env_var_name
gmsaas_version:
default: ""
description: Install a specific version of gmsaas, default is the latest
type: string
steps:
- run:
command: |
# Update distrib and install pip3
sudo apt update
sudo apt-get install python3-pip
# Install Genymotion Cloud SaaS cli
if [ -z "<< parameters.gmsaas_version >>" ]; then
pip3 install gmsaas
else
pip3 install gmsaas==<< parameters.gmsaas_version >>
fi
name: Install gmsaas cli
- run:
command: |
gmsaas config set android-sdk-path $ANDROID_HOME
name: Configure gmsaas
- run:
command: |
gmsaas auth token ${<< parameters.api_token >>}
gmsaas doctor
name: Authenticate
start-instance:
description: |
Start Android instance on Genymotion Cloud SaaS
parameters:
adb_serial_port:
default: -1
description: ADB serial port to use when the instance is connected to ADB.
type: integer
recipe_uuid:
description: |
Instance recipe to use. Recipes can be listed with command line 'gmsaas recipes list',
or check https://support.genymotion.com/hc/en-us/articles/360007473658-Supported-Android-devices-templates-for-Genymotion-Cloud-SaaS
for a comprehensive list of all currently available recipes UUIDs.
type: string
steps:
- run:
command: |
ADB_SERIAL_PORT="<< parameters.adb_serial_port >>"
if [ -z "<< parameters.recipe_uuid >>" ]; then
echo "Please set a recipe uuid"
exit 1
else
export GMSAAS_USER_AGENT_EXTRA_DATA=circleci
INSTANCE_UUID=$(gmsaas instances start << parameters.recipe_uuid >> CircleCI-device-$CIRCLE_BUILD_NUM )
echo "export INSTANCE_UUID=$INSTANCE_UUID" >> $BASH_ENV
fi
if [ "${ADB_SERIAL_PORT}" != "-1" ]; then
port_option="--adb-serial-port ${ADB_SERIAL_PORT}"
fi
gmsaas instances adbconnect $INSTANCE_UUID $port_option
name: Start Android instance
stop-instance:
description: |
Stop Android instance on Genymotion Cloud SaaS
parameters:
instance_uuid:
default: $INSTANCE_UUID
description: Instance to stop. The UUID of the instance to stop is automatically retrieved. No need to set manually.
type: string
steps:
- run:
command: |
gmsaas instances stop << parameters.instance_uuid >>
echo "Print gmsaas instances list:"
gmsaas instances list
name: Stop Android instance
when: always
executors:
default:
description: |
Android SDK tools are required for this orb, so we will use Circle CI image for Android: https://hub.docker.com/r/cimg/android/tags
docker:
- image: cimg/android:<<parameters.tag>>
parameters:
tag:
default: 2024.11.1
description: |
Pick a specific android image tag: https://hub.docker.com/r/cimg/android/tags
type: string
jobs:
run_tests:
description: Start Android instance, test your app and stop instance.
executor:
name: default
tag: <<parameters.tag>>
parameters:
adb_serial_port:
default: -1
description: ADB serial port to use when the instance is connected to ADB.
type: integer
recipe_uuid:
default: ""
description: |
Instance recipe to use. Recipes can be listed with command line 'gmsaas recipes list',
or check https://support.genymotion.com/hc/en-us/articles/360007473658-Supported-Android-devices-templates-for-Genymotion-Cloud-SaaS
for a comprehensive list of all currently available recipes UUIDs.
type: string
steps:
description: Steps to execute once the Genymotion Cloud SaaS instance is available
type: steps
tag:
default: 2024.11.1
description: |
Pick a specific circleci/android image tag: https://hub.docker.com/r/cimg/android/tags
type: string
steps:
- checkout
- setup
- start-instance:
adb_serial_port: <<parameters.adb_serial_port>>
recipe_uuid: <<parameters.recipe_uuid>>
- steps: << parameters.steps >>
- stop-instance
examples:
override-credentials:
description: |
How to :
- Configure your Genymotion Cloud SaaS account by overriding default credentials (GMCLOUD_SAAS_APITOKEN environment variables).
In this example, you can use API TOKEN credentials which have been set as environment variables.
Credentials must be set as environment variables.
- Start Android instance, test your app and stop instance.
usage:
version: "2.1"
orbs:
genymotion-saas: genymotion/genymotion-saas@x.y
jobs:
build:
executor: genymotion-saas/default
steps:
- genymotion-saas/setup:
api_token: API_TOKEN
- genymotion-saas/start-instance:
recipe_uuid: ""
- run: echo "Run your tests here"
- genymotion-saas/stop-instance
workflows: null
specify-adb-serial-port:
description: |
How to : - Configure your Genymotion Cloud SaaS account. Credentials are set as environment variables (GMCLOUD_SAAS_EMAIL & GMCLOUD_SAAS_PASSWORD) - Start Android instance, connect through ADB with a specific ADB serial port, test your app and stop instance.
usage:
version: "2.1"
orbs:
genymotion-saas: genymotion/genymotion-saas@x.y
jobs:
build:
executor: genymotion-saas/default
steps:
- genymotion-saas/setup
- genymotion-saas/start-instance:
adb_serial_port: ""
recipe_uuid: ""
- run: echo "Run your tests here"
- genymotion-saas/stop-instance
workflows: null
start_stop:
description: |
How to : - Configure your Genymotion Cloud SaaS account. Credentials are set as environment variables (GMCLOUD_SAAS_EMAIL & GMCLOUD_SAAS_PASSWORD) - Start Android instance, test your app and stop instance.
usage:
version: "2.1"
orbs:
genymotion-saas: genymotion/genymotion-saas@x.y
jobs:
build:
executor: genymotion-saas/default
steps:
- genymotion-saas/setup
- genymotion-saas/start-instance:
recipe_uuid: ""
- run: echo "Run your tests here"
- genymotion-saas/stop-instance
workflows: null
start_stop_with_job:
description: |
Easily start and stop Genymotion Cloud Saas instance with a single job supplied by this orb.
usage:
version: "2.1"
orbs:
genymotion-saas: genymotion/genymotion-saas@x.y
workflows:
basic_workflow:
jobs:
- genymotion-saas/run_tests:
recipe_uuid: c52fdfc2-6914-4266-aa6e-50258f50ef91
steps:
- run: echo "run your test here"
- genymotion-saas/run_tests:
adb_serial_port: 12345
recipe_uuid: c52fdfc2-6914-4266-aa6e-50258f50ef91
steps:
- run: echo "run your test here"