|
1 | | -# devicecloud.dev - Trigger Mobile App Test Run |
| 1 | +# Device Cloud Action |
2 | 2 |
|
3 | | -This GitHub Action leverages devicecloud.dev to trigger a mobile app UI test. |
| 3 | +This action is a swap in replacement for the [Maestro Cloud Action](https://github.com/mobile-dev-inc/action-maestro-cloud) |
4 | 4 |
|
5 | | -## Installation |
| 5 | +It lets you run your flows on [devicecloud.dev](https://devicecloud.dev) to save money and access extra features. |
6 | 6 |
|
7 | | -1. Navigate to the [GitHub Marketplace](https://github.com/marketplace/actions/dcd-trigger-mobile-app-test-run). |
8 | | -2. On the action page, click `Use latest version` button. |
9 | | -3. Follow the prompts from github to install the action. |
| 7 | +# Using the action |
10 | 8 |
|
11 | | -## Configuration |
12 | | - |
13 | | -Here is an example of how to set up the devicecloud.dev GitHub Action in your workflow file: |
14 | | - |
15 | | -```yaml |
16 | | -name: devicecloud.dev Mobile App Test Run |
17 | | -on: |
18 | | - push: |
19 | | - branches: [production, staging] |
20 | | -jobs: |
21 | | - build: |
22 | | - runs-on: ubuntu-latest |
23 | | - steps: |
24 | | - - name: devicecloud.dev - Trigger Mobile App Test Run |
25 | | - uses: devicecloud-dev/action-trigger-test-run@v1 |
26 | | - with: |
27 | | - api-key: ${{ secrets.DCD_API_KEY }} |
28 | | - app-file: path/to/build.apk |
29 | | - workspace: path/to/workspace |
30 | | - env: '{"VAR_1":"Some variable", "VAR_2":"A different variable"}' |
31 | | -``` |
32 | | -
|
33 | | -In this example, this action will run whenever a push to the production or staging branch occurs. |
34 | | -
|
35 | | -### Storing Secrets |
36 | | -
|
37 | | -The `api-key` should be kept private. You can use GitHub secrets to protect it. To add a secret: |
38 | | - |
39 | | -1. Navigate to your GitHub repository and click on the `Settings` tab. |
40 | | -2. Click on `Secrets` in the left sidebar. |
41 | | -3. Click `New repository secret`. |
42 | | -4. Enter `DCD_API_KEY` as the name for the secrets, and paste the corresponding key in the value field. |
43 | | - |
44 | | -## Inputs |
45 | | - |
46 | | -### `api-key` |
47 | | - |
48 | | -**Required** - devicecloud.dev Secret Key, find this in your devicecloud.dev dashboard. |
49 | | -It follows the UUID schema, e.g. `85e67636-7652-45a8-94ac-e7cdd7e8f869`, however we recommend using Github Secrets for this parameter and provide as follows: |
| 9 | +Add the following to your workflow. Note that you can use the `v1` tag if you want to keep using the latest version of the action, which will automatically resolve to all `v1.minor.patch` versions as they get published. |
50 | 10 |
|
51 | 11 | ```yaml |
52 | | ---- |
53 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
54 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 12 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
55 | 13 | with: |
56 | 14 | api-key: ${{ secrets.DCD_API_KEY }} |
| 15 | + app-file: <path_to_your_app_file> |
57 | 16 | ``` |
58 | 17 |
|
59 | | -### `app-file` |
| 18 | +# Triggers |
60 | 19 |
|
61 | | -**Required if binary-id is not specified** - App binary to run your flows against. |
| 20 | +Trigger this action on (1) pushes to your main branch and (2) pull requests opened against your main branch: |
62 | 21 |
|
63 | 22 | ```yaml |
64 | | ---- |
65 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
66 | | - uses: dcd-com/action-trigger-test-run@v1 |
67 | | - with: |
68 | | - api-key: ${{ secrets.DCD_API_KEY }} |
69 | | - app-file: /path/to/your_app.apk |
| 23 | +on: |
| 24 | + push: |
| 25 | + branches: [master] |
| 26 | + pull_request: |
| 27 | + branches: [master] |
70 | 28 | ``` |
71 | 29 |
|
72 | | -### `app-binary-id` |
73 | | - |
74 | | -**Required if app-file is not specified** - The ID of the app binary previously uploaded to Maestro Cloud. |
| 30 | +If you need to use the `pull_request_target` trigger to support repo forks, check out the HEAD of the pull request to ensure that you're running the analysis against the changed code: |
75 | 31 |
|
76 | 32 | ```yaml |
77 | | ---- |
78 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
79 | | - uses: dcd-com/action-trigger-test-run@v1 |
80 | | - with: |
81 | | - api-key: ${{ secrets.DCD_API_KEY }} |
82 | | - app-binary-id: your-app-binary-id |
| 33 | +on: |
| 34 | + push: |
| 35 | + branches: [master] |
| 36 | + pull_request_target: |
| 37 | + branches: [master] |
| 38 | +jobs: |
| 39 | + run-maestro-on-dcd: |
| 40 | + name: Run Flows on devicecloud.dev |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v3 |
| 43 | + with: |
| 44 | + ref: ${{ github.event.pull_request.head.sha }} # Checkout PR HEAD |
83 | 45 | ``` |
84 | 46 |
|
85 | | -### `workspace` |
86 | | - |
87 | | -**Required** - The path to the flow file or folder containing your flows. |
| 47 | +# Android |
88 | 48 |
|
89 | 49 | ```yaml |
90 | | ---- |
91 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
92 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 50 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
93 | 51 | with: |
94 | 52 | api-key: ${{ secrets.DCD_API_KEY }} |
95 | | - workspace: /path/to/flows |
| 53 | + app-file: app/build/outputs/apk/debug/app-debug.apk |
96 | 54 | ``` |
97 | 55 |
|
98 | | -### `env` |
| 56 | +`app-file` should point to an x86 compatible APK file, either directly to the file or a glob pattern matching the file name. When using a pattern, the first matched file will be used. |
99 | 57 |
|
100 | | -**Required** - One or more environment variables to inject into your flows. The variables must be passed as stringified JSON in the form `{"VAR_1":"VAL_1","VAR_2":"VAL_2"}` |
| 58 | +# iOS |
101 | 59 |
|
102 | 60 | ```yaml |
103 | | ---- |
104 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
105 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 61 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
106 | 62 | with: |
107 | 63 | api-key: ${{ secrets.DCD_API_KEY }} |
108 | | - env: '{"VAR_1":"Some variable", "VAR_2":"A different variable"}' |
| 64 | + app-file: <app_name>.app |
109 | 65 | ``` |
110 | 66 |
|
111 | | -### `android-api-level` |
112 | | - |
113 | | -**Optional** - [Android only] Android API level to run your flow against. Options: `32`, `33`, `34`. |
114 | | - |
115 | | -```yaml |
116 | | ---- |
117 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
118 | | - uses: dcd-com/action-trigger-test-run@v1 |
119 | | - with: |
120 | | - api-key: ${{ secrets.DCD_API_KEY }} |
121 | | - android-api-level: 33 |
122 | | -``` |
| 67 | +`app-file` should point to an Apple silicon compatible Simulator .app build, either directly to the file or a glob pattern matching the file name. When using a pattern, the first matched file will be used. |
123 | 68 |
|
124 | | -### `android-device` |
| 69 | +# Custom workspace location |
125 | 70 |
|
126 | | -**Optional** - [Android only] Android device to run your flow against. Options: `pixel-6`, `pixel-6a`, `pixel-6-pro`, `pixel-7`, `pixel-7-pro`, `generic-tablet`. |
| 71 | +By default, the action is looking for a `.maestro` folder with Maestro flows in the root directory of the project. If you would like to customize this behaviour, you can override it with a `workspace` argument: |
127 | 72 |
|
128 | 73 | ```yaml |
129 | | ---- |
130 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
131 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 74 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
132 | 75 | with: |
133 | 76 | api-key: ${{ secrets.DCD_API_KEY }} |
134 | | - android-device: pixel-6 |
| 77 | + app-file: app.zip |
| 78 | + workspace: myFlows/ |
135 | 79 | ``` |
136 | 80 |
|
137 | | -### `async` |
| 81 | +# Custom name |
138 | 82 |
|
139 | | -**Optional** - Wait for the results of the run asynchronously. |
| 83 | +A name will automatically be provided according to the following order: |
140 | 84 |
|
141 | | -```yaml |
142 | | ---- |
143 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
144 | | - uses: dcd-com/action-trigger-test-run@v1 |
145 | | - with: |
146 | | - api-key: ${{ secrets.DCD_API_KEY }} |
147 | | - async: true |
148 | | -``` |
149 | | - |
150 | | -### `exclude-flows` |
| 85 | +1. If it is a Pull Request, use Pull Request title as name |
| 86 | +2. If it is a normal push, use commit message as name |
| 87 | +3. If for some reason the commit message is not available, use the commit SHA as name |
151 | 88 |
|
152 | | -**Optional** - Subdirectories to ignore when building the flow file list. |
| 89 | +If you want to override this behaviour and specify your own name, you can do so by setting the `name` argument: |
153 | 90 |
|
154 | 91 | ```yaml |
155 | | ---- |
156 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
157 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 92 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
158 | 93 | with: |
159 | 94 | api-key: ${{ secrets.DCD_API_KEY }} |
160 | | - exclude-flows: 'test/exclude-directory' |
| 95 | + app-file: app.zip |
| 96 | + name: My Upload |
161 | 97 | ``` |
162 | 98 |
|
163 | | -### `exclude-tags` |
| 99 | +# Run in async mode |
164 | 100 |
|
165 | | -**Optional** - Flows which have these tags will be excluded from the run. |
| 101 | +If you don't want the action to wait until the Upload has been completed as is the default behaviour, set the `async` argument to `true`: |
166 | 102 |
|
167 | 103 | ```yaml |
168 | | ---- |
169 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
170 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 104 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
171 | 105 | with: |
172 | 106 | api-key: ${{ secrets.DCD_API_KEY }} |
173 | | - exclude-tags: 'tag1,tag2' |
| 107 | + app-file: app.zip |
| 108 | + async: true |
174 | 109 | ``` |
175 | 110 |
|
176 | | -### `google-play` |
| 111 | +# Adding environment variables |
177 | 112 |
|
178 | | -**Optional** - [Android only] Run your flow against Google Play devices. |
| 113 | +If you want to pass environment variables along with your upload, The variables must be passed as stringified JSON in the form `{"VAR_1":"VAL_1","VAR_2":"VAL_2"}`: |
179 | 114 |
|
180 | 115 | ```yaml |
181 | | ---- |
182 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
183 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 116 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
184 | 117 | with: |
185 | 118 | api-key: ${{ secrets.DCD_API_KEY }} |
186 | | - google-play: true |
| 119 | + app-file: app.zip |
| 120 | + env: '{"VAR_1":"Some variable", "VAR_2":"A different variable"}' |
187 | 121 | ``` |
188 | 122 |
|
189 | | -### `include-tags` |
| 123 | +# Using tags |
| 124 | + |
| 125 | +You can use Maestro [Tags](https://maestro.mobile.dev/cli/tags) to filter which Flows to send to Maestro Cloud: |
190 | 126 |
|
191 | | -**Optional** - Only flows which have these tags will be included in the run. |
| 127 | +You can either pass a single value, or comma-separated (`,`) values. |
192 | 128 |
|
193 | 129 | ```yaml |
194 | | ---- |
195 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
196 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 130 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
197 | 131 | with: |
198 | 132 | api-key: ${{ secrets.DCD_API_KEY }} |
199 | | - include-tags: 'tag3,tag4' |
| 133 | + app-file: app.zip |
| 134 | + include-tags: dev, pull-request |
| 135 | + exclude-tags: excludeTag |
200 | 136 | ``` |
201 | 137 |
|
202 | | -### `ios-device` |
| 138 | +# Specifying Android API Level |
203 | 139 |
|
204 | | -**Optional** - [iOS only] iOS device to run your flow against. Options: `iphone-12`, `iphone-12-mini`, `iphone-12-pro-max`, `iphone-13`, `iphone-13-mini`, `iphone-13-pro-max`, `iphone-14`, `iphone-14-plus`, `iphone-14-pro`, `iphone-14-pro-max`, `iphone-15`, `iphone-15-plus`, `iphone-15-pro`, |
| 140 | +You can specify what Android API level to use when running in devicecloud.dev using the `android-api-level` parameter. |
| 141 | + |
| 142 | +The default API level is 33. [Refer to docs](https://docs.devicecloud.dev/getting-started/devices-configuration) for available Android emulator API levels. |
205 | 143 |
|
206 | 144 | ```yaml |
207 | | ---- |
208 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
209 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 145 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
210 | 146 | with: |
211 | 147 | api-key: ${{ secrets.DCD_API_KEY }} |
212 | | - ios-device: iphone-14 |
| 148 | + app-file: app.apk |
| 149 | + android-api-level: 32 |
213 | 150 | ``` |
214 | 151 |
|
215 | | -### `ios-version` |
| 152 | +# Specifying iOS version |
| 153 | + |
| 154 | +You can specify what **major** iOS Version to use when running in devicecloud.dev using the `ios-version` parameter. |
216 | 155 |
|
217 | | -**Optional** - [iOS only] iOS version to run your flow against. Options: `15`, `16`, `17`. |
| 156 | +The default iOS version is 17. [Refer to docs](https://docs.devicecloud.dev/getting-started/devices-configuration) for available iOS simulator versions. |
218 | 157 |
|
219 | 158 | ```yaml |
220 | | ---- |
221 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
222 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 159 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
223 | 160 | with: |
224 | 161 | api-key: ${{ secrets.DCD_API_KEY }} |
| 162 | + app-file: app.zip |
225 | 163 | ios-version: 16 |
226 | 164 | ``` |
227 | 165 |
|
228 | | -### `name` |
| 166 | +# Using an already uploaded App |
229 | 167 |
|
230 | | -**Optional** - A custom name for your upload (useful for tagging commits etc). |
| 168 | +You can use an already uploaded App binary in devicecloud.dev using the `app-binary-id` parameter. |
231 | 169 |
|
232 | 170 | ```yaml |
233 | | ---- |
234 | | -- name: devicecloud.dev - Trigger Mobile App Test Run |
235 | | - uses: dcd-com/action-trigger-test-run@v1 |
| 171 | +- uses: devicecloud.dev/maestro-device-cloud@v1 |
236 | 172 | with: |
237 | 173 | api-key: ${{ secrets.DCD_API_KEY }} |
238 | | - name: 'My Custom Upload Name' |
| 174 | + app-binary-id: <your-app-binary-id> |
239 | 175 | ``` |
0 commit comments