mirror of
https://github.com/codecov/codecov-action.git
synced 2026-02-12 22:17:24 +00:00
use the cli instead of the node uploader
This commit is contained in:
parent
35d7f20bdb
commit
d6d62ee622
8 changed files with 141 additions and 560 deletions
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
|
|
@ -16,6 +16,7 @@ jobs:
|
||||||
flags: script,${{ matrix.os }}
|
flags: script,${{ matrix.os }}
|
||||||
name: codecov-script
|
name: codecov-script
|
||||||
verbose: true
|
verbose: true
|
||||||
|
token: ${{ vars.CODECOV_TOKEN }}
|
||||||
- name: Upload coverage to Codecov (demo)
|
- name: Upload coverage to Codecov (demo)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
|
@ -24,6 +25,7 @@ jobs:
|
||||||
flags: demo,${{ matrix.os }}
|
flags: demo,${{ matrix.os }}
|
||||||
name: codecov-demo
|
name: codecov-demo
|
||||||
verbose: true
|
verbose: true
|
||||||
|
token: ${{ vars.CODECOV_TOKEN }}
|
||||||
- name: Upload coverage to Codecov (version)
|
- name: Upload coverage to Codecov (version)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
|
@ -31,8 +33,9 @@ jobs:
|
||||||
file: ./coverage/coverage-final.json
|
file: ./coverage/coverage-final.json
|
||||||
flags: version,${{ matrix.os }}
|
flags: version,${{ matrix.os }}
|
||||||
name: codecov-version
|
name: codecov-version
|
||||||
version: v0.1.0_8880
|
version: v0.1.2
|
||||||
verbose: true
|
verbose: true
|
||||||
|
token: ${{ vars.CODECOV_TOKEN }}
|
||||||
run:
|
run:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
|
@ -54,6 +57,7 @@ jobs:
|
||||||
flags: script,${{ matrix.os }}
|
flags: script,${{ matrix.os }}
|
||||||
name: codecov-script
|
name: codecov-script
|
||||||
verbose: true
|
verbose: true
|
||||||
|
token: ${{ vars.CODECOV_TOKEN }}
|
||||||
- name: Upload coverage to Codecov (demo)
|
- name: Upload coverage to Codecov (demo)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
|
@ -62,6 +66,7 @@ jobs:
|
||||||
flags: demo,${{ matrix.os }}
|
flags: demo,${{ matrix.os }}
|
||||||
name: codecov-demo
|
name: codecov-demo
|
||||||
verbose: true
|
verbose: true
|
||||||
|
token: ${{ vars.CODECOV_TOKEN }}
|
||||||
- name: Upload coverage to Codecov (version)
|
- name: Upload coverage to Codecov (version)
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
|
@ -69,5 +74,6 @@ jobs:
|
||||||
file: ./coverage/coverage-final.json
|
file: ./coverage/coverage-final.json
|
||||||
flags: version,${{ matrix.os }}
|
flags: version,${{ matrix.os }}
|
||||||
name: codecov-version
|
name: codecov-version
|
||||||
version: v0.1.0_8880
|
version: v0.1.2
|
||||||
verbose: true
|
verbose: true
|
||||||
|
token: ${{ vars.CODECOV_TOKEN }}
|
||||||
|
|
|
||||||
214
dist/index.js
vendored
214
dist/index.js
vendored
|
|
@ -22068,15 +22068,12 @@ var external_path_ = __nccwpck_require__(1017);
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
|
// EXTERNAL MODULE: ./node_modules/@actions/exec/lib/exec.js
|
||||||
var exec = __nccwpck_require__(1514);
|
var exec = __nccwpck_require__(1514);
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
|
// EXTERNAL MODULE: ./node_modules/@actions/core/lib/core.js
|
||||||
var lib_core = __nccwpck_require__(2186);
|
var core = __nccwpck_require__(2186);
|
||||||
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
|
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
|
||||||
var github = __nccwpck_require__(5438);
|
var github = __nccwpck_require__(5438);
|
||||||
;// CONCATENATED MODULE: ./package.json
|
|
||||||
const package_namespaceObject = {"i8":"3.1.1"};
|
|
||||||
;// CONCATENATED MODULE: ./src/buildExec.ts
|
;// CONCATENATED MODULE: ./src/buildExec.ts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
const isTrue = (variable) => {
|
const isTrue = (variable) => {
|
||||||
const lowercase = variable.toLowerCase();
|
const lowercase = variable.toLowerCase();
|
||||||
|
|
@ -22086,156 +22083,6 @@ const isTrue = (variable) => {
|
||||||
lowercase === 'y' ||
|
lowercase === 'y' ||
|
||||||
lowercase === 'yes');
|
lowercase === 'yes');
|
||||||
};
|
};
|
||||||
const buildExec = () => {
|
|
||||||
const clean = lib_core.getInput('move_coverage_to_trash');
|
|
||||||
const commitParent = lib_core.getInput('commit_parent');
|
|
||||||
const envVars = lib_core.getInput('env_vars');
|
|
||||||
const dryRun = isTrue(lib_core.getInput('dry_run'));
|
|
||||||
const failCi = isTrue(lib_core.getInput('fail_ci_if_error'));
|
|
||||||
const file = lib_core.getInput('file');
|
|
||||||
const files = lib_core.getInput('files');
|
|
||||||
const flags = lib_core.getInput('flags');
|
|
||||||
const gcov = lib_core.getInput('gcov');
|
|
||||||
const gcovArgs = lib_core.getInput('gcov_args');
|
|
||||||
const gcovIgnore = lib_core.getInput('gcov_ignore');
|
|
||||||
const gcovInclude = lib_core.getInput('gcov_include');
|
|
||||||
const functionalities = lib_core.getInput('functionalities');
|
|
||||||
const name = lib_core.getInput('name');
|
|
||||||
const os = lib_core.getInput('os');
|
|
||||||
const overrideBranch = lib_core.getInput('override_branch');
|
|
||||||
const overrideBuild = lib_core.getInput('override_build');
|
|
||||||
const overrideCommit = lib_core.getInput('override_commit');
|
|
||||||
const overridePr = lib_core.getInput('override_pr');
|
|
||||||
const overrideTag = lib_core.getInput('override_tag');
|
|
||||||
const rootDir = lib_core.getInput('root_dir');
|
|
||||||
const searchDir = lib_core.getInput('directory');
|
|
||||||
const slug = lib_core.getInput('slug');
|
|
||||||
const token = lib_core.getInput('token');
|
|
||||||
let uploaderVersion = lib_core.getInput('version');
|
|
||||||
const url = lib_core.getInput('url');
|
|
||||||
const verbose = isTrue(lib_core.getInput('verbose'));
|
|
||||||
const workingDir = lib_core.getInput('working-directory');
|
|
||||||
const xcode = lib_core.getInput('xcode');
|
|
||||||
const xcodeArchivePath = lib_core.getInput('xcode_archive_path');
|
|
||||||
const execArgs = [];
|
|
||||||
execArgs.push('-n', `${name}`, '-Q', `github-action-${package_namespaceObject.i8}`);
|
|
||||||
const options = {};
|
|
||||||
options.env = Object.assign(process.env, {
|
|
||||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
|
||||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
|
||||||
GITHUB_REF: process.env.GITHUB_REF,
|
|
||||||
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY,
|
|
||||||
GITHUB_SHA: process.env.GITHUB_SHA,
|
|
||||||
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || '',
|
|
||||||
});
|
|
||||||
const envVarsArg = [];
|
|
||||||
for (const envVar of envVars.split(',')) {
|
|
||||||
const envVarClean = envVar.trim();
|
|
||||||
if (envVarClean) {
|
|
||||||
options.env[envVarClean] = process.env[envVarClean];
|
|
||||||
envVarsArg.push(envVarClean);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (token) {
|
|
||||||
options.env.CODECOV_TOKEN = token;
|
|
||||||
}
|
|
||||||
if (clean) {
|
|
||||||
execArgs.push('-c');
|
|
||||||
}
|
|
||||||
if (commitParent) {
|
|
||||||
execArgs.push('-N', `${commitParent}`);
|
|
||||||
}
|
|
||||||
if (dryRun) {
|
|
||||||
execArgs.push('-d');
|
|
||||||
}
|
|
||||||
if (envVarsArg.length) {
|
|
||||||
execArgs.push('-e', envVarsArg.join(','));
|
|
||||||
}
|
|
||||||
if (functionalities) {
|
|
||||||
functionalities.split(',').map((f) => f.trim()).forEach((f) => {
|
|
||||||
execArgs.push('-X', `${f}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (failCi) {
|
|
||||||
execArgs.push('-Z');
|
|
||||||
}
|
|
||||||
if (file) {
|
|
||||||
execArgs.push('-f', `${file}`);
|
|
||||||
}
|
|
||||||
if (files) {
|
|
||||||
files.split(',').map((f) => f.trim()).forEach((f) => {
|
|
||||||
execArgs.push('-f', `${f}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (flags) {
|
|
||||||
flags.split(',').map((f) => f.trim()).forEach((f) => {
|
|
||||||
execArgs.push('-F', `${f}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (gcov) {
|
|
||||||
execArgs.push('-g');
|
|
||||||
}
|
|
||||||
if (gcovArgs) {
|
|
||||||
execArgs.push('--gcovArgs', `${gcovArgs}`);
|
|
||||||
}
|
|
||||||
if (gcovIgnore) {
|
|
||||||
execArgs.push('--gcovIgnore', `${gcovIgnore}`);
|
|
||||||
}
|
|
||||||
if (gcovInclude) {
|
|
||||||
execArgs.push('--gcovInclude', `${gcovInclude}`);
|
|
||||||
}
|
|
||||||
if (overrideBranch) {
|
|
||||||
execArgs.push('-B', `${overrideBranch}`);
|
|
||||||
}
|
|
||||||
if (overrideBuild) {
|
|
||||||
execArgs.push('-b', `${overrideBuild}`);
|
|
||||||
}
|
|
||||||
if (overrideCommit) {
|
|
||||||
execArgs.push('-C', `${overrideCommit}`);
|
|
||||||
}
|
|
||||||
else if (`${context.eventName}` == 'pull_request' ||
|
|
||||||
`${context.eventName}` == 'pull_request_target') {
|
|
||||||
execArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
|
||||||
}
|
|
||||||
if (overridePr) {
|
|
||||||
execArgs.push('-P', `${overridePr}`);
|
|
||||||
}
|
|
||||||
else if (`${context.eventName}` == 'pull_request_target') {
|
|
||||||
execArgs.push('-P', `${context.payload.number}`);
|
|
||||||
}
|
|
||||||
if (overrideTag) {
|
|
||||||
execArgs.push('-T', `${overrideTag}`);
|
|
||||||
}
|
|
||||||
if (rootDir) {
|
|
||||||
execArgs.push('-R', `${rootDir}`);
|
|
||||||
}
|
|
||||||
if (searchDir) {
|
|
||||||
execArgs.push('-s', `${searchDir}`);
|
|
||||||
}
|
|
||||||
if (slug) {
|
|
||||||
execArgs.push('-r', `${slug}`);
|
|
||||||
}
|
|
||||||
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}`);
|
|
||||||
}
|
|
||||||
if (uploaderVersion == '') {
|
|
||||||
uploaderVersion = 'latest';
|
|
||||||
}
|
|
||||||
if (verbose) {
|
|
||||||
console.debug({ execArgs });
|
|
||||||
}
|
|
||||||
return { execArgs, options, failCi, os, uploaderVersion, verbose };
|
|
||||||
};
|
|
||||||
const buildCommitExec = () => {
|
const buildCommitExec = () => {
|
||||||
const commitParent = core.getInput('commit_parent');
|
const commitParent = core.getInput('commit_parent');
|
||||||
const overrideBranch = core.getInput('override_branch');
|
const overrideBranch = core.getInput('override_branch');
|
||||||
|
|
@ -22291,7 +22138,7 @@ const buildGeneralExec = () => {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
args.push('-v');
|
args.push('-v');
|
||||||
}
|
}
|
||||||
return args;
|
return { args, verbose };
|
||||||
};
|
};
|
||||||
const buildReportExec = () => {
|
const buildReportExec = () => {
|
||||||
const overrideCommit = core.getInput('override_commit');
|
const overrideCommit = core.getInput('override_commit');
|
||||||
|
|
@ -22444,7 +22291,7 @@ const buildUploadExec = () => {
|
||||||
|
|
||||||
const PLATFORMS = ['alpine', 'linux', 'macos', 'windows'];
|
const PLATFORMS = ['alpine', 'linux', 'macos', 'windows'];
|
||||||
const setFailure = (message, failCi) => {
|
const setFailure = (message, failCi) => {
|
||||||
failCi ? lib_core.setFailed(message) : lib_core.warning(message);
|
failCi ? core.setFailed(message) : core.warning(message);
|
||||||
if (failCi) {
|
if (failCi) {
|
||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
|
|
@ -22466,19 +22313,22 @@ const isWindows = (platform) => {
|
||||||
const getPlatform = (os) => {
|
const getPlatform = (os) => {
|
||||||
var _a;
|
var _a;
|
||||||
if (isValidPlatform(os)) {
|
if (isValidPlatform(os)) {
|
||||||
lib_core.info(`==> ${os} OS provided`);
|
core.info(`==> ${os} OS provided`);
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
const platform = (_a = process.env.RUNNER_OS) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
const platform = (_a = process.env.RUNNER_OS) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
||||||
if (isValidPlatform(platform)) {
|
if (isValidPlatform(platform)) {
|
||||||
lib_core.info(`==> ${platform} OS detected`);
|
core.info(`==> ${platform} OS detected`);
|
||||||
return platform;
|
return platform;
|
||||||
}
|
}
|
||||||
lib_core.info('==> Could not detect OS or provided OS is invalid. Defaulting to linux');
|
core.info('==> Could not detect OS or provided OS is invalid. Defaulting to linux');
|
||||||
return 'linux';
|
return 'linux';
|
||||||
};
|
};
|
||||||
const getBaseUrl = (platform, version) => {
|
const getBaseUrl = (platform, version) => {
|
||||||
return `https://uploader.codecov.io/${version}/${platform}/${getUploaderName(platform)}`;
|
return `https://cli.codecov.io/${version}/${platform}/${getUploaderName(platform)}`;
|
||||||
|
};
|
||||||
|
const getCommand = (filename, generalArgs, command) => {
|
||||||
|
return filename + ' ' + generalArgs.join(' ') + ' ' + command;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -24677,7 +24527,7 @@ const verify = (filename, platform, version, verbose, failCi) => __awaiter(void
|
||||||
});
|
});
|
||||||
const valid = yield verified.signatures[0].verified;
|
const valid = yield verified.signatures[0].verified;
|
||||||
if (valid) {
|
if (valid) {
|
||||||
lib_core.info('==> SHASUM file signed by key id ' +
|
core.info('==> SHASUM file signed by key id ' +
|
||||||
verified.signatures[0].keyID.toHex());
|
verified.signatures[0].keyID.toHex());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -24694,7 +24544,7 @@ const verify = (filename, platform, version, verbose, failCi) => __awaiter(void
|
||||||
});
|
});
|
||||||
const hash = yield calculateHash(filename);
|
const hash = yield calculateHash(filename);
|
||||||
if (hash === shasum) {
|
if (hash === shasum) {
|
||||||
lib_core.info(`==> Uploader SHASUM verified (${hash})`);
|
core.info(`==> Uploader SHASUM verified (${hash})`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setFailure('Codecov: Uploader shasum does not match -- ' +
|
setFailure('Codecov: Uploader shasum does not match -- ' +
|
||||||
|
|
@ -24721,17 +24571,17 @@ var version_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _
|
||||||
|
|
||||||
const versionInfo = (platform, version) => version_awaiter(void 0, void 0, void 0, function* () {
|
const versionInfo = (platform, version) => version_awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (version) {
|
if (version) {
|
||||||
lib_core.info(`==> Running version ${version}`);
|
core.info(`==> Running version ${version}`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const metadataRes = yield fetch(`https://uploader.codecov.io/${platform}/latest`, {
|
const metadataRes = yield fetch(`https://uploader.codecov.io/${platform}/latest`, {
|
||||||
headers: { 'Accept': 'application/json' },
|
headers: { 'Accept': 'application/json' },
|
||||||
});
|
});
|
||||||
const metadata = yield metadataRes.json();
|
const metadata = yield metadataRes.json();
|
||||||
lib_core.info(`==> Running version ${metadata['version']}`);
|
core.info(`==> Running version ${metadata['version']}`);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
lib_core.info(`Could not pull latest version information: ${err}`);
|
core.info(`Could not pull latest version information: ${err}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/* harmony default export */ const version = (versionInfo);
|
/* harmony default export */ const version = (versionInfo);
|
||||||
|
|
@ -24756,7 +24606,10 @@ var src_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
||||||
|
|
||||||
let failCi;
|
let failCi;
|
||||||
try {
|
try {
|
||||||
const { execArgs, options, failCi, os, uploaderVersion, verbose } = buildExec();
|
const { commitExecArgs, commitOptions, commitCommand } = buildCommitExec();
|
||||||
|
const { reportExecArgs, reportOptions, reportCommand } = buildReportExec();
|
||||||
|
const { uploadExecArgs, uploadOptions, failCi, os, uploaderVersion, uploadCommand, } = buildUploadExec();
|
||||||
|
const { args, verbose } = buildGeneralExec();
|
||||||
const platform = getPlatform(os);
|
const platform = getPlatform(os);
|
||||||
const filename = external_path_.join(__dirname, getUploaderName(platform));
|
const filename = external_path_.join(__dirname, getUploaderName(platform));
|
||||||
external_https_.get(getBaseUrl(platform, uploaderVersion), (res) => {
|
external_https_.get(getBaseUrl(platform, uploaderVersion), (res) => {
|
||||||
|
|
@ -24778,11 +24631,32 @@ try {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
yield exec.exec(filename, execArgs, options)
|
const doUpload = () => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
.catch((err) => {
|
yield exec.exec(getCommand(filename, args, uploadCommand), uploadExecArgs, uploadOptions)
|
||||||
setFailure(`Codecov: Failed to properly upload: ${err.message}`, failCi);
|
.catch((err) => {
|
||||||
}).then(() => {
|
setFailure(`Codecov:
|
||||||
|
Failed to properly upload report: ${err.message}`, failCi);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
const createReport = () => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
yield exec.exec(getCommand(filename, args, reportCommand), reportExecArgs, reportOptions)
|
||||||
|
.then((exitCode) => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
if (exitCode == 0) {
|
||||||
|
yield doUpload();
|
||||||
|
}
|
||||||
|
})).catch((err) => {
|
||||||
|
setFailure(`Codecov:
|
||||||
|
Failed to properly create report: ${err.message}`, failCi);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
yield exec.exec(getCommand(filename, args, commitCommand), commitExecArgs, commitOptions)
|
||||||
|
.then((exitCode) => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
if (exitCode == 0) {
|
||||||
|
yield createReport();
|
||||||
|
}
|
||||||
unlink();
|
unlink();
|
||||||
|
})).catch((err) => {
|
||||||
|
setFailure(`Codecov: Failed to properly create commit: ${err.message}`, failCi);
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
|
@ -2,213 +2,14 @@ import * as github from '@actions/github';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
buildCommitExec,
|
buildCommitExec,
|
||||||
buildExec,
|
|
||||||
buildGeneralExec,
|
buildGeneralExec,
|
||||||
buildReportExec,
|
buildReportExec,
|
||||||
buildUploadExec,
|
buildUploadExec,
|
||||||
} from './buildExec';
|
} from './buildExec';
|
||||||
|
|
||||||
import {version} from '../package.json';
|
|
||||||
|
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
|
|
||||||
test('no arguments', () => {
|
|
||||||
const {execArgs, failCi} = buildExec();
|
|
||||||
|
|
||||||
const args = [
|
|
||||||
'-n',
|
|
||||||
'',
|
|
||||||
'-Q',
|
|
||||||
`github-action-${version}`,
|
|
||||||
];
|
|
||||||
if (context.eventName == 'pull_request') {
|
|
||||||
args.push('-C', `${context.payload.pull_request.head.sha}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(execArgs).toEqual(args);
|
|
||||||
expect(failCi).toBeFalsy();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('all arguments', () => {
|
|
||||||
const envs = {
|
|
||||||
'commit_parent': '83231650328f11695dfb754ca0f540516f188d27',
|
|
||||||
'directory': 'coverage/',
|
|
||||||
'dry_run': 'true',
|
|
||||||
'env_vars': 'OS,PYTHON',
|
|
||||||
'fail_ci_if_error': 'true',
|
|
||||||
'file': 'coverage.xml',
|
|
||||||
'files': 'dir1/coverage.xml,dir2/coverage.xml',
|
|
||||||
'flags': 'test,test2',
|
|
||||||
'functionalities':
|
|
||||||
'network',
|
|
||||||
'gcov': 'true',
|
|
||||||
'gcov_args': '-v',
|
|
||||||
'gcov_ignore': '*.fake',
|
|
||||||
'gcov_include': 'real_file',
|
|
||||||
'move_coverage_to_trash': 'true',
|
|
||||||
'name': 'codecov',
|
|
||||||
'override_branch': 'thomasrockhu/test',
|
|
||||||
'override_build': '1',
|
|
||||||
'override_commit': '9caabca5474b49de74ef5667deabaf74cdacc244',
|
|
||||||
'override_pr': '2',
|
|
||||||
'override_tag': 'v1.2',
|
|
||||||
'root_dir': 'root/',
|
|
||||||
'slug': 'fakeOwner/fakeRepo',
|
|
||||||
'token': 'd3859757-ab80-4664-924d-aef22fa7557b',
|
|
||||||
'url': 'https://codecov.enterprise.com',
|
|
||||||
'verbose': 't',
|
|
||||||
'working-directory': 'src',
|
|
||||||
'xcode': 'true',
|
|
||||||
'xcode_archive_path': '/test.xcresult',
|
|
||||||
};
|
|
||||||
|
|
||||||
for (const env of Object.keys(envs)) {
|
|
||||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
|
||||||
}
|
|
||||||
|
|
||||||
const {execArgs, failCi} = buildExec();
|
|
||||||
expect(execArgs).toEqual([
|
|
||||||
'-n',
|
|
||||||
'codecov',
|
|
||||||
'-Q',
|
|
||||||
`github-action-${version}`,
|
|
||||||
'-c',
|
|
||||||
'-N',
|
|
||||||
'83231650328f11695dfb754ca0f540516f188d27',
|
|
||||||
'-d',
|
|
||||||
'-e',
|
|
||||||
'OS,PYTHON',
|
|
||||||
'-X',
|
|
||||||
'network',
|
|
||||||
'-Z',
|
|
||||||
'-f',
|
|
||||||
'coverage.xml',
|
|
||||||
'-f',
|
|
||||||
'dir1/coverage.xml',
|
|
||||||
'-f',
|
|
||||||
'dir2/coverage.xml',
|
|
||||||
'-F',
|
|
||||||
'test',
|
|
||||||
'-F',
|
|
||||||
'test2',
|
|
||||||
'-g',
|
|
||||||
'--gcovArgs',
|
|
||||||
'-v',
|
|
||||||
'--gcovIgnore',
|
|
||||||
'*.fake',
|
|
||||||
'--gcovInclude',
|
|
||||||
'real_file',
|
|
||||||
'-B',
|
|
||||||
'thomasrockhu/test',
|
|
||||||
'-b',
|
|
||||||
'1',
|
|
||||||
'-C',
|
|
||||||
'9caabca5474b49de74ef5667deabaf74cdacc244',
|
|
||||||
'-P',
|
|
||||||
'2',
|
|
||||||
'-T',
|
|
||||||
'v1.2',
|
|
||||||
'-R',
|
|
||||||
'root/',
|
|
||||||
'-s',
|
|
||||||
'coverage/',
|
|
||||||
'-r',
|
|
||||||
'fakeOwner/fakeRepo',
|
|
||||||
'-u',
|
|
||||||
'https://codecov.enterprise.com',
|
|
||||||
'-v',
|
|
||||||
'--xc',
|
|
||||||
'--xp',
|
|
||||||
'/test.xcresult',
|
|
||||||
]);
|
|
||||||
expect(failCi).toBeTruthy();
|
|
||||||
|
|
||||||
for (const env of Object.keys(envs)) {
|
|
||||||
delete process.env['INPUT_' + env.toUpperCase()];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('trim arguments after splitting them', () => {
|
|
||||||
const baseExpectation = [
|
|
||||||
'-n',
|
|
||||||
expect.stringContaining(''),
|
|
||||||
'-Q',
|
|
||||||
expect.stringContaining('github-action'),
|
|
||||||
];
|
|
||||||
|
|
||||||
test('files', () => {
|
|
||||||
const envs = {files: './client-coverage.txt, ./lcov.info'};
|
|
||||||
|
|
||||||
for (const [name, value] of Object.entries(envs)) {
|
|
||||||
process.env['INPUT_' + name.toUpperCase()] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const {execArgs} = buildExec();
|
|
||||||
|
|
||||||
expect(execArgs).toEqual(
|
|
||||||
expect.arrayContaining([
|
|
||||||
...baseExpectation,
|
|
||||||
'-f',
|
|
||||||
'./client-coverage.txt',
|
|
||||||
'-f',
|
|
||||||
'./lcov.info',
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const env of Object.keys(envs)) {
|
|
||||||
delete process.env['INPUT_' + env.toUpperCase()];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('flags', () => {
|
|
||||||
const envs = {flags: 'ios, mobile'};
|
|
||||||
|
|
||||||
for (const [name, value] of Object.entries(envs)) {
|
|
||||||
process.env['INPUT_' + name.toUpperCase()] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const {execArgs} = buildExec();
|
|
||||||
|
|
||||||
expect(execArgs).toEqual(
|
|
||||||
expect.arrayContaining([
|
|
||||||
...baseExpectation,
|
|
||||||
'-F',
|
|
||||||
'ios',
|
|
||||||
'-F',
|
|
||||||
'mobile',
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const env of Object.keys(envs)) {
|
|
||||||
delete process.env['INPUT_' + env.toUpperCase()];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('functionalities', () => {
|
|
||||||
const envs = {functionalities: 'network, gcov'};
|
|
||||||
|
|
||||||
for (const [name, value] of Object.entries(envs)) {
|
|
||||||
process.env['INPUT_' + name.toUpperCase()] = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
const {execArgs} = buildExec();
|
|
||||||
|
|
||||||
expect(execArgs).toEqual(
|
|
||||||
expect.arrayContaining([
|
|
||||||
...baseExpectation,
|
|
||||||
'-X',
|
|
||||||
'network',
|
|
||||||
'-X',
|
|
||||||
'gcov',
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
|
|
||||||
for (const env of Object.keys(envs)) {
|
|
||||||
delete process.env['INPUT_' + env.toUpperCase()];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('general args', () => {
|
test('general args', () => {
|
||||||
const envs = {
|
const envs = {
|
||||||
url: 'https://codecov.enterprise.com',
|
url: 'https://codecov.enterprise.com',
|
||||||
|
|
@ -218,7 +19,7 @@ test('general args', () => {
|
||||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||||
}
|
}
|
||||||
|
|
||||||
const args = buildGeneralExec();
|
const {args, verbose} = buildGeneralExec();
|
||||||
|
|
||||||
expect(args).toEqual(
|
expect(args).toEqual(
|
||||||
expect.arrayContaining([
|
expect.arrayContaining([
|
||||||
|
|
@ -226,7 +27,7 @@ test('general args', () => {
|
||||||
'https://codecov.enterprise.com',
|
'https://codecov.enterprise.com',
|
||||||
'-v',
|
'-v',
|
||||||
]));
|
]));
|
||||||
|
expect(verbose).toBeTruthy();
|
||||||
for (const env of Object.keys(envs)) {
|
for (const env of Object.keys(envs)) {
|
||||||
delete process.env['INPUT_' + env.toUpperCase()];
|
delete process.env['INPUT_' + env.toUpperCase()];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
171
src/buildExec.ts
171
src/buildExec.ts
|
|
@ -1,7 +1,6 @@
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
|
|
||||||
import {version} from '../package.json';
|
|
||||||
|
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
|
|
||||||
|
|
@ -16,173 +15,6 @@ 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 failCi = isTrue(core.getInput('fail_ci_if_error'));
|
|
||||||
const file = core.getInput('file');
|
|
||||||
const files = core.getInput('files');
|
|
||||||
const flags = core.getInput('flags');
|
|
||||||
const gcov = core.getInput('gcov');
|
|
||||||
const gcovArgs = core.getInput('gcov_args');
|
|
||||||
const gcovIgnore = core.getInput('gcov_ignore');
|
|
||||||
const gcovInclude = core.getInput('gcov_include');
|
|
||||||
const functionalities = core.getInput('functionalities');
|
|
||||||
const name = core.getInput('name');
|
|
||||||
const os = core.getInput('os');
|
|
||||||
const overrideBranch = core.getInput('override_branch');
|
|
||||||
const overrideBuild = core.getInput('override_build');
|
|
||||||
const overrideCommit = core.getInput('override_commit');
|
|
||||||
const overridePr = core.getInput('override_pr');
|
|
||||||
const overrideTag = core.getInput('override_tag');
|
|
||||||
const rootDir = core.getInput('root_dir');
|
|
||||||
const searchDir = core.getInput('directory');
|
|
||||||
const slug = core.getInput('slug');
|
|
||||||
const token = core.getInput('token');
|
|
||||||
let uploaderVersion = core.getInput('version');
|
|
||||||
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 execArgs = [];
|
|
||||||
execArgs.push(
|
|
||||||
'-n',
|
|
||||||
`${name}`,
|
|
||||||
'-Q',
|
|
||||||
`github-action-${version}`,
|
|
||||||
);
|
|
||||||
|
|
||||||
const options:any = {};
|
|
||||||
options.env = Object.assign(process.env, {
|
|
||||||
GITHUB_ACTION: process.env.GITHUB_ACTION,
|
|
||||||
GITHUB_RUN_ID: process.env.GITHUB_RUN_ID,
|
|
||||||
GITHUB_REF: process.env.GITHUB_REF,
|
|
||||||
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY,
|
|
||||||
GITHUB_SHA: process.env.GITHUB_SHA,
|
|
||||||
GITHUB_HEAD_REF: process.env.GITHUB_HEAD_REF || '',
|
|
||||||
});
|
|
||||||
|
|
||||||
const envVarsArg = [];
|
|
||||||
for (const envVar of envVars.split(',')) {
|
|
||||||
const envVarClean = envVar.trim();
|
|
||||||
if (envVarClean) {
|
|
||||||
options.env[envVarClean] = process.env[envVarClean];
|
|
||||||
envVarsArg.push(envVarClean);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (token) {
|
|
||||||
options.env.CODECOV_TOKEN = token;
|
|
||||||
}
|
|
||||||
if (clean) {
|
|
||||||
execArgs.push('-c');
|
|
||||||
}
|
|
||||||
if (commitParent) {
|
|
||||||
execArgs.push('-N', `${commitParent}`);
|
|
||||||
}
|
|
||||||
if (dryRun) {
|
|
||||||
execArgs.push('-d');
|
|
||||||
}
|
|
||||||
if (envVarsArg.length) {
|
|
||||||
execArgs.push('-e', envVarsArg.join(','));
|
|
||||||
}
|
|
||||||
if (functionalities) {
|
|
||||||
functionalities.split(',').map((f) => f.trim()).forEach((f) => {
|
|
||||||
execArgs.push('-X', `${f}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (failCi) {
|
|
||||||
execArgs.push('-Z');
|
|
||||||
}
|
|
||||||
if (file) {
|
|
||||||
execArgs.push('-f', `${file}`);
|
|
||||||
}
|
|
||||||
if (files) {
|
|
||||||
files.split(',').map((f) => f.trim()).forEach((f) => {
|
|
||||||
execArgs.push('-f', `${f}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (flags) {
|
|
||||||
flags.split(',').map((f) => f.trim()).forEach((f) => {
|
|
||||||
execArgs.push('-F', `${f}`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (gcov) {
|
|
||||||
execArgs.push('-g');
|
|
||||||
}
|
|
||||||
if (gcovArgs) {
|
|
||||||
execArgs.push('--gcovArgs', `${gcovArgs}`);
|
|
||||||
}
|
|
||||||
if (gcovIgnore) {
|
|
||||||
execArgs.push('--gcovIgnore', `${gcovIgnore}`);
|
|
||||||
}
|
|
||||||
if (gcovInclude) {
|
|
||||||
execArgs.push('--gcovInclude', `${gcovInclude}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (overrideBranch) {
|
|
||||||
execArgs.push('-B', `${overrideBranch}`);
|
|
||||||
}
|
|
||||||
if (overrideBuild) {
|
|
||||||
execArgs.push('-b', `${overrideBuild}`);
|
|
||||||
}
|
|
||||||
if (overrideCommit) {
|
|
||||||
execArgs.push('-C', `${overrideCommit}`);
|
|
||||||
} else if (
|
|
||||||
`${context.eventName}` == 'pull_request' ||
|
|
||||||
`${context.eventName}` == 'pull_request_target'
|
|
||||||
) {
|
|
||||||
execArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
|
||||||
}
|
|
||||||
if (overridePr) {
|
|
||||||
execArgs.push('-P', `${overridePr}`);
|
|
||||||
} else if (
|
|
||||||
`${context.eventName}` == 'pull_request_target'
|
|
||||||
) {
|
|
||||||
execArgs.push('-P', `${context.payload.number}`);
|
|
||||||
}
|
|
||||||
if (overrideTag) {
|
|
||||||
execArgs.push('-T', `${overrideTag}`);
|
|
||||||
}
|
|
||||||
if (rootDir) {
|
|
||||||
execArgs.push('-R', `${rootDir}`);
|
|
||||||
}
|
|
||||||
if (searchDir) {
|
|
||||||
execArgs.push('-s', `${searchDir}`);
|
|
||||||
}
|
|
||||||
if (slug) {
|
|
||||||
execArgs.push('-r', `${slug}`);
|
|
||||||
}
|
|
||||||
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}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uploaderVersion == '') {
|
|
||||||
uploaderVersion = 'latest';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (verbose) {
|
|
||||||
console.debug({execArgs});
|
|
||||||
}
|
|
||||||
|
|
||||||
return {execArgs, options, failCi, os, uploaderVersion, verbose};
|
|
||||||
};
|
|
||||||
|
|
||||||
const buildCommitExec = () => {
|
const buildCommitExec = () => {
|
||||||
const commitParent = core.getInput('commit_parent');
|
const commitParent = core.getInput('commit_parent');
|
||||||
const overrideBranch = core.getInput('override_branch');
|
const overrideBranch = core.getInput('override_branch');
|
||||||
|
|
@ -250,7 +82,7 @@ const buildGeneralExec = () => {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
args.push('-v');
|
args.push('-v');
|
||||||
}
|
}
|
||||||
return args;
|
return {args, verbose};
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildReportExec = () => {
|
const buildReportExec = () => {
|
||||||
|
|
@ -419,7 +251,6 @@ const buildUploadExec = () => {
|
||||||
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
buildExec,
|
|
||||||
buildCommitExec,
|
buildCommitExec,
|
||||||
buildGeneralExec,
|
buildGeneralExec,
|
||||||
buildReportExec,
|
buildReportExec,
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import {
|
||||||
isValidPlatform,
|
isValidPlatform,
|
||||||
isWindows,
|
isWindows,
|
||||||
PLATFORMS,
|
PLATFORMS,
|
||||||
|
getCommand,
|
||||||
} from './helpers';
|
} from './helpers';
|
||||||
|
|
||||||
let OLDOS = process.env.RUNNER_OS;
|
let OLDOS = process.env.RUNNER_OS;
|
||||||
|
|
@ -39,19 +40,19 @@ test('getBaseUrl', () => {
|
||||||
expect(PLATFORMS.map((platform) => {
|
expect(PLATFORMS.map((platform) => {
|
||||||
return getBaseUrl(platform, 'latest');
|
return getBaseUrl(platform, 'latest');
|
||||||
})).toEqual([
|
})).toEqual([
|
||||||
'https://uploader.codecov.io/latest/alpine/codecov',
|
'https://cli.codecov.io/latest/alpine/codecov',
|
||||||
'https://uploader.codecov.io/latest/linux/codecov',
|
'https://cli.codecov.io/latest/linux/codecov',
|
||||||
'https://uploader.codecov.io/latest/macos/codecov',
|
'https://cli.codecov.io/latest/macos/codecov',
|
||||||
'https://uploader.codecov.io/latest/windows/codecov.exe',
|
'https://cli.codecov.io/latest/windows/codecov.exe',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
expect(PLATFORMS.map((platform) => {
|
expect(PLATFORMS.map((platform) => {
|
||||||
return getBaseUrl(platform, 'v0.1.0_8880');
|
return getBaseUrl(platform, 'v0.1.0_8880');
|
||||||
})).toEqual([
|
})).toEqual([
|
||||||
'https://uploader.codecov.io/v0.1.0_8880/alpine/codecov',
|
'https://cli.codecov.io/v0.1.0_8880/alpine/codecov',
|
||||||
'https://uploader.codecov.io/v0.1.0_8880/linux/codecov',
|
'https://cli.codecov.io/v0.1.0_8880/linux/codecov',
|
||||||
'https://uploader.codecov.io/v0.1.0_8880/macos/codecov',
|
'https://cli.codecov.io/v0.1.0_8880/macos/codecov',
|
||||||
'https://uploader.codecov.io/v0.1.0_8880/windows/codecov.exe',
|
'https://cli.codecov.io/v0.1.0_8880/windows/codecov.exe',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -68,3 +69,8 @@ test('isValidPlatform', () => {
|
||||||
|
|
||||||
expect(isValidPlatform('fakeos')).toBeFalsy();
|
expect(isValidPlatform('fakeos')).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('getCommand', () => {
|
||||||
|
expect(getCommand('path', ['-v', '-x'], 'do-upload'))
|
||||||
|
.toEqual('path -v -x do-upload');
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,15 @@ const getPlatform = (os?: string): string => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getBaseUrl = (platform: string, version: string): string => {
|
const getBaseUrl = (platform: string, version: string): string => {
|
||||||
return `https://uploader.codecov.io/${version}/${platform}/${getUploaderName(platform)}`;
|
return `https://cli.codecov.io/${version}/${platform}/${getUploaderName(platform)}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getCommand = (
|
||||||
|
filename: string,
|
||||||
|
generalArgs:string[],
|
||||||
|
command: string,
|
||||||
|
): string => {
|
||||||
|
return filename + ' ' + generalArgs.join(' ') + ' ' + command;
|
||||||
};
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
|
@ -55,4 +63,5 @@ export {
|
||||||
isValidPlatform,
|
isValidPlatform,
|
||||||
isWindows,
|
isWindows,
|
||||||
setFailure,
|
setFailure,
|
||||||
|
getCommand,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
68
src/index.ts
68
src/index.ts
|
|
@ -4,12 +4,18 @@ import * as path from 'path';
|
||||||
|
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
import {buildExec} from './buildExec';
|
import {
|
||||||
|
buildCommitExec,
|
||||||
|
buildGeneralExec,
|
||||||
|
buildReportExec,
|
||||||
|
buildUploadExec,
|
||||||
|
} from './buildExec';
|
||||||
import {
|
import {
|
||||||
getBaseUrl,
|
getBaseUrl,
|
||||||
getPlatform,
|
getPlatform,
|
||||||
getUploaderName,
|
getUploaderName,
|
||||||
setFailure,
|
setFailure,
|
||||||
|
getCommand,
|
||||||
} from './helpers';
|
} from './helpers';
|
||||||
|
|
||||||
import verify from './validate';
|
import verify from './validate';
|
||||||
|
|
@ -18,7 +24,18 @@ import versionInfo from './version';
|
||||||
let failCi;
|
let failCi;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const {execArgs, options, failCi, os, uploaderVersion, verbose} = buildExec();
|
const {commitExecArgs, commitOptions, commitCommand} = buildCommitExec();
|
||||||
|
const {reportExecArgs, reportOptions, reportCommand} = buildReportExec();
|
||||||
|
const {
|
||||||
|
uploadExecArgs,
|
||||||
|
uploadOptions,
|
||||||
|
failCi,
|
||||||
|
os,
|
||||||
|
uploaderVersion,
|
||||||
|
uploadCommand,
|
||||||
|
} = buildUploadExec();
|
||||||
|
const {args, verbose} = buildGeneralExec();
|
||||||
|
|
||||||
const platform = getPlatform(os);
|
const platform = getPlatform(os);
|
||||||
|
|
||||||
const filename = path.join( __dirname, getUploaderName(platform));
|
const filename = path.join( __dirname, getUploaderName(platform));
|
||||||
|
|
@ -49,14 +66,51 @@ try {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
await exec.exec(filename, execArgs, options)
|
const doUpload = async () => {
|
||||||
.catch((err) => {
|
await exec.exec(getCommand(filename, args, uploadCommand),
|
||||||
|
uploadExecArgs,
|
||||||
|
uploadOptions)
|
||||||
|
.catch((err) => {
|
||||||
|
setFailure(
|
||||||
|
`Codecov:
|
||||||
|
Failed to properly upload report: ${err.message}`,
|
||||||
|
failCi,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const createReport = async () => {
|
||||||
|
await exec.exec(
|
||||||
|
getCommand(filename, args, reportCommand),
|
||||||
|
reportExecArgs,
|
||||||
|
reportOptions)
|
||||||
|
.then(async (exitCode) => {
|
||||||
|
if (exitCode == 0) {
|
||||||
|
await doUpload();
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
setFailure(
|
||||||
|
`Codecov:
|
||||||
|
Failed to properly create report: ${err.message}`,
|
||||||
|
failCi,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
await exec.exec(
|
||||||
|
getCommand(
|
||||||
|
filename,
|
||||||
|
args,
|
||||||
|
commitCommand,
|
||||||
|
), commitExecArgs, commitOptions)
|
||||||
|
.then(async (exitCode) => {
|
||||||
|
if (exitCode == 0) {
|
||||||
|
await createReport();
|
||||||
|
}
|
||||||
|
unlink();
|
||||||
|
}).catch((err) => {
|
||||||
setFailure(
|
setFailure(
|
||||||
`Codecov: Failed to properly upload: ${err.message}`,
|
`Codecov: Failed to properly create commit: ${err.message}`,
|
||||||
failCi,
|
failCi,
|
||||||
);
|
);
|
||||||
}).then(() => {
|
|
||||||
unlink();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue