Skip to content

Commit

Permalink
Add all args (#1245)
Browse files Browse the repository at this point in the history
* fix: add all args from cli

* chore(release): bump to 4.0.1
  • Loading branch information
thomasrockhu-codecov committed Feb 1, 2024
1 parent 09686fc commit 1f9f557
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 104 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,6 @@
name: Workflow for Codecov Action
on: [push, pull_request]
jobs:
no-deps:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Upload coverage to Codecov (script)
uses: ./
with:
files: ./coverage/script/coverage-final.json
flags: script,${{ matrix.os }}
name: codecov-script
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codecov (demo)
uses: ./
with:
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
file: ./coverage/coverage-final.json
flags: demo,${{ matrix.os }}
name: codecov-demo
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage to Codecov (version)
uses: ./
with:
files: ./coverage/calculator/coverage-final.json,./coverage/coverage-test/coverage-final.json
file: ./coverage/coverage-final.json
flags: version,${{ matrix.os }}
name: codecov-version
version: v0.2.0
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
run:
runs-on: ${{ matrix.os }}
strategy:
Expand Down
34 changes: 29 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ inputs:
token:
description: 'Repository upload token - get it from codecov.io. Required only for private repositories'
required: false
file:
description: 'Path to coverage file to upload'
required: false
files:
description: 'Comma-separated list of files to upload'
codecov_yml_path:
description: 'Specify the path to the Codecov YML'
required: false
commit_parent:
description: 'Override to specify the parent commit SHA'
required: false
directory:
description: 'Directory to search for coverage reports.'
required: false
disable_search:
description: 'Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option.'
required: false
disable_file_fixes:
description: 'Disable file fixes to ignore common lines from coverage (e.g. blank lines or empty brackets)'
required: false
dry_run:
description: "Don't upload files to Codecov"
required: false
Expand All @@ -29,9 +32,21 @@ inputs:
fail_ci_if_error:
description: 'Specify whether or not CI build should fail if Codecov runs into an error during upload'
required: false
file:
description: 'Path to coverage file to upload'
required: false
files:
description: 'Comma-separated list of files to upload'
required: false
flags:
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
required: false
handle_no_reports_found:
description: 'Raise no exceptions when no coverage reports found'
required: false
job_code:
description: 'The job code'
required: false
name:
description: 'User defined upload name. Visible in Codecov UI'
required: false
Expand All @@ -44,6 +59,9 @@ inputs:
override_build:
description: 'Specify the build number'
required: false
override_build_url:
description: 'The URL of the build where this is running'
required: false
override_commit:
description: 'Specify the commit SHA'
required: false
Expand All @@ -56,6 +74,9 @@ inputs:
plugins:
description: 'Comma-separated list of plugins for use during upload.'
required: false
report_code:
description: 'The code of the report. If unsure, do not include'
required: false
root_dir:
description: 'Used when not in git/hg project to identify project root directory'
required: false
Expand All @@ -65,6 +86,9 @@ inputs:
url:
description: 'Specify the base url to upload (Enterprise use)'
required: false
use_legacy_upload_endpoint:
description: 'Use the legacy upload endpoint'
required: false
verbose:
description: 'Specify whether the Codecov output should be verbose'
required: false
Expand Down
71 changes: 59 additions & 12 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32266,6 +32266,7 @@ const buildCommitExec = () => {
const overridePr = core.getInput('override_pr');
const slug = core.getInput('slug');
const token = core.getInput('token');
const failCi = isTrue(core.getInput('fail_ci_if_error'));
const commitCommand = 'create-commit';
const commitExecArgs = [];
const commitOptions = {};
Expand Down Expand Up @@ -32302,12 +32303,19 @@ const buildCommitExec = () => {
if (slug) {
commitExecArgs.push('--slug', `${slug}`);
}
if (failCi) {
commitExecArgs.push('-Z');
}
return { commitExecArgs, commitOptions, commitCommand };
};
const buildGeneralExec = () => {
const codecovYmlPath = core.getInput('codecov_yml_path');
const url = core.getInput('url');
const verbose = isTrue(core.getInput('verbose'));
const args = [];
if (codecovYmlPath) {
args.push('--codecov-yml-path', `${codecovYmlPath}`);
}
if (url) {
args.push('--enterprise-url', `${url}`);
}
Expand All @@ -32318,8 +32326,10 @@ const buildGeneralExec = () => {
};
const buildReportExec = () => {
const overrideCommit = core.getInput('override_commit');
const overridePr = core.getInput('override_pr');
const slug = core.getInput('slug');
const token = core.getInput('token');
const failCi = isTrue(core.getInput('fail_ci_if_error'));
const reportCommand = 'create-report';
const reportExecArgs = [];
const reportOptions = {};
Expand All @@ -32341,33 +32351,49 @@ const buildReportExec = () => {
`${context.eventName}` == 'pull_request_target') {
reportExecArgs.push('-C', `${context.payload.pull_request.head.sha}`);
}
if (overridePr) {
reportExecArgs.push('-P', `${overridePr}`);
}
else if (`${context.eventName}` == 'pull_request_target') {
reportExecArgs.push('-P', `${context.payload.number}`);
}
if (slug) {
reportExecArgs.push('--slug', `${slug}`);
}
if (failCi) {
reportExecArgs.push('-Z');
}
return { reportExecArgs, reportOptions, reportCommand };
};
const buildUploadExec = () => {
const envVars = core.getInput('env_vars');
const disableFileFixes = isTrue(core.getInput('disable_file_fixes'));
const disableSearch = isTrue(core.getInput('disable_search'));
const dryRun = isTrue(core.getInput('dry_run'));
const envVars = core.getInput('env_vars');
const exclude = core.getInput('exclude');
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 handleNoReportsFound = isTrue(core.getInput('handle_no_reports_found'));
const jobCode = core.getInput('job_code');
const name = core.getInput('name');
const os = core.getInput('os');
const overrideBranch = core.getInput('override_branch');
const overrideBuild = core.getInput('override_build');
const overrideBuildUrl = core.getInput('override_build_url');
const overrideCommit = core.getInput('override_commit');
const overridePr = core.getInput('override_pr');
const plugin = core.getInput('plugin');
const plugins = core.getInput('plugins');
const reportCode = core.getInput('report_code');
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 useLegacyUploadEndpoint = isTrue(core.getInput('use_legacy_upload_endpoint'));
const workingDir = core.getInput('working-directory');
const plugin = core.getInput('plugin');
const exclude = core.getInput('exclude');
const uploadExecArgs = [];
const uploadCommand = 'do-upload';
const uploadOptions = {};
Expand All @@ -32387,18 +32413,24 @@ const buildUploadExec = () => {
envVarsArg.push(envVarClean);
}
}
if (name) {
uploadExecArgs.push('-n', `${name}`);
}
if (token) {
uploadOptions.env.CODECOV_TOKEN = token;
}
if (disableFileFixes) {
uploadExecArgs.push('--disable-file-fixes');
}
if (disableSearch) {
uploadExecArgs.push('--disable-search');
}
if (dryRun) {
uploadExecArgs.push('-d');
}
if (envVarsArg.length) {
uploadExecArgs.push('-e', envVarsArg.join(','));
}
if (exclude) {
uploadExecArgs.push('--exclude', `${exclude}`);
}
if (failCi) {
uploadExecArgs.push('-Z');
}
Expand All @@ -32415,12 +32447,24 @@ const buildUploadExec = () => {
uploadExecArgs.push('-F', `${f}`);
});
}
if (handleNoReportsFound) {
uploadExecArgs.push('--handle-no-reports-found');
}
if (jobCode) {
uploadExecArgs.push('--job-code', `${jobCode}`);
}
if (name) {
uploadExecArgs.push('-n', `${name}`);
}
if (overrideBranch) {
uploadExecArgs.push('-B', `${overrideBranch}`);
}
if (overrideBuild) {
uploadExecArgs.push('-b', `${overrideBuild}`);
}
if (overrideBuildUrl) {
uploadExecArgs.push('--build-url', `${overrideBuildUrl}`);
}
if (overrideCommit) {
uploadExecArgs.push('-C', `${overrideCommit}`);
}
Expand All @@ -32434,11 +32478,17 @@ const buildUploadExec = () => {
else if (`${context.eventName}` == 'pull_request_target') {
uploadExecArgs.push('-P', `${context.payload.number}`);
}
if (plugin) {
uploadExecArgs.push('--plugin', `${plugin}`);
}
if (plugins) {
plugins.split(',').map((p) => p.trim()).forEach((p) => {
uploadExecArgs.push('--plugin', `${p}`);
});
}
if (reportCode) {
uploadExecArgs.push('--report-code', `${reportCode}`);
}
if (rootDir) {
uploadExecArgs.push('--network-root-folder', `${rootDir}`);
}
Expand All @@ -32451,15 +32501,12 @@ const buildUploadExec = () => {
if (workingDir) {
uploadOptions.cwd = workingDir;
}
if (plugin) {
uploadExecArgs.push('--plugin', `${plugin}`);
}
if (exclude) {
uploadExecArgs.push('--exclude', `${exclude}`);
}
if (uploaderVersion == '') {
uploaderVersion = 'latest';
}
if (useLegacyUploadEndpoint) {
uploadExecArgs.push('--legacy');
}
return {
uploadExecArgs,
uploadOptions,
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codecov-action",
"version": "4.0.0",
"version": "4.0.1",
"description": "Upload coverage reports to Codecov from GitHub Actions",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 1f9f557

Please sign in to comment.