Skip to content

Commit

Permalink
feat(common): the new flag was added - ignoreTestFailures (#9)
Browse files Browse the repository at this point in the history
* feat(common): the new flag was added - ignoreTestFailures
  • Loading branch information
matzuk committed May 23, 2024
1 parent f72a6dd commit 07f55c7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 6 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ This action wraps [marathon-cloud][] CLI in your GitHub Actions workflow.
| `xcodeVersion` (optional) | Xcode version. Only for iOS. Possible values: [14.3.1, 15.2] | `14.3.1` | `14.3.1`, `15.2` |
| `xctestplanFilterFile` (optional) | Test filters supplied as .xctestplan file | `` | `` |
| `xctestplanTargetName` (optional) | Target name to use for test filtering in .xctestplan | `` | `` |
| `xctestrunEnv` (optional) | Xctestrun environment variables, format: 'VAR1=VALUE1,VAR2=VALUE2' | `` | `VAR1=VALUE1,VAR2=VALUE2` |
| `xctestrunTestEnv` (optional) | Xctestrun testing environment variables, format: 'VAR1=VALUE1,VAR2=VALUE2' | `` | `VAR1=VALUE1,VAR2=VALUE2` |
| `xctestrunEnv` (optional) | Xctestrun environment variables, format: 'VAR1=VALUE1,VAR2=VALUE2' | `` | `VAR1=VALUE1,VAR2=VALUE2` |
| `xctestrunTestEnv` (optional) | Xctestrun testing environment variables, format: 'VAR1=VALUE1,VAR2=VALUE2' | `` | `VAR1=VALUE1,VAR2=VALUE2` |
| `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` |

## Usage Examples

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ inputs:
xctestrunTestEnv:
description: "xctestrun testing environment variables, format: 'VAR1=VALUE1,VAR2=VALUE2'"
required: false
ignoreTestFailures:
description: "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]"
required: false
branding:
icon: "play"
color: "purple"
Expand Down
15 changes: 11 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, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv) {
function buildAndroidArgs(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures) {
const args = [
"run",
"android",
Expand Down Expand Up @@ -4027,6 +4027,9 @@ function buildAndroidArgs(apiKey, application, testApplication, link, output, os
if (device) {
args.push("--device", device);
}
if (ignoreTestFailures) {
args.push("--ignore-test-failures", ignoreTestFailures);
}
if (xcodeVersion) {
core.warning(`xcodeVersion argument is only for iOS`);
}
Expand All @@ -4045,7 +4048,7 @@ function buildAndroidArgs(apiKey, application, testApplication, link, output, os
return args;
}
exports.buildAndroidArgs = buildAndroidArgs;
function buildiOSArgs(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv) {
function buildiOSArgs(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures) {
const args = [
"run",
"ios",
Expand Down Expand Up @@ -4105,6 +4108,9 @@ function buildiOSArgs(apiKey, application, testApplication, link, output, osVers
args.push("--xctestrun-test-env", testEnv.trim());
});
}
if (ignoreTestFailures) {
args.push("--ignore-test-failures", ignoreTestFailures);
}
return args;
}
exports.buildiOSArgs = buildiOSArgs;
Expand Down Expand Up @@ -4175,15 +4181,16 @@ function main() {
const xctestplanTargetName = core.getInput("xctestplanTargetName");
const xctestrunEnv = core.getInput("xctestrunEnv");
const xctestrunTestEnv = core.getInput("xctestrunTestEnv");
const ignoreTestFailures = core.getInput("ignoreTestFailures");
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, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv);
args = (0, command_1.buildAndroidArgs)(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures);
break;
}
case "ios": {
args = (0, command_1.buildiOSArgs)(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv);
args = (0, command_1.buildiOSArgs)(apiKey, application, testApplication, link, output, osVersion, systemImage, isolated, flavor, filterFile, wait, name, device, xcodeVersion, xctestplanFilterFile, xctestplanTargetName, xctestrunEnv, xctestrunTestEnv, ignoreTestFailures);
break;
}
default: {
Expand Down
10 changes: 10 additions & 0 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function buildAndroidArgs(
xctestplanTargetName: string,
xctestrunEnv: string,
xctestrunTestEnv: string,
ignoreTestFailures: string,
): string[] {
const args = [
"run",
Expand Down Expand Up @@ -71,6 +72,10 @@ export function buildAndroidArgs(
args.push("--device", device);
}

if (ignoreTestFailures) {
args.push("--ignore-test-failures", ignoreTestFailures);
}

if (xcodeVersion) {
core.warning(`xcodeVersion argument is only for iOS`);
}
Expand Down Expand Up @@ -113,6 +118,7 @@ export function buildiOSArgs(
xctestplanTargetName: string,
xctestrunEnv: string,
xctestrunTestEnv: string,
ignoreTestFailures: string,
): string[] {
const args = [
"run",
Expand Down Expand Up @@ -193,5 +199,9 @@ export function buildiOSArgs(
});
}

if (ignoreTestFailures) {
args.push("--ignore-test-failures", ignoreTestFailures);
}

return args;
}
3 changes: 3 additions & 0 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ async function main() {
const xctestplanTargetName = core.getInput("xctestplanTargetName");
const xctestrunEnv = core.getInput("xctestrunEnv");
const xctestrunTestEnv = core.getInput("xctestrunTestEnv");
const ignoreTestFailures = core.getInput("ignoreTestFailures");

let args: string[] = [];

Expand All @@ -48,6 +49,7 @@ async function main() {
xctestplanTargetName,
xctestrunEnv,
xctestrunTestEnv,
ignoreTestFailures,
);
break;
}
Expand All @@ -71,6 +73,7 @@ async function main() {
xctestplanTargetName,
xctestrunEnv,
xctestrunTestEnv,
ignoreTestFailures,
);
break;
}
Expand Down

0 comments on commit 07f55c7

Please sign in to comment.