mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-23 20:27:02 +08:00
Add all the bash params
This commit is contained in:
170
dist/index.js
vendored
170
dist/index.js
vendored
@@ -2519,47 +2519,50 @@ const exec = __webpack_require__(986);
|
||||
const fs = __webpack_require__(747);
|
||||
const request = __webpack_require__(335);
|
||||
|
||||
let fail_ci;
|
||||
let verbose;
|
||||
try {
|
||||
const name = core.getInput("name");
|
||||
const token = core.getInput("token");
|
||||
const flags = core.getInput("flags");
|
||||
const file = core.getInput("file");
|
||||
const files = core.getInput("files");
|
||||
let isTrue = (variable) => {
|
||||
const lowercase = variable.toLowerCase();
|
||||
return (
|
||||
lowercase === "1" ||
|
||||
lowercase === "t" ||
|
||||
lowercase === "true" ||
|
||||
lowercase === "y" ||
|
||||
lowercase === "yes"
|
||||
);
|
||||
}
|
||||
|
||||
const env_vars = core.getInput("env_vars");
|
||||
const dir = core.getInput("directory");
|
||||
const fail_ci = isTrue(core.getInput("fail_ci_if_error"));
|
||||
const files = core.getInput("files");
|
||||
const flags = core.getInput("flags");
|
||||
const functionalities = core.getInput("functionalities");
|
||||
const name = core.getInput("name");
|
||||
const search_dir = core.getInput("directory");
|
||||
const token = core.getInput("token");
|
||||
const verbose = isTrue(core.getInput("verbose"));
|
||||
const working_dir = core.getInput("working_directory");
|
||||
const write_path = core.getInput("path_to_write_report");
|
||||
const working_dir = core.getInput("working-directory");
|
||||
const xcode_derived_data = core.getInput("xcode_derived_data");
|
||||
const xcode_package = core.getInput("xcode_package");
|
||||
|
||||
fail_ci = core.getInput("fail_ci_if_error").toLowerCase();
|
||||
verbose = core.getInput("verbose").toLowerCase();
|
||||
const commit_parent = core.getInput("commit_parent");
|
||||
const root_dir = core.getInput("root_dir");
|
||||
const clean = core.getInput("move_coverage_to_trash");
|
||||
const gcov_exclude = core.getInput("gcov_path_exclude");
|
||||
const gcov_include = core.getInput("gcov_path_include");
|
||||
const gcov_dir = core.getInput("gcov_root_dir");
|
||||
const gcov_prefix = core.getInput("gcov_prefix");
|
||||
const gcov_exec = core.getInput("gcov_executable");
|
||||
const gcov_args = core.getInput("gcov_args");
|
||||
|
||||
if (
|
||||
fail_ci === "yes" ||
|
||||
fail_ci === "y" ||
|
||||
fail_ci === "true" ||
|
||||
fail_ci === "t" ||
|
||||
fail_ci === "1"
|
||||
) {
|
||||
fail_ci = true;
|
||||
} else {
|
||||
fail_ci = false;
|
||||
}
|
||||
const override_commit = core.getInput("override_commit");
|
||||
const override_branch = core.getInput("override_branch");
|
||||
const override_pr = core.getInput("override_pr");
|
||||
const override_build = core.getInput("override_build");
|
||||
const override_tag = core.getInput("override_tag");
|
||||
|
||||
if (
|
||||
verbose === "yes" ||
|
||||
verbose === "y" ||
|
||||
verbose === "true" ||
|
||||
verbose === "t" ||
|
||||
verbose === "1"
|
||||
) {
|
||||
verbose = true;
|
||||
} else {
|
||||
verbose = false;
|
||||
}
|
||||
const curl_codecov_args = core.getInput("codecov_curl_args");
|
||||
const curl_aws_args = core.getInput("aws_curl_args");
|
||||
|
||||
request({
|
||||
json: false,
|
||||
@@ -2574,7 +2577,10 @@ try {
|
||||
core.warning(`Codecov warning: ${error.message}`);
|
||||
}
|
||||
|
||||
fs.writeFile("codecov.sh", body, err => {
|
||||
filepath = working_dir ?
|
||||
working_dir + "/codecov.sh" : "codecov.sh"
|
||||
|
||||
fs.writeFile(filepath, body, err => {
|
||||
if (err && fail_ci) {
|
||||
throw err;
|
||||
} else if (err) {
|
||||
@@ -2615,73 +2621,35 @@ try {
|
||||
}
|
||||
}
|
||||
|
||||
const execArgs = ["codecov.sh"];
|
||||
execArgs.push("-Q", "github-action");
|
||||
const execArgs = [filepath];
|
||||
execArgs.push( "-n", `${name}`, "-F", `${flags}`, "-Q", "github-action" );
|
||||
|
||||
if (file) {
|
||||
execArgs.push(
|
||||
"-f", `${file}`
|
||||
);
|
||||
}
|
||||
|
||||
if (files) {
|
||||
files.split(',').forEach(f => {
|
||||
execArgs.push(
|
||||
"-f", `${f}`
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
if (dir) {
|
||||
execArgs.push(
|
||||
"-s", `${dir}`
|
||||
);
|
||||
}
|
||||
|
||||
execArgs.push(
|
||||
"-n", `${name}`,
|
||||
"-F", `${flags}`
|
||||
);
|
||||
|
||||
if (fail_ci) {
|
||||
execArgs.push(
|
||||
"-Z"
|
||||
);
|
||||
}
|
||||
|
||||
if (env_vars_arg.length) {
|
||||
execArgs.push(
|
||||
"-e", env_vars_arg.join(",")
|
||||
);
|
||||
}
|
||||
|
||||
if (write_path) {
|
||||
execArgs.push(
|
||||
"-q", `${write_path}`
|
||||
);
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
execArgs.push(
|
||||
"-v"
|
||||
);
|
||||
}
|
||||
|
||||
if (working_dir) {
|
||||
options.cwd = working_dir;
|
||||
}
|
||||
|
||||
if (xcode_derived_data) {
|
||||
execArgs.push(
|
||||
"-D", `${xcode_derived_data}`
|
||||
);
|
||||
}
|
||||
|
||||
if (xcode_package) {
|
||||
execArgs.push(
|
||||
"-J", `${xcode_package}`
|
||||
);
|
||||
}
|
||||
if (clean) { execArgs.push( "-c"); }
|
||||
if (commit_parent) { execArgs.push( "-N", `${commit_parent}`); }
|
||||
if (curl_aws_args) { execArgs.push( "-A", `${curl_aws_args}`); }
|
||||
if (curl_codecov_args) { execArgs.push( "-U", `${curl_codecov_args}`); }
|
||||
if (env_vars_arg.length) { execArgs.push( "-e", env_vars_arg.join(",")); }
|
||||
if (fail_ci) { execArgs.push( "-Z"); }
|
||||
if (files) { files.split(',').forEach(f => { execArgs.push( "-f", `${f}`); }); }
|
||||
if (functionalities) { functionalities.split(',').forEach(f => { execArgs.push( "-X", `${f}`); }); }
|
||||
if (gcov_args) { execArgs.push( "-a", `${gcov_args}`); }
|
||||
if (gcov_dir) { execArgs.push( "-p", `${gcov_dir}`); }
|
||||
if (gcov_exclude) { execArgs.push( "-g", `${gcov_exclude}`); }
|
||||
if (gcov_exec) { execArgs.push( "-x", `${gcov_exec}`); }
|
||||
if (gcov_include) { execArgs.push( "-G", `${gcov_include}`); }
|
||||
if (gcov_prefix) { execArgs.push( "-k", `${gcov_prefix}`); }
|
||||
if (override_branch) { execArgs.push( "-B", `${override_branch}`); }
|
||||
if (override_build) { execArgs.push( "-b", `${override_build}`); }
|
||||
if (override_commit) { execArgs.push( "-C", `${override_commit}`); }
|
||||
if (override_pr) { execArgs.push( "-P", `${override_pr}`); }
|
||||
if (override_tag) { execArgs.push( "-T", `${override_tag}`); }
|
||||
if (root_dir) { execArgs.push( "-N", `${root_dir}`); }
|
||||
if (search_dir) { execArgs.push( "-s", `${search_dir}`); }
|
||||
if (verbose) { execArgs.push( "-v"); }
|
||||
if (working_dir) { options.cwd = working_dir; }
|
||||
if (write_path) { execArgs.push( "-q", `${write_path}`); }
|
||||
if (xcode_derived_data) { execArgs.push( "-D", `${xcode_derived_data}`); }
|
||||
if (xcode_package) { execArgs.push( "-J", `${xcode_package}`); }
|
||||
|
||||
exec.exec("bash", execArgs, options)
|
||||
.catch(err => {
|
||||
@@ -2698,7 +2666,7 @@ try {
|
||||
});
|
||||
|
||||
const unlinkFile = () => {
|
||||
fs.unlink("codecov.sh", err => {
|
||||
fs.unlink(filepath, err => {
|
||||
if (err && fail_ci) {
|
||||
throw err;
|
||||
} else if (err) {
|
||||
|
||||
Reference in New Issue
Block a user