fix: add in all the extra arguments for uploader (#955)

This commit is contained in:
Tom Hu
2023-04-11 09:06:59 -07:00
committed by GitHub
parent 91e184765d
commit 030a000ec6
5 changed files with 2704 additions and 2568 deletions

View File

@@ -35,25 +35,32 @@ test('all arguments', () => {
'flags': 'test,test2',
'functionalities':
'network',
'full_report': 'oldDir/oldReport.json',
'gcov': 'true',
'gcov_args': '-v',
'gcov_ignore': '*.fake',
'gcov_include': 'real_file',
'gcov_executable': 'gcov2',
'move_coverage_to_trash': 'true',
'name': 'codecov',
'network_filter': 'src/',
'network_prefix': 'build/',
'override_branch': 'thomasrockhu/test',
'override_build': '1',
'override_commit': '9caabca5474b49de74ef5667deabaf74cdacc244',
'override_pr': '2',
'override_tag': 'v1.2',
'root_dir': 'root/',
'swift': 'true',
'swift_project': 'MyApp',
'slug': 'fakeOwner/fakeRepo',
'token': 'd3859757-ab80-4664-924d-aef22fa7557b',
'upstream_proxy': 'https://codecov.example.com',
'url': 'https://codecov.enterprise.com',
'verbose': 't',
'working-directory': 'src',
'xcode': 'true',
'xcode_archive_path': '/test.xcresult',
'xtra_args': '-some -other -args',
};
for (const env of Object.keys(envs)) {
@@ -81,17 +88,25 @@ test('all arguments', () => {
'dir1/coverage.xml',
'-f',
'dir2/coverage.xml',
'-full',
'oldDir/oldReport.json',
'-F',
'test',
'-F',
'test2',
'-g',
'--gcovArgs',
'-gcovArgs',
'-v',
'--gcovIgnore',
'-gcovIgnore',
'*.fake',
'--gcovInclude',
'-gcovInclude',
'real_file',
'-gcovExecutable',
'gcov2',
'-networkFilter',
'src/',
'-networkPrefix',
'build/',
'-B',
'thomasrockhu/test',
'-b',
@@ -108,12 +123,18 @@ test('all arguments', () => {
'coverage/',
'-r',
'fakeOwner/fakeRepo',
'-xs',
'-xsp',
'MyApp',
'-U',
'https://codecov.example.com',
'-u',
'https://codecov.enterprise.com',
'-v',
'--xc',
'--xp',
'-xc',
'-xp',
'/test.xcresult',
'-some -other -args',
]);
expect(failCi).toBeTruthy();

View File

@@ -19,18 +19,22 @@ const isTrue = (variable) => {
const buildExec = () => {
const clean = core.getInput('move_coverage_to_trash');
const commitParent = core.getInput('commit_parent');
const envVars = core.getInput('env_vars');
const dryRun = isTrue(core.getInput('dry_run'));
const envVars = core.getInput('env_vars');
const failCi = isTrue(core.getInput('fail_ci_if_error'));
const file = core.getInput('file');
const files = core.getInput('files');
const flags = core.getInput('flags');
const fullReport = core.getInput('full_report');
const functionalities = core.getInput('functionalities');
const gcov = core.getInput('gcov');
const gcovArgs = core.getInput('gcov_args');
const gcovExecutable = core.getInput('gcov_executable');
const gcovIgnore = core.getInput('gcov_ignore');
const gcovInclude = core.getInput('gcov_include');
const functionalities = core.getInput('functionalities');
const name = core.getInput('name');
const networkFilter = core.getInput('network_filter');
const networkPrefix = core.getInput('network_prefix');
const os = core.getInput('os');
const overrideBranch = core.getInput('override_branch');
const overrideBuild = core.getInput('override_build');
@@ -40,13 +44,16 @@ const buildExec = () => {
const rootDir = core.getInput('root_dir');
const searchDir = core.getInput('directory');
const slug = core.getInput('slug');
const swift = core.getInput('swift');
const swiftProject = core.getInput('swift_project');
const token = core.getInput('token');
let uploaderVersion = core.getInput('version');
const upstream = core.getInput('upstream_proxy');
const url = core.getInput('url');
const verbose = isTrue(core.getInput('verbose'));
const workingDir = core.getInput('working-directory');
const xcode = core.getInput('xcode');
const xcodeArchivePath = core.getInput('xcode_archive_path');
const xtraArgs = core.getInput('xtra_args');
let uploaderVersion = core.getInput('version');
const execArgs = [];
execArgs.push(
@@ -106,6 +113,9 @@ const buildExec = () => {
execArgs.push('-f', `${f}`);
});
}
if (fullReport) {
execArgs.push('-full', `${fullReport}`);
}
if (flags) {
flags.split(',').map((f) => f.trim()).forEach((f) => {
execArgs.push('-F', `${f}`);
@@ -116,13 +126,23 @@ const buildExec = () => {
execArgs.push('-g');
}
if (gcovArgs) {
execArgs.push('--gcovArgs', `${gcovArgs}`);
execArgs.push('-gcovArgs', `${gcovArgs}`);
}
if (gcovIgnore) {
execArgs.push('--gcovIgnore', `${gcovIgnore}`);
execArgs.push('-gcovIgnore', `${gcovIgnore}`);
}
if (gcovInclude) {
execArgs.push('--gcovInclude', `${gcovInclude}`);
execArgs.push('-gcovInclude', `${gcovInclude}`);
}
if (gcovExecutable) {
execArgs.push('-gcovExecutable', `${gcovExecutable}`);
}
if (networkFilter) {
execArgs.push('-networkFilter', `${networkFilter}`);
}
if (networkPrefix) {
execArgs.push('-networkPrefix', `${networkPrefix}`);
}
if (overrideBranch) {
@@ -158,18 +178,24 @@ const buildExec = () => {
if (slug) {
execArgs.push('-r', `${slug}`);
}
if (swift) {
execArgs.push('-xs');
}
if (swift && swiftProject) {
execArgs.push('-xsp', `${swiftProject}`);
}
if (upstream) {
execArgs.push('-U', `${upstream}`);
}
if (url) {
execArgs.push('-u', `${url}`);
}
if (verbose) {
execArgs.push('-v');
}
if (workingDir) {
options.cwd = workingDir;
}
if (xcode && xcodeArchivePath) {
execArgs.push('--xc');
execArgs.push('--xp', `${xcodeArchivePath}`);
execArgs.push('-xc');
execArgs.push('-xp', `${xcodeArchivePath}`);
}
if (uploaderVersion == '') {
@@ -180,6 +206,10 @@ const buildExec = () => {
console.debug({execArgs});
}
if (xtraArgs) {
execArgs.push(`${xtraArgs}`);
}
return {execArgs, options, failCi, os, uploaderVersion, verbose};
};