mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-08 16:16:24 +00:00
feat: allow for authentication via OIDC token (#1330)
* fix: allow for oidc token * chore(docs): update docs with use_oidc argument * Update action.yml Co-authored-by: Cristian Le <github@lecris.me> * chore(release): 4.2.0 --------- Co-authored-by: Cristian Le <github@lecris.me>
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
"@typescript-eslint"
|
"@typescript-eslint"
|
||||||
],
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
|
"max-len": ["error", { "code": 120 }],
|
||||||
"linebreak-style": 0
|
"linebreak-style": 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
76
README.md
76
README.md
@@ -64,44 +64,56 @@ steps:
|
|||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> This assumes that you've set your Codecov token inside *Settings > Secrets* as `CODECOV_TOKEN`. If not, you can [get an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) for your specific repo on [codecov.io](https://www.codecov.io). Keep in mind that secrets are *not* available to forks of repositories.
|
> This assumes that you've set your Codecov token inside *Settings > Secrets* as `CODECOV_TOKEN`. If not, you can [get an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) for your specific repo on [codecov.io](https://www.codecov.io). Keep in mind that secrets are *not* available to forks of repositories.
|
||||||
|
|
||||||
|
### Using OIDC
|
||||||
|
For users with [OpenID Connect(OIDC) enabled](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect), the Codecov token is not necessary. You can use OIDC with the `use_oidc` argument as following.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: codecov/codecov-action@v4
|
||||||
|
with:
|
||||||
|
use_oidc: true
|
||||||
|
```
|
||||||
|
|
||||||
|
Any token supplied will be ignored, as Codecov will default to the OIDC token for verification.
|
||||||
|
|
||||||
## Arguments
|
## Arguments
|
||||||
|
|
||||||
Codecov's Action supports inputs from the user. These inputs, along with their descriptions and usage contexts, are listed in the table below:
|
Codecov's Action supports inputs from the user. These inputs, along with their descriptions and usage contexts, are listed in the table below:
|
||||||
|
|
||||||
| Input | Description | Required |
|
| Input | Description | Required |
|
||||||
| :--- | :--- | :---: |
|
| :--- | :--- | :---: |
|
||||||
| `token` | Repository Codecov token. Used to authorize report uploads | *Required
|
| `token` | Repository Codecov token. Used to authorize report uploads | *Required
|
||||||
| `codecov_yml_path` | Specify the path to the Codecov YML | Optional
|
| `codecov_yml_path` | Specify the path to the Codecov YML | Optional
|
||||||
| `commit_parent` | Override to specify the parent commit SHA | Optional
|
| `commit_parent` | Override to specify the parent commit SHA | Optional
|
||||||
| `directory` | Directory to search for coverage reports. | Optional
|
| `directory` | Directory to search for coverage reports. | Optional
|
||||||
| `disable_search` | Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option. | Optional
|
| `disable_search` | Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option. | Optional
|
||||||
| `disable_file_fixes` | Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets) | Optional
|
| `disable_file_fixes` | Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets) | Optional
|
||||||
| `dry_run` | Don't upload files to Codecov | Optional
|
| `dry_run` | Don't upload files to Codecov | Optional
|
||||||
| `env_vars` | Environment variables to tag the upload with (e.g. PYTHON \| OS,PYTHON) | Optional
|
| `env_vars` | Environment variables to tag the upload with (e.g. PYTHON \| OS,PYTHON) | Optional
|
||||||
| `exclude` | Folders to exclude from search | Optional
|
| `exclude` | Folders to exclude from search | Optional
|
||||||
| `fail_ci_if_error` | Specify whether or not CI build should fail if Codecov runs into an error during upload | Optional
|
| `fail_ci_if_error` | Specify whether or not CI build should fail if Codecov runs into an error during upload | Optional
|
||||||
| `file` | Path to coverage file to upload | Optional
|
| `file` | Path to coverage file to upload | Optional
|
||||||
| `files` | Comma-separated list of files to upload | Optional
|
| `files` | Comma-separated list of files to upload | Optional
|
||||||
| `flags` | Flag upload to group coverage metrics (e.g. unittests \| integration \| ui,chrome) | Optional
|
| `flags` | Flag upload to group coverage metrics (e.g. unittests \| integration \| ui,chrome) | Optional
|
||||||
| `handle_no_reports_found` | Raise no exceptions when no coverage reports found | Optional
|
| `handle_no_reports_found` | Raise no exceptions when no coverage reports found | Optional
|
||||||
| `job_code` | The job code | Optional
|
| `job_code` | The job code | Optional
|
||||||
| `name` | User defined upload name. Visible in Codecov UI | Optional
|
| `name` | User defined upload name. Visible in Codecov UI | Optional
|
||||||
| `os` | Override the assumed OS. Options are linux \| macos \| windows \| . | Optional
|
| `os` | Override the assumed OS. Options are linux \| macos \| windows \| . | Optional
|
||||||
| `override_branch` | Specify the branch name | Optional
|
| `override_branch` | Specify the branch name | Optional
|
||||||
| `override_build` | Specify the build number | Optional
|
| `override_build` | Specify the build number | Optional
|
||||||
| `override_build_url` | The URL of the build where this is running | Optional
|
| `override_build_url` | The URL of the build where this is running | Optional
|
||||||
| `override_commit` | Specify the commit SHA | Optional
|
| `override_commit` | Specify the commit SHA | Optional
|
||||||
| `override_pr` | Specify the pull request number | Optional
|
| `override_pr` | Specify the pull request number | Optional
|
||||||
| `plugin` | plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. | Optional
|
| `plugin` | plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. | Optional
|
||||||
| `plugins` | Comma-separated list of plugins for use during upload. | Optional
|
| `plugins` | Comma-separated list of plugins for use during upload. | Optional
|
||||||
| `report_code` | The code of the report. If unsure, do not include | Optional
|
| `report_code` | The code of the report. If unsure, do not include | Optional
|
||||||
| `root_dir` | Used to specify the location of your .git root to identify project root directory | Optional
|
| `root_dir` | Used to specify the location of your .git root to identify project root directory | Optional
|
||||||
| `slug` | Specify the slug manually (Enterprise use) | Optional
|
| `slug` | Specify the slug manually (Enterprise use) | Optional
|
||||||
| `url` | Specify the base url to upload (Enterprise use) | Optional
|
| `url` | Specify the base url to upload (Enterprise use) | Optional
|
||||||
| `use_legacy_upload_endpoint` | Use the legacy upload endpoint | Optional
|
| `use_legacy_upload_endpoint` | Use the legacy upload endpoint | Optional
|
||||||
| `verbose` | Specify whether the Codecov output should be verbose | Optional
|
| `use_oidc` | Use OpenID Connect for verification instead of token. This will ignore any token supplied. Please see [GitHub documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect) for details.
|
||||||
| `version` | Specify which version of the Codecov CLI should be used. Defaults to `latest` | Optional
|
| `verbose` | Specify whether the Codecov output should be verbose | Optional
|
||||||
| `working-directory` | Directory in which to execute codecov.sh | Optional
|
| `version` | Specify which version of the Codecov CLI should be used. Defaults to `latest` | Optional
|
||||||
|
| `working-directory` | Directory in which to execute codecov.sh | Optional
|
||||||
|
|
||||||
### Example `workflow.yml` with Codecov Action
|
### Example `workflow.yml` with Codecov Action
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ inputs:
|
|||||||
use_legacy_upload_endpoint:
|
use_legacy_upload_endpoint:
|
||||||
description: 'Use the legacy upload endpoint'
|
description: 'Use the legacy upload endpoint'
|
||||||
required: false
|
required: false
|
||||||
|
use_oidc:
|
||||||
|
description: 'Use OIDC instead of token. This will ignore any token supplied'
|
||||||
|
default: false
|
||||||
verbose:
|
verbose:
|
||||||
description: 'Specify whether the Codecov output should be verbose'
|
description: 'Specify whether the Codecov output should be verbose'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
309
dist/index.js
vendored
309
dist/index.js
vendored
@@ -32452,8 +32452,94 @@ var exec = __nccwpck_require__(1514);
|
|||||||
var 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: ./src/helpers.ts
|
||||||
|
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const PLATFORMS = [
|
||||||
|
'linux',
|
||||||
|
'macos',
|
||||||
|
'windows',
|
||||||
|
'alpine',
|
||||||
|
'linux-arm64',
|
||||||
|
'alpine-arm64',
|
||||||
|
];
|
||||||
|
const setFailure = (message, failCi) => {
|
||||||
|
failCi ? core.setFailed(message) : core.warning(message);
|
||||||
|
if (failCi) {
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const getUploaderName = (platform) => {
|
||||||
|
if (isWindows(platform)) {
|
||||||
|
return 'codecov.exe';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 'codecov';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const isValidPlatform = (platform) => {
|
||||||
|
return PLATFORMS.includes(platform);
|
||||||
|
};
|
||||||
|
const isWindows = (platform) => {
|
||||||
|
return platform === 'windows';
|
||||||
|
};
|
||||||
|
const getPlatform = (os) => {
|
||||||
|
var _a;
|
||||||
|
if (isValidPlatform(os)) {
|
||||||
|
core.info(`==> ${os} OS provided`);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
const platform = (_a = process.env.RUNNER_OS) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
||||||
|
if (isValidPlatform(platform)) {
|
||||||
|
core.info(`==> ${platform} OS detected`);
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
core.info('==> Could not detect OS or provided OS is invalid. Defaulting to linux');
|
||||||
|
return 'linux';
|
||||||
|
};
|
||||||
|
const getBaseUrl = (platform, version) => {
|
||||||
|
return `https://cli.codecov.io/${version}/${platform}/${getUploaderName(platform)}`;
|
||||||
|
};
|
||||||
|
const getCommand = (filename, generalArgs, command) => {
|
||||||
|
const fullCommand = [filename, ...generalArgs, command];
|
||||||
|
core.info(`==> Running command '${fullCommand.join(' ')}'`);
|
||||||
|
return fullCommand;
|
||||||
|
};
|
||||||
|
const setSafeDirectory = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
const command = ([
|
||||||
|
'git',
|
||||||
|
'config',
|
||||||
|
'--global',
|
||||||
|
'--add',
|
||||||
|
'safe.directory',
|
||||||
|
`${process.env['GITHUB_WORKSPACE']}`,
|
||||||
|
].join(' '));
|
||||||
|
core.info(`==> Running ${command}`);
|
||||||
|
yield exec.exec(command);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./src/buildExec.ts
|
;// CONCATENATED MODULE: ./src/buildExec.ts
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
var buildExec_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
@@ -32465,14 +32551,32 @@ const isTrue = (variable) => {
|
|||||||
lowercase === 'y' ||
|
lowercase === 'y' ||
|
||||||
lowercase === 'yes');
|
lowercase === 'yes');
|
||||||
};
|
};
|
||||||
const buildCommitExec = () => {
|
const getToken = () => buildExec_awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
let token = core.getInput('token');
|
||||||
|
let url = core.getInput('url');
|
||||||
|
const useOIDC = isTrue(core.getInput('use_oidc'));
|
||||||
|
if (useOIDC) {
|
||||||
|
if (!url) {
|
||||||
|
url = 'https://codecov.io';
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
token = yield core.getIDToken(url);
|
||||||
|
return token;
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
setFailure(`Codecov: Failed to get OIDC token with url: ${url}. ${err.message}`, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
});
|
||||||
|
const buildCommitExec = () => buildExec_awaiter(void 0, void 0, void 0, function* () {
|
||||||
const commitParent = core.getInput('commit_parent');
|
const commitParent = core.getInput('commit_parent');
|
||||||
const gitService = core.getInput('git_service');
|
const gitService = core.getInput('git_service');
|
||||||
const overrideBranch = core.getInput('override_branch');
|
const overrideBranch = core.getInput('override_branch');
|
||||||
const overrideCommit = core.getInput('override_commit');
|
const overrideCommit = core.getInput('override_commit');
|
||||||
const overridePr = core.getInput('override_pr');
|
const overridePr = core.getInput('override_pr');
|
||||||
const slug = core.getInput('slug');
|
const slug = core.getInput('slug');
|
||||||
const token = core.getInput('token');
|
const token = yield getToken();
|
||||||
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
||||||
const workingDir = core.getInput('working-directory');
|
const workingDir = core.getInput('working-directory');
|
||||||
const commitCommand = 'create-commit';
|
const commitCommand = 'create-commit';
|
||||||
@@ -32519,7 +32623,7 @@ const buildCommitExec = () => {
|
|||||||
commitOptions.cwd = workingDir;
|
commitOptions.cwd = workingDir;
|
||||||
}
|
}
|
||||||
return { commitExecArgs, commitOptions, commitCommand };
|
return { commitExecArgs, commitOptions, commitCommand };
|
||||||
};
|
});
|
||||||
const buildGeneralExec = () => {
|
const buildGeneralExec = () => {
|
||||||
const codecovYmlPath = core.getInput('codecov_yml_path');
|
const codecovYmlPath = core.getInput('codecov_yml_path');
|
||||||
const url = core.getInput('url');
|
const url = core.getInput('url');
|
||||||
@@ -32536,12 +32640,12 @@ const buildGeneralExec = () => {
|
|||||||
}
|
}
|
||||||
return { args, verbose };
|
return { args, verbose };
|
||||||
};
|
};
|
||||||
const buildReportExec = () => {
|
const buildReportExec = () => buildExec_awaiter(void 0, void 0, void 0, function* () {
|
||||||
const gitService = core.getInput('git_service');
|
const gitService = core.getInput('git_service');
|
||||||
const overrideCommit = core.getInput('override_commit');
|
const overrideCommit = core.getInput('override_commit');
|
||||||
const overridePr = core.getInput('override_pr');
|
const overridePr = core.getInput('override_pr');
|
||||||
const slug = core.getInput('slug');
|
const slug = core.getInput('slug');
|
||||||
const token = core.getInput('token');
|
const token = yield getToken();
|
||||||
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
||||||
const workingDir = core.getInput('working-directory');
|
const workingDir = core.getInput('working-directory');
|
||||||
const reportCommand = 'create-report';
|
const reportCommand = 'create-report';
|
||||||
@@ -32582,8 +32686,8 @@ const buildReportExec = () => {
|
|||||||
reportOptions.cwd = workingDir;
|
reportOptions.cwd = workingDir;
|
||||||
}
|
}
|
||||||
return { reportExecArgs, reportOptions, reportCommand };
|
return { reportExecArgs, reportOptions, reportCommand };
|
||||||
};
|
});
|
||||||
const buildUploadExec = () => {
|
const buildUploadExec = () => buildExec_awaiter(void 0, void 0, void 0, function* () {
|
||||||
const disableFileFixes = isTrue(core.getInput('disable_file_fixes'));
|
const disableFileFixes = isTrue(core.getInput('disable_file_fixes'));
|
||||||
const disableSafeDirectory = isTrue(core.getInput('disable_safe_directory'));
|
const disableSafeDirectory = isTrue(core.getInput('disable_safe_directory'));
|
||||||
const disableSearch = isTrue(core.getInput('disable_search'));
|
const disableSearch = isTrue(core.getInput('disable_search'));
|
||||||
@@ -32610,7 +32714,7 @@ const buildUploadExec = () => {
|
|||||||
const rootDir = core.getInput('root_dir');
|
const rootDir = core.getInput('root_dir');
|
||||||
const searchDir = core.getInput('directory');
|
const searchDir = core.getInput('directory');
|
||||||
const slug = core.getInput('slug');
|
const slug = core.getInput('slug');
|
||||||
const token = core.getInput('token');
|
const token = yield getToken();
|
||||||
let uploaderVersion = core.getInput('version');
|
let uploaderVersion = core.getInput('version');
|
||||||
const useLegacyUploadEndpoint = isTrue(core.getInput('use_legacy_upload_endpoint'));
|
const useLegacyUploadEndpoint = isTrue(core.getInput('use_legacy_upload_endpoint'));
|
||||||
const workingDir = core.getInput('working-directory');
|
const workingDir = core.getInput('working-directory');
|
||||||
@@ -32737,82 +32841,6 @@ const buildUploadExec = () => {
|
|||||||
uploaderVersion,
|
uploaderVersion,
|
||||||
uploadCommand,
|
uploadCommand,
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
;// CONCATENATED MODULE: ./src/helpers.ts
|
|
||||||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const PLATFORMS = [
|
|
||||||
'linux',
|
|
||||||
'macos',
|
|
||||||
'windows',
|
|
||||||
'alpine',
|
|
||||||
'linux-arm64',
|
|
||||||
'alpine-arm64',
|
|
||||||
];
|
|
||||||
const setFailure = (message, failCi) => {
|
|
||||||
failCi ? core.setFailed(message) : core.warning(message);
|
|
||||||
if (failCi) {
|
|
||||||
process.exit();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const getUploaderName = (platform) => {
|
|
||||||
if (isWindows(platform)) {
|
|
||||||
return 'codecov.exe';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return 'codecov';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
const isValidPlatform = (platform) => {
|
|
||||||
return PLATFORMS.includes(platform);
|
|
||||||
};
|
|
||||||
const isWindows = (platform) => {
|
|
||||||
return platform === 'windows';
|
|
||||||
};
|
|
||||||
const getPlatform = (os) => {
|
|
||||||
var _a;
|
|
||||||
if (isValidPlatform(os)) {
|
|
||||||
core.info(`==> ${os} OS provided`);
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
const platform = (_a = process.env.RUNNER_OS) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
||||||
if (isValidPlatform(platform)) {
|
|
||||||
core.info(`==> ${platform} OS detected`);
|
|
||||||
return platform;
|
|
||||||
}
|
|
||||||
core.info('==> Could not detect OS or provided OS is invalid. Defaulting to linux');
|
|
||||||
return 'linux';
|
|
||||||
};
|
|
||||||
const getBaseUrl = (platform, version) => {
|
|
||||||
return `https://cli.codecov.io/${version}/${platform}/${getUploaderName(platform)}`;
|
|
||||||
};
|
|
||||||
const getCommand = (filename, generalArgs, command) => {
|
|
||||||
const fullCommand = [filename, ...generalArgs, command];
|
|
||||||
core.info(`==> Running command '${fullCommand.join(' ')}'`);
|
|
||||||
return fullCommand;
|
|
||||||
};
|
|
||||||
const setSafeDirectory = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
||||||
const command = ([
|
|
||||||
'git',
|
|
||||||
'config',
|
|
||||||
'--global',
|
|
||||||
'--add',
|
|
||||||
'safe.directory',
|
|
||||||
`${process.env['GITHUB_WORKSPACE']}`,
|
|
||||||
].join(' '));
|
|
||||||
core.info(`==> Running ${command}`);
|
|
||||||
yield exec.exec(command);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -32957,68 +32985,71 @@ var src_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|||||||
|
|
||||||
|
|
||||||
let failCi;
|
let failCi;
|
||||||
try {
|
const run = () => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
const { commitExecArgs, commitOptions, commitCommand } = buildCommitExec();
|
try {
|
||||||
const { reportExecArgs, reportOptions, reportCommand } = buildReportExec();
|
const { commitExecArgs, commitOptions, commitCommand } = yield buildCommitExec();
|
||||||
const { uploadExecArgs, uploadOptions, disableSafeDirectory, failCi, os, uploaderVersion, uploadCommand, } = buildUploadExec();
|
const { reportExecArgs, reportOptions, reportCommand } = yield buildReportExec();
|
||||||
const { args, verbose } = buildGeneralExec();
|
const { uploadExecArgs, uploadOptions, disableSafeDirectory, failCi, os, uploaderVersion, uploadCommand, } = yield buildUploadExec();
|
||||||
const platform = getPlatform(os);
|
const { args, verbose } = buildGeneralExec();
|
||||||
const filename = external_path_.join(__dirname, getUploaderName(platform));
|
const platform = getPlatform(os);
|
||||||
external_https_.get(getBaseUrl(platform, uploaderVersion), (res) => {
|
const filename = external_path_.join(__dirname, getUploaderName(platform));
|
||||||
// Image will be stored at this path
|
external_https_.get(getBaseUrl(platform, uploaderVersion), (res) => {
|
||||||
const filePath = external_fs_.createWriteStream(filename);
|
// Image will be stored at this path
|
||||||
res.pipe(filePath);
|
const filePath = external_fs_.createWriteStream(filename);
|
||||||
filePath
|
res.pipe(filePath);
|
||||||
.on('error', (err) => {
|
filePath
|
||||||
setFailure(`Codecov: Failed to write uploader binary: ${err.message}`, true);
|
.on('error', (err) => {
|
||||||
}).on('finish', () => src_awaiter(void 0, void 0, void 0, function* () {
|
setFailure(`Codecov: Failed to write uploader binary: ${err.message}`, true);
|
||||||
filePath.close();
|
}).on('finish', () => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
yield validate(filename, platform, uploaderVersion, verbose, failCi);
|
filePath.close();
|
||||||
yield version(platform, uploaderVersion);
|
yield validate(filename, platform, uploaderVersion, verbose, failCi);
|
||||||
yield external_fs_.chmodSync(filename, '777');
|
yield version(platform, uploaderVersion);
|
||||||
if (!disableSafeDirectory) {
|
yield external_fs_.chmodSync(filename, '777');
|
||||||
yield setSafeDirectory();
|
if (!disableSafeDirectory) {
|
||||||
}
|
yield setSafeDirectory();
|
||||||
const unlink = () => {
|
}
|
||||||
external_fs_.unlink(filename, (err) => {
|
const unlink = () => {
|
||||||
if (err) {
|
external_fs_.unlink(filename, (err) => {
|
||||||
setFailure(`Codecov: Could not unlink uploader: ${err.message}`, failCi);
|
if (err) {
|
||||||
}
|
setFailure(`Codecov: Could not unlink uploader: ${err.message}`, failCi);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const doUpload = () => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
|
yield exec.exec(getCommand(filename, args, uploadCommand).join(' '), uploadExecArgs, uploadOptions)
|
||||||
|
.catch((err) => {
|
||||||
|
setFailure(`Codecov:
|
||||||
|
Failed to properly upload report: ${err.message}`, failCi);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
const createReport = () => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
const doUpload = () => src_awaiter(void 0, void 0, void 0, function* () {
|
yield exec.exec(getCommand(filename, args, reportCommand).join(' '), reportExecArgs, reportOptions)
|
||||||
yield exec.exec(getCommand(filename, args, uploadCommand).join(' '), uploadExecArgs, uploadOptions)
|
.then((exitCode) => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
.catch((err) => {
|
if (exitCode == 0) {
|
||||||
setFailure(`Codecov:
|
yield doUpload();
|
||||||
Failed to properly upload report: ${err.message}`, failCi);
|
}
|
||||||
|
})).catch((err) => {
|
||||||
|
setFailure(`Codecov:
|
||||||
|
Failed to properly create report: ${err.message}`, failCi);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
yield exec.exec(getCommand(filename, args, commitCommand).join(' '), commitExecArgs, commitOptions)
|
||||||
const createReport = () => src_awaiter(void 0, void 0, void 0, function* () {
|
|
||||||
yield exec.exec(getCommand(filename, args, reportCommand).join(' '), reportExecArgs, reportOptions)
|
|
||||||
.then((exitCode) => src_awaiter(void 0, void 0, void 0, function* () {
|
.then((exitCode) => src_awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (exitCode == 0) {
|
if (exitCode == 0) {
|
||||||
yield doUpload();
|
yield createReport();
|
||||||
}
|
}
|
||||||
|
unlink();
|
||||||
})).catch((err) => {
|
})).catch((err) => {
|
||||||
setFailure(`Codecov:
|
setFailure(`Codecov: Failed to properly create commit: ${err.message}`, failCi);
|
||||||
Failed to properly create report: ${err.message}`, failCi);
|
|
||||||
});
|
});
|
||||||
});
|
}));
|
||||||
yield exec.exec(getCommand(filename, args, commitCommand).join(' '), commitExecArgs, commitOptions)
|
});
|
||||||
.then((exitCode) => src_awaiter(void 0, void 0, void 0, function* () {
|
}
|
||||||
if (exitCode == 0) {
|
catch (err) {
|
||||||
yield createReport();
|
setFailure(`Codecov: Encountered an unexpected error ${err.message}`, failCi);
|
||||||
}
|
}
|
||||||
unlink();
|
});
|
||||||
})).catch((err) => {
|
run();
|
||||||
setFailure(`Codecov: Failed to properly create commit: ${err.message}`, failCi);
|
|
||||||
});
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
setFailure(`Codecov: Encountered an unexpected error ${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
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "codecov-action",
|
"name": "codecov-action",
|
||||||
"version": "4.1.1",
|
"version": "4.2.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "codecov-action",
|
"name": "codecov-action",
|
||||||
"version": "4.1.1",
|
"version": "4.2.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "codecov-action",
|
"name": "codecov-action",
|
||||||
"version": "4.1.1",
|
"version": "4.2.0",
|
||||||
"description": "Upload coverage reports to Codecov from GitHub Actions",
|
"description": "Upload coverage reports to Codecov from GitHub Actions",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
|
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
|
|
||||||
test('general args', () => {
|
test('general args', async () => {
|
||||||
const envs = {
|
const envs = {
|
||||||
codecov_yml_path: 'dev/codecov.yml',
|
codecov_yml_path: 'dev/codecov.yml',
|
||||||
url: 'https://codecov.enterprise.com',
|
url: 'https://codecov.enterprise.com',
|
||||||
@@ -20,7 +20,7 @@ test('general args', () => {
|
|||||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||||
}
|
}
|
||||||
|
|
||||||
const {args, verbose} = buildGeneralExec();
|
const {args, verbose} = await buildGeneralExec();
|
||||||
|
|
||||||
expect(args).toEqual(
|
expect(args).toEqual(
|
||||||
expect.arrayContaining([
|
expect.arrayContaining([
|
||||||
@@ -36,13 +36,12 @@ test('general args', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('upload args using context', async () => {
|
||||||
test('upload args using context', () => {
|
|
||||||
const expectedArgs = [
|
const expectedArgs = [
|
||||||
'--git-service',
|
'--git-service',
|
||||||
'github',
|
'github',
|
||||||
];
|
];
|
||||||
const {uploadExecArgs, uploadCommand} = buildUploadExec();
|
const {uploadExecArgs, uploadCommand} = await buildUploadExec();
|
||||||
if (context.eventName == 'pull_request') {
|
if (context.eventName == 'pull_request') {
|
||||||
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||||
}
|
}
|
||||||
@@ -54,7 +53,7 @@ test('upload args using context', () => {
|
|||||||
expect(uploadCommand).toEqual('do-upload');
|
expect(uploadCommand).toEqual('do-upload');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('upload args', () => {
|
test('upload args', async () => {
|
||||||
const envs = {
|
const envs = {
|
||||||
'codecov_yml_path': 'dev/codecov.yml',
|
'codecov_yml_path': 'dev/codecov.yml',
|
||||||
'commit_parent': 'fakeparentcommit',
|
'commit_parent': 'fakeparentcommit',
|
||||||
@@ -94,7 +93,7 @@ test('upload args', () => {
|
|||||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||||
}
|
}
|
||||||
|
|
||||||
const {uploadExecArgs, uploadCommand} = buildUploadExec();
|
const {uploadExecArgs, uploadCommand} = await buildUploadExec();
|
||||||
const expectedArgs = [
|
const expectedArgs = [
|
||||||
'--disable-file-fixes',
|
'--disable-file-fixes',
|
||||||
'--disable-search',
|
'--disable-search',
|
||||||
@@ -156,7 +155,7 @@ test('upload args', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('report args', () => {
|
test('report args', async () => {
|
||||||
const envs = {
|
const envs = {
|
||||||
git_service: 'github_enterprise',
|
git_service: 'github_enterprise',
|
||||||
override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244',
|
override_commit: '9caabca5474b49de74ef5667deabaf74cdacc244',
|
||||||
@@ -169,7 +168,7 @@ test('report args', () => {
|
|||||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||||
}
|
}
|
||||||
|
|
||||||
const {reportExecArgs, reportCommand} = buildReportExec();
|
const {reportExecArgs, reportCommand} = await buildReportExec();
|
||||||
|
|
||||||
const expectedArgs = [
|
const expectedArgs = [
|
||||||
'--git-service',
|
'--git-service',
|
||||||
@@ -191,7 +190,7 @@ test('report args', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('report args using context', () => {
|
test('report args using context', async () => {
|
||||||
const envs = {
|
const envs = {
|
||||||
token: 'd3859757-ab80-4664-924d-aef22fa7557b',
|
token: 'd3859757-ab80-4664-924d-aef22fa7557b',
|
||||||
};
|
};
|
||||||
@@ -206,7 +205,7 @@ test('report args using context', () => {
|
|||||||
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const {reportExecArgs, reportCommand} = buildReportExec();
|
const {reportExecArgs, reportCommand} = await buildReportExec();
|
||||||
|
|
||||||
expect(reportExecArgs).toEqual(expectedArgs);
|
expect(reportExecArgs).toEqual(expectedArgs);
|
||||||
expect(reportCommand).toEqual('create-report');
|
expect(reportCommand).toEqual('create-report');
|
||||||
@@ -216,7 +215,7 @@ test('report args using context', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
test('commit args', () => {
|
test('commit args', async () => {
|
||||||
const envs = {
|
const envs = {
|
||||||
git_service: 'github_enterprise',
|
git_service: 'github_enterprise',
|
||||||
commit_parent: '83231650328f11695dfb754ca0f540516f188d27',
|
commit_parent: '83231650328f11695dfb754ca0f540516f188d27',
|
||||||
@@ -231,7 +230,7 @@ test('commit args', () => {
|
|||||||
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
process.env['INPUT_' + env.toUpperCase()] = envs[env];
|
||||||
}
|
}
|
||||||
|
|
||||||
const {commitExecArgs, commitCommand} = buildCommitExec();
|
const {commitExecArgs, commitCommand} = await buildCommitExec();
|
||||||
const expectedArgs = [
|
const expectedArgs = [
|
||||||
'--parent-sha',
|
'--parent-sha',
|
||||||
'83231650328f11695dfb754ca0f540516f188d27',
|
'83231650328f11695dfb754ca0f540516f188d27',
|
||||||
@@ -255,13 +254,13 @@ test('commit args', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('commit args using context', () => {
|
test('commit args using context', async () => {
|
||||||
const expectedArgs :string[] = [
|
const expectedArgs :string[] = [
|
||||||
'--git-service',
|
'--git-service',
|
||||||
'github',
|
'github',
|
||||||
];
|
];
|
||||||
|
|
||||||
const {commitExecArgs, commitCommand} = buildCommitExec();
|
const {commitExecArgs, commitCommand} = await buildCommitExec();
|
||||||
if (context.eventName == 'pull_request') {
|
if (context.eventName == 'pull_request') {
|
||||||
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
expectedArgs.push('-C', `${context.payload.pull_request.head.sha}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
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 {setFailure} from './helpers';
|
||||||
|
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
|
|
||||||
@@ -17,15 +18,36 @@ const isTrue = (variable) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getToken = async () => {
|
||||||
|
let token = core.getInput('token');
|
||||||
|
let url = core.getInput('url');
|
||||||
|
const useOIDC = isTrue(core.getInput('use_oidc'));
|
||||||
|
|
||||||
const buildCommitExec = () => {
|
if (useOIDC) {
|
||||||
|
if (!url) {
|
||||||
|
url = 'https://codecov.io';
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
token = await core.getIDToken(url);
|
||||||
|
return token;
|
||||||
|
} catch (err) {
|
||||||
|
setFailure(
|
||||||
|
`Codecov: Failed to get OIDC token with url: ${url}. ${err.message}`,
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return token;
|
||||||
|
};
|
||||||
|
|
||||||
|
const buildCommitExec = async () => {
|
||||||
const commitParent = core.getInput('commit_parent');
|
const commitParent = core.getInput('commit_parent');
|
||||||
const gitService = core.getInput('git_service');
|
const gitService = core.getInput('git_service');
|
||||||
const overrideBranch = core.getInput('override_branch');
|
const overrideBranch = core.getInput('override_branch');
|
||||||
const overrideCommit = core.getInput('override_commit');
|
const overrideCommit = core.getInput('override_commit');
|
||||||
const overridePr = core.getInput('override_pr');
|
const overridePr = core.getInput('override_pr');
|
||||||
const slug = core.getInput('slug');
|
const slug = core.getInput('slug');
|
||||||
const token = core.getInput('token');
|
const token = await getToken();
|
||||||
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
||||||
const workingDir = core.getInput('working-directory');
|
const workingDir = core.getInput('working-directory');
|
||||||
|
|
||||||
@@ -101,12 +123,12 @@ const buildGeneralExec = () => {
|
|||||||
return {args, verbose};
|
return {args, verbose};
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildReportExec = () => {
|
const buildReportExec = async () => {
|
||||||
const gitService = core.getInput('git_service');
|
const gitService = core.getInput('git_service');
|
||||||
const overrideCommit = core.getInput('override_commit');
|
const overrideCommit = core.getInput('override_commit');
|
||||||
const overridePr = core.getInput('override_pr');
|
const overridePr = core.getInput('override_pr');
|
||||||
const slug = core.getInput('slug');
|
const slug = core.getInput('slug');
|
||||||
const token = core.getInput('token');
|
const token = await getToken();
|
||||||
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
const failCi = isTrue(core.getInput('fail_ci_if_error'));
|
||||||
const workingDir = core.getInput('working-directory');
|
const workingDir = core.getInput('working-directory');
|
||||||
|
|
||||||
@@ -158,7 +180,7 @@ const buildReportExec = () => {
|
|||||||
return {reportExecArgs, reportOptions, reportCommand};
|
return {reportExecArgs, reportOptions, reportCommand};
|
||||||
};
|
};
|
||||||
|
|
||||||
const buildUploadExec = () => {
|
const buildUploadExec = async () => {
|
||||||
const disableFileFixes = isTrue(core.getInput('disable_file_fixes'));
|
const disableFileFixes = isTrue(core.getInput('disable_file_fixes'));
|
||||||
const disableSafeDirectory = isTrue(core.getInput('disable_safe_directory'));
|
const disableSafeDirectory = isTrue(core.getInput('disable_safe_directory'));
|
||||||
const disableSearch = isTrue(core.getInput('disable_search'));
|
const disableSearch = isTrue(core.getInput('disable_search'));
|
||||||
@@ -185,7 +207,7 @@ const buildUploadExec = () => {
|
|||||||
const rootDir = core.getInput('root_dir');
|
const rootDir = core.getInput('root_dir');
|
||||||
const searchDir = core.getInput('directory');
|
const searchDir = core.getInput('directory');
|
||||||
const slug = core.getInput('slug');
|
const slug = core.getInput('slug');
|
||||||
const token = core.getInput('token');
|
const token = await getToken();
|
||||||
let uploaderVersion = core.getInput('version');
|
let uploaderVersion = core.getInput('version');
|
||||||
const useLegacyUploadEndpoint = isTrue(
|
const useLegacyUploadEndpoint = isTrue(
|
||||||
core.getInput('use_legacy_upload_endpoint'),
|
core.getInput('use_legacy_upload_endpoint'),
|
||||||
|
|||||||
170
src/index.ts
170
src/index.ts
@@ -24,102 +24,106 @@ import versionInfo from './version';
|
|||||||
|
|
||||||
let failCi;
|
let failCi;
|
||||||
|
|
||||||
try {
|
const run = async () => {
|
||||||
const {commitExecArgs, commitOptions, commitCommand} = buildCommitExec();
|
try {
|
||||||
const {reportExecArgs, reportOptions, reportCommand} = buildReportExec();
|
const {commitExecArgs, commitOptions, commitCommand} = await buildCommitExec();
|
||||||
const {
|
const {reportExecArgs, reportOptions, reportCommand} = await buildReportExec();
|
||||||
uploadExecArgs,
|
const {
|
||||||
uploadOptions,
|
uploadExecArgs,
|
||||||
disableSafeDirectory,
|
uploadOptions,
|
||||||
failCi,
|
disableSafeDirectory,
|
||||||
os,
|
failCi,
|
||||||
uploaderVersion,
|
os,
|
||||||
uploadCommand,
|
uploaderVersion,
|
||||||
} = buildUploadExec();
|
uploadCommand,
|
||||||
const {args, verbose} = buildGeneralExec();
|
} = await 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));
|
||||||
https.get(getBaseUrl(platform, uploaderVersion), (res) => {
|
https.get(getBaseUrl(platform, uploaderVersion), (res) => {
|
||||||
// Image will be stored at this path
|
// Image will be stored at this path
|
||||||
const filePath = fs.createWriteStream(filename);
|
const filePath = fs.createWriteStream(filename);
|
||||||
res.pipe(filePath);
|
res.pipe(filePath);
|
||||||
filePath
|
filePath
|
||||||
.on('error', (err) => {
|
.on('error', (err) => {
|
||||||
setFailure(
|
setFailure(
|
||||||
`Codecov: Failed to write uploader binary: ${err.message}`,
|
`Codecov: Failed to write uploader binary: ${err.message}`,
|
||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
}).on('finish', async () => {
|
}).on('finish', async () => {
|
||||||
filePath.close();
|
filePath.close();
|
||||||
|
|
||||||
await verify(filename, platform, uploaderVersion, verbose, failCi);
|
await verify(filename, platform, uploaderVersion, verbose, failCi);
|
||||||
await versionInfo(platform, uploaderVersion);
|
await versionInfo(platform, uploaderVersion);
|
||||||
await fs.chmodSync(filename, '777');
|
await fs.chmodSync(filename, '777');
|
||||||
if (!disableSafeDirectory) {
|
if (!disableSafeDirectory) {
|
||||||
await setSafeDirectory();
|
await setSafeDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
const unlink = () => {
|
const unlink = () => {
|
||||||
fs.unlink(filename, (err) => {
|
fs.unlink(filename, (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
setFailure(
|
|
||||||
`Codecov: Could not unlink uploader: ${err.message}`,
|
|
||||||
failCi,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const doUpload = async () => {
|
|
||||||
await exec.exec(getCommand(filename, args, uploadCommand).join(' '),
|
|
||||||
uploadExecArgs,
|
|
||||||
uploadOptions)
|
|
||||||
.catch((err) => {
|
|
||||||
setFailure(
|
setFailure(
|
||||||
`Codecov:
|
`Codecov: Could not unlink uploader: ${err.message}`,
|
||||||
Failed to properly upload report: ${err.message}`,
|
|
||||||
failCi,
|
failCi,
|
||||||
);
|
);
|
||||||
});
|
}
|
||||||
};
|
});
|
||||||
const createReport = async () => {
|
};
|
||||||
|
const doUpload = async () => {
|
||||||
|
await exec.exec(getCommand(filename, args, uploadCommand).join(' '),
|
||||||
|
uploadExecArgs,
|
||||||
|
uploadOptions)
|
||||||
|
.catch((err) => {
|
||||||
|
setFailure(
|
||||||
|
`Codecov:
|
||||||
|
Failed to properly upload report: ${err.message}`,
|
||||||
|
failCi,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const createReport = async () => {
|
||||||
|
await exec.exec(
|
||||||
|
getCommand(filename, args, reportCommand).join(' '),
|
||||||
|
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(
|
await exec.exec(
|
||||||
getCommand(filename, args, reportCommand).join(' '),
|
getCommand(
|
||||||
reportExecArgs,
|
filename,
|
||||||
reportOptions)
|
args,
|
||||||
|
commitCommand,
|
||||||
|
).join(' '),
|
||||||
|
commitExecArgs, commitOptions)
|
||||||
.then(async (exitCode) => {
|
.then(async (exitCode) => {
|
||||||
if (exitCode == 0) {
|
if (exitCode == 0) {
|
||||||
await doUpload();
|
await createReport();
|
||||||
}
|
}
|
||||||
|
unlink();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
setFailure(
|
setFailure(
|
||||||
`Codecov:
|
`Codecov: Failed to properly create commit: ${err.message}`,
|
||||||
Failed to properly create report: ${err.message}`,
|
|
||||||
failCi,
|
failCi,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
await exec.exec(
|
});
|
||||||
getCommand(
|
} catch (err) {
|
||||||
filename,
|
setFailure(`Codecov: Encountered an unexpected error ${err.message}`, failCi);
|
||||||
args,
|
}
|
||||||
commitCommand,
|
};
|
||||||
).join(' '),
|
|
||||||
commitExecArgs, commitOptions)
|
run();
|
||||||
.then(async (exitCode) => {
|
|
||||||
if (exitCode == 0) {
|
|
||||||
await createReport();
|
|
||||||
}
|
|
||||||
unlink();
|
|
||||||
}).catch((err) => {
|
|
||||||
setFailure(
|
|
||||||
`Codecov: Failed to properly create commit: ${err.message}`,
|
|
||||||
failCi,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} catch (err) {
|
|
||||||
setFailure(`Codecov: Encountered an unexpected error ${err.message}`, failCi);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user