From 9334002c0cb5beece70b8359091bc06bb7ec9e5c Mon Sep 17 00:00:00 2001 From: Evgenii Matsiuk Date: Fri, 23 Feb 2024 15:25:32 +0300 Subject: [PATCH] feat(args): name and device args supported (#5) --- README.md | 7 +++---- action.yml | 6 ++++++ lib/index.js | 19 +++++++++++++++---- src/command.ts | 15 +++++++++++++++ src/run.ts | 5 +++++ 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7e442ef..f43681d 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/action.yml b/action.yml index 3fd70ab..e33ba5c 100644 --- a/action.yml +++ b/action.yml @@ -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" diff --git a/lib/index.js b/lib/index.js index eee19fa..5c63ee1 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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", @@ -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", @@ -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; @@ -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: { diff --git a/src/command.ts b/src/command.ts index dcc4515..910c4f0 100644 --- a/src/command.ts +++ b/src/command.ts @@ -12,6 +12,8 @@ export function buildAndroidArgs( flavor: string, filterFile: string, wait: string, + name: string, + device: string, ): string[] { const args = [ "run", @@ -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; } @@ -71,6 +81,7 @@ export function buildiOSArgs( flavor: string, filterFile: string, wait: string, + name: string, ): string[] { const args = [ "run", @@ -121,5 +132,9 @@ export function buildiOSArgs( args.push("--wait", wait); } + if (name) { + args.push("--name", name); + } + return args; } diff --git a/src/run.ts b/src/run.ts index ba865ec..ed7fa66 100644 --- a/src/run.ts +++ b/src/run.ts @@ -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[] = []; @@ -34,6 +36,8 @@ async function main() { flavor, filterFile, wait, + name, + device, ); break; } @@ -50,6 +54,7 @@ async function main() { flavor, filterFile, wait, + name, ); break; }