Skip to content

Commit c70c113

Browse files
committed
json file support
1 parent afe5213 commit c70c113

5 files changed

Lines changed: 45 additions & 2 deletions

File tree

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,40 @@ Available outputs:
402402
- `DEVICE_CLOUD_UPLOAD_STATUS`: Status of the test run (PENDING, RUNNING, PASSED, FAILED, CANCELLED)
403403
- `DEVICE_CLOUD_APP_BINARY_ID`: ID of the uploaded app binary in Device Cloud
404404

405+
# JSON Output File
406+
407+
You can write the test results to a JSON file for easier processing or archiving:
408+
409+
```yaml
410+
- uses: devicecloud-dev/device-cloud-for-maestro@v1
411+
with:
412+
api-key: ${{ secrets.DCD_API_KEY }}
413+
app-file: app.apk
414+
json-file: true
415+
```
416+
417+
This will create a file named `<run_name>_dcd.json` or `<upload_id>_dcd.json` if no name is provided, containing all test results and metadata.
418+
419+
Example JSON file content:
420+
```json
421+
{
422+
"uploadId": "abcd1234-5678-efgh-9012-ijklmnopqrst",
423+
"consoleUrl": "https://console.devicecloud.dev/results?upload=abcd1234-5678-efgh-9012-ijklmnopqrst",
424+
"appBinaryId": "app-binary-5678",
425+
"status": "PASSED",
426+
"flowResults": [
427+
{
428+
"name": "login_test",
429+
"status": "PASSED"
430+
},
431+
{
432+
"name": "checkout_flow",
433+
"status": "PASSED"
434+
}
435+
]
436+
}
437+
```
438+
405439
# All Available Options
406440

407441
Here's a complete example showing all available options:
@@ -452,7 +486,8 @@ Here's a complete example showing all available options:
452486
quiet: false
453487
ignore-sha-check: false
454488
download-artifacts: FAILED # ALL|FAILED
489+
json-file: true # Write test results to a JSON file
455490
api-url: https://api.devicecloud.dev
456491
config: path/to/maestro-config.yaml
457492
runner-type: default # Experimental: m1|m4
458-
```
493+
```

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ inputs:
3838
env:
3939
description: 'One or more environment variables to inject into your flows'
4040
required: false
41+
json-file:
42+
description: 'Write JSON output to a file with name <run_name>_dcd.json or <upload_id>_dcd.json if no name is provided'
43+
required: false
4144
exclude-flows:
4245
description: 'Sub directories to ignore when building the flow file list'
4346
required: false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "dcd-github-action",
33
"description": "run maestro tests on devicecloud.dev",
44
"author": "devicecloud.dev",
5-
"version": "1.3.5",
5+
"version": "1.3.6",
66
"main": "src/index.ts",
77
"license": "MIT",
88
"engines": {

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ const run = async (): Promise<void> => {
100100
includeTags,
101101
iOSVersion,
102102
iosDevice,
103+
jsonFile,
103104
maestroVersion,
104105
name,
105106
orientation,
@@ -138,6 +139,7 @@ const run = async (): Promise<void> => {
138139
retry,
139140
'x86-arch': x86Arch,
140141
'runner-type': runnerType,
142+
'json-file': jsonFile,
141143
};
142144

143145
let paramsString = Object.keys(params).reduce((acc, key) => {

src/methods/params.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type Params = {
3030
x86Arch?: boolean;
3131
config?: string;
3232
runnerType?: string;
33+
jsonFile?: boolean;
3334
};
3435

3536
function getAndroidApiLevel(apiLevel?: string): number | undefined {
@@ -170,6 +171,7 @@ export async function getParameters(): Promise<Params> {
170171
const x86Arch = core.getInput('x86-arch', { required: false }) === 'true';
171172
const config = core.getInput('config', { required: false });
172173
const runnerType = core.getInput('runner-type', { required: false });
174+
const jsonFile = core.getInput('json-file', { required: false }) === 'true';
173175

174176
if (!(appFilePath !== '') !== (appBinaryId !== '')) {
175177
throw new Error('Either app-file or app-binary-id must be used');
@@ -212,5 +214,6 @@ export async function getParameters(): Promise<Params> {
212214
x86Arch,
213215
config,
214216
runnerType,
217+
jsonFile,
215218
};
216219
}

0 commit comments

Comments
 (0)