Skip to content

Commit c082296

Browse files
authored
feat: branch and result_file params were supported (#18)
feat: branch and result_file params were supported
1 parent 605b087 commit c082296

File tree

7 files changed

+65
-19
lines changed

7 files changed

+65
-19
lines changed

.github/workflows/ci.yaml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Setup Marathon Cloud
2121
uses: MarathonLabs/[email protected]
2222
with:
23-
version: "1.0.30"
23+
version: "1.0.38"
2424

2525
- name: Run Marathon Cloud action-invoke
2626
uses: ./
@@ -29,7 +29,7 @@ jobs:
2929
application: "example/app.apk"
3030
testApplication: "example/appTest.apk"
3131
platform: "android"
32-
name: "android_3_0"
32+
name: "android_3_0_simple"
3333

3434
- name: Show failure message
3535
if: failure()
@@ -53,7 +53,7 @@ jobs:
5353
- name: Setup Marathon Cloud
5454
uses: MarathonLabs/[email protected]
5555
with:
56-
version: "1.0.30"
56+
version: "1.0.38"
5757

5858
- name: Run Marathon Cloud action-invoke
5959
uses: ./
@@ -62,8 +62,10 @@ jobs:
6262
application: "example/app.apk"
6363
testApplication: "example/appTest.apk"
6464
platform: "android"
65-
name: "android_3_0"
65+
name: "android_3_0_output"
6666
output: "output"
67+
resultFile: "some-result.json"
68+
branch: "develop"
6769

6870
- name: Check if output folder exists and is not empty
6971
run: |
@@ -74,13 +76,27 @@ jobs:
7476
exit 1
7577
fi
7678
79+
- name: Check if resultFile exists
80+
run: |
81+
if [ ! -f "some-result.json" ]; then
82+
echo "Error: some-result.json does not exist."
83+
exit 1
84+
fi
85+
7786
- name: Upload artifact
7887
if: always()
79-
uses: actions/upload-artifact@v2
88+
uses: actions/upload-artifact@v4
8089
with:
8190
name: android_output
8291
path: output
8392

93+
- name: Upload resultFile
94+
if: always()
95+
uses: actions/upload-artifact@v4
96+
with:
97+
name: some-result.json
98+
path: some-result.json
99+
84100
- name: Show failure message
85101
if: failure()
86102
run: |
@@ -103,7 +119,7 @@ jobs:
103119
- name: Setup Marathon Cloud
104120
uses: MarathonLabs/[email protected]
105121
with:
106-
version: "1.0.30"
122+
version: "1.0.38"
107123

108124
- name: Run Marathon Cloud action-invoke
109125
uses: ./
@@ -112,7 +128,7 @@ jobs:
112128
application: "example/app.apk"
113129
testApplication: "example/appTestFailed.apk"
114130
platform: "android"
115-
name: "android_3_0"
131+
name: "android_3_0_failed"
116132
output: "output"
117133
ignoreTestFailures: "true"
118134

@@ -127,7 +143,7 @@ jobs:
127143
128144
- name: Upload artifact
129145
if: always()
130-
uses: actions/upload-artifact@v2
146+
uses: actions/upload-artifact@v4
131147
with:
132148
name: android_failed_output
133149
path: output
@@ -154,7 +170,7 @@ jobs:
154170
- name: Setup Marathon Cloud
155171
uses: MarathonLabs/[email protected]
156172
with:
157-
version: "1.0.30"
173+
version: "1.0.38"
158174

159175
- name: Run Marathon Cloud action-invoke
160176
uses: ./
@@ -177,7 +193,7 @@ jobs:
177193
178194
- name: Upload artifact
179195
if: always()
180-
uses: actions/upload-artifact@v2
196+
uses: actions/upload-artifact@v4
181197
with:
182198
name: ios_output
183199
path: output

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ This action wraps [marathon-cloud][] CLI in your GitHub Actions workflow.
2828
| `xctestrunTestEnv` (optional) | Xctestrun testing environment variables, format: 'VAR1=VALUE1,VAR2=VALUE2' | `` | `VAR1=VALUE1,VAR2=VALUE2` |
2929
| `ignoreTestFailures` (optional) | When tests fail and this option is true then GHA will exit with code 0. By default, GHA will exit with code 1 in case of test failures and 0 for passing tests [possible values: true, false] | `false` | `true`, `false` |
3030
| `pullFiles` (optional) | Pull files from devices after the test run. The format is `ROOT1:PATH1,ROOT2:PATH2` where ROOT is one of [EXTERNAL_STORAGE, APP_DATA] and PATH is a relative path to the target file or directory. Note: Files with the same name and path from different devices may overwrite each other. | `` | `EXTERNAL_STORAGE:Documents/some-results,APP_DATA:files/my_folder/some_file.txt` |
31+
| `resultFile` (optional) | Result file path in a machine-readable format. You can specify the format via extension [yaml,json] | `result.json` | `some_result.json` |
32+
| `branch` (optional) | Branch for run, for example it could be git branch like develop or feature/about-screen | `` | `develop` |
3133

3234
## Usage Examples
3335

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ inputs:
6767
pullFiles:
6868
description: "Pull files from devices after the test run. The format is 'ROOT1:PATH1,ROOT2:PATH2' where ROOT is one of [EXTERNAL_STORAGE, APP_DATA] and PATH is a relative path to the target file or directory. Example: EXTERNAL_STORAGE:Documents/some-results,APP_DATA:files/my_folder/some_file.txt. Note: Files with the same name and path from different devices may overwrite each other."
6969
required: false
70+
resultFile:
71+
description: "Result file path in a machine-readable format. You can specify the format via extension [yaml,json]. Default file: result.json"
72+
required: false
73+
branch:
74+
description: "Branch for run, for example it could be git branch like develop or feature/about-screen"
75+
required: false
7076
branding:
7177
icon: "play"
7278
color: "purple"

lib/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3986,7 +3986,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
39863986
Object.defineProperty(exports, "__esModule", ({ value: true }));
39873987
exports.buildDownloadArgs = exports.buildiOSArgs = exports.buildAndroidArgs = void 0;
39883988
const core = __importStar(__nccwpck_require__(186));
3989-
function buildAndroidArgs(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures, resultFile, pullFiles) {
3989+
function buildAndroidArgs(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures, resultFile, pullFiles, branch) {
39903990
const args = [
39913991
"run",
39923992
"android",
@@ -4049,10 +4049,13 @@ function buildAndroidArgs(apiKey, application, testApplication, link, osVersion,
40494049
args.push("--pull-files", env.trim());
40504050
});
40514051
}
4052+
if (branch) {
4053+
args.push("--branch", branch);
4054+
}
40524055
return args;
40534056
}
40544057
exports.buildAndroidArgs = buildAndroidArgs;
4055-
function buildiOSArgs(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures, resultFile, pullFiles) {
4058+
function buildiOSArgs(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures, resultFile, pullFiles, branch) {
40564059
const args = [
40574060
"run",
40584061
"ios",
@@ -4117,6 +4120,9 @@ function buildiOSArgs(apiKey, application, testApplication, link, osVersion, sys
41174120
if (pullFiles) {
41184121
core.warning(`pullFiles argument is only for Android`);
41194122
}
4123+
if (branch) {
4124+
args.push("--branch", branch);
4125+
}
41204126
return args;
41214127
}
41224128
exports.buildiOSArgs = buildiOSArgs;
@@ -4207,17 +4213,18 @@ function main() {
42074213
const xctestrunEnv = core.getInput("xctestrunEnv");
42084214
const xctestrunTestEnv = core.getInput("xctestrunTestEnv");
42094215
const ignoreTestFailures = core.getInput("ignoreTestFailures").toLowerCase() === "true";
4210-
const resultFile = "result.json";
4216+
const resultFile = core.getInput("resultFile") || "result.json";
42114217
const pullFiles = core.getInput("pullFiles");
4218+
const branch = core.getInput("branch");
42124219
let args = [];
42134220
const lowercasePlatform = platform.toLowerCase();
42144221
switch (lowercasePlatform) {
42154222
case "android": {
4216-
args = (0, command_1.buildAndroidArgs)(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, "", resultFile, pullFiles);
4223+
args = (0, command_1.buildAndroidArgs)(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, "", resultFile, pullFiles, branch);
42174224
break;
42184225
}
42194226
case "ios": {
4220-
args = (0, command_1.buildiOSArgs)(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, "", resultFile, pullFiles);
4227+
args = (0, command_1.buildiOSArgs)(apiKey, application, testApplication, link, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, "", resultFile, pullFiles, branch);
42214228
break;
42224229
}
42234230
default: {

package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/command.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function buildAndroidArgs(
2121
ignoreTestFailures: string,
2222
resultFile: string,
2323
pullFiles: string,
24+
branch: string,
2425
): string[] {
2526
const args = [
2627
"run",
@@ -100,6 +101,11 @@ export function buildAndroidArgs(
100101
args.push("--pull-files", env.trim());
101102
});
102103
}
104+
105+
if (branch) {
106+
args.push("--branch", branch);
107+
}
108+
103109
return args;
104110
}
105111

@@ -124,6 +130,7 @@ export function buildiOSArgs(
124130
ignoreTestFailures: string,
125131
resultFile: string,
126132
pullFiles: string,
133+
branch: string,
127134
): string[] {
128135
const args = [
129136
"run",
@@ -210,6 +217,10 @@ export function buildiOSArgs(
210217
core.warning(`pullFiles argument is only for Android`);
211218
}
212219

220+
if (branch) {
221+
args.push("--branch", branch);
222+
}
223+
213224
return args;
214225
}
215226

src/run.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ async function main() {
2727
const xctestrunTestEnv = core.getInput("xctestrunTestEnv");
2828
const ignoreTestFailures =
2929
core.getInput("ignoreTestFailures").toLowerCase() === "true";
30-
const resultFile = "result.json";
30+
const resultFile = core.getInput("resultFile") || "result.json";
3131
const pullFiles = core.getInput("pullFiles");
32+
const branch = core.getInput("branch");
3233

3334
let args: string[] = [];
3435

@@ -56,6 +57,7 @@ async function main() {
5657
"",
5758
resultFile,
5859
pullFiles,
60+
branch,
5961
);
6062
break;
6163
}
@@ -81,6 +83,7 @@ async function main() {
8183
"",
8284
resultFile,
8385
pullFiles,
86+
branch,
8487
);
8588
break;
8689
}

0 commit comments

Comments
 (0)