Skip to content

Commit

Permalink
feat(args): name and device args supported (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
matzuk committed Feb 23, 2024
1 parent 4ac14f6 commit 9334002
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ This action wraps [marathon-cloud][] CLI in your GitHub Actions workflow.
| `isolated` (optional) | Run each test in isolation, i.e. isolated batching | `` | `` |
| `flavor` (optional) | Type of tests to run | `` | `native`, `js-test-appium`, `python-robotframework-appium` |
| `filterFile` (optional) | File containing test filters in YAML format, following the schema described at https://docs.marathonlabs.io/runner/configuration/filtering/#filtering-logic. For iOS see also https://docs.marathonlabs.io/runner/next/ios#test-plans. | `` | `` |
| `wait` (optional) | Wait for test run to finish if true, exits after triggering a run if false. | `` | `false` |
wait:
description: ""
required: false
| `wait` (optional) | Wait for test run to finish if true, exits after triggering a run if false. | `` | `false` |
| `name` (optional) | Name for run, for example it could be description of commit. | `` | AmazingRun |
| `device` (optional) | Device type (Only for Android now). | `phone` | `phone`, `tv`, `watch` |

## Usage Examples

Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ inputs:
wait:
description: "Wait for test run to finish if true, exits after triggering a run if false. Defaults to true"
required: false
name:
description: "Name for run, for example it could be description of commit"
required: false
device:
description: "Device type (Only for Android now). Default: [phone]. Possible values: [phone, tv, watch]"
required: false
branding:
icon: "play"
color: "purple"
Expand Down
19 changes: 15 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3986,7 +3986,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.buildiOSArgs = exports.buildAndroidArgs = void 0;
const core = __importStar(__nccwpck_require__(186));
function buildAndroidArgs(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait) {
function buildAndroidArgs(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device) {
const args = [
"run",
"android",
Expand Down Expand Up @@ -4021,10 +4021,16 @@ function buildAndroidArgs(apiKey, application, testApplication, link, output, os
if (wait) {
args.push("--wait", wait);
}
if (name) {
args.push("--name", name);
}
if (device) {
args.push("--device", device);
}
return args;
}
exports.buildAndroidArgs = buildAndroidArgs;
function buildiOSArgs(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait) {
function buildiOSArgs(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name) {
const args = [
"run",
"ios",
Expand Down Expand Up @@ -4059,6 +4065,9 @@ function buildiOSArgs(apiKey, application, testApplication, link, output, osVers
if (wait) {
args.push("--wait", wait);
}
if (name) {
args.push("--name", name);
}
return args;
}
exports.buildiOSArgs = buildiOSArgs;
Expand Down Expand Up @@ -4122,15 +4131,17 @@ function main() {
const flavor = core.getInput("flavor");
const filterFile = core.getInput("filterFile");
const wait = core.getInput("wait");
const name = core.getInput("name");
const device = core.getInput("device");
let args = [];
const lowercasePlatform = platform.toLowerCase();
switch (lowercasePlatform) {
case "android": {
args = (0, command_1.buildAndroidArgs)(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait);
args = (0, command_1.buildAndroidArgs)(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device);
break;
}
case "ios": {
args = (0, command_1.buildiOSArgs)(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait);
args = (0, command_1.buildiOSArgs)(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name);
break;
}
default: {
Expand Down
15 changes: 15 additions & 0 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export function buildAndroidArgs(
flavor: string,
filterFile: string,
wait: string,
name: string,
device: string,
): string[] {
const args = [
"run",
Expand Down Expand Up @@ -56,6 +58,14 @@ export function buildAndroidArgs(
args.push("--wait", wait);
}

if (name) {
args.push("--name", name);
}

if (device) {
args.push("--device", device);
}

return args;
}

Expand All @@ -71,6 +81,7 @@ export function buildiOSArgs(
flavor: string,
filterFile: string,
wait: string,
name: string,
): string[] {
const args = [
"run",
Expand Down Expand Up @@ -121,5 +132,9 @@ export function buildiOSArgs(
args.push("--wait", wait);
}

if (name) {
args.push("--name", name);
}

return args;
}
5 changes: 5 additions & 0 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ async function main() {
const flavor = core.getInput("flavor");
const filterFile = core.getInput("filterFile");
const wait = core.getInput("wait");
const name = core.getInput("name");
const device = core.getInput("device");

let args: string[] = [];

Expand All @@ -34,6 +36,8 @@ async function main() {
flavor,
filterFile,
wait,
name,
device,
);
break;
}
Expand All @@ -50,6 +54,7 @@ async function main() {
flavor,
filterFile,
wait,
name,
);
break;
}
Expand Down

0 comments on commit 9334002

Please sign in to comment.