mirror of
https://github.com/codecov/codecov-action.git
synced 2025-12-23 20:27:02 +08:00
Merge pull request #90 from codecov/directory-and-debug
Add directory and file save
This commit is contained in:
@@ -38,10 +38,12 @@ Codecov's Action currently supports five inputs from the user: `token`, `file`,
|
|||||||
| `token` | Used to authorize coverage report uploads | *Required for private repos* |
|
| `token` | Used to authorize coverage report uploads | *Required for private repos* |
|
||||||
| `file` | Path to the coverage report(s) | Optional
|
| `file` | Path to the coverage report(s) | Optional
|
||||||
| `files` | Comma-separated paths to the coverage report(s) | Optional
|
| `files` | Comma-separated paths to the coverage report(s) | Optional
|
||||||
|
| `directory` | Directory to search for coverage reports. | Optional
|
||||||
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.). Multiple flags are separated by a comma (ui,chrome) | Optional
|
| `flags` | Flag the upload to group coverage metrics (unittests, uitests, etc.). Multiple flags are separated by a comma (ui,chrome) | Optional
|
||||||
| `env_vars` | Environment variables to tag the upload with. Multiple env variables can be separated with commas (e.g. `OS,PYTHON`) | Optional
|
| `env_vars` | Environment variables to tag the upload with. Multiple env variables can be separated with commas (e.g. `OS,PYTHON`) | Optional
|
||||||
| `name` | Custom defined name for the upload | Optional
|
| `name` | Custom defined name for the upload | Optional
|
||||||
| `fail_ci_if_error` | Specify if CI pipeline should fail when Codecov runs into errors during upload. *Defaults to **false*** | Optional
|
| `fail_ci_if_error` | Specify if CI pipeline should fail when Codecov runs into errors during upload. *Defaults to **false*** | Optional
|
||||||
|
| `path_to_write_report` | Write upload file to path before uploading | Optional
|
||||||
|
|
||||||
### Example `workflow.yml` with Codecov Action
|
### Example `workflow.yml` with Codecov Action
|
||||||
|
|
||||||
@@ -74,10 +76,12 @@ jobs:
|
|||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
file: ./coverage.xml
|
file: ./coverage.xml
|
||||||
files: ./coverage1.xml,./coverage2.xml
|
files: ./coverage1.xml,./coverage2.xml
|
||||||
|
directory: ./coverage/reports/
|
||||||
flags: unittests
|
flags: unittests
|
||||||
env_vars: OS,PYTHON
|
env_vars: OS,PYTHON
|
||||||
name: codecov-umbrella
|
name: codecov-umbrella
|
||||||
fail_ci_if_error: true
|
fail_ci_if_error: true
|
||||||
|
path_to_write_report: ./coverage/codecov_report.gz
|
||||||
```
|
```
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
|
|||||||
@@ -14,9 +14,15 @@ inputs:
|
|||||||
files:
|
files:
|
||||||
description: 'Comma-separated list of files to upload'
|
description: 'Comma-separated list of files to upload'
|
||||||
required: false
|
required: false
|
||||||
|
directory:
|
||||||
|
description: 'Directory to search for coverage reports.'
|
||||||
|
required: false
|
||||||
flags:
|
flags:
|
||||||
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
|
description: 'Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)'
|
||||||
required: false
|
required: false
|
||||||
|
path_to_write_report:
|
||||||
|
description: 'Write upload file to path before uploading'
|
||||||
|
required: false
|
||||||
env_vars:
|
env_vars:
|
||||||
description: 'Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)'
|
description: 'Environment variables to tag the upload with (e.g. PYTHON | OS,PYTHON)'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
1367
dist/index.js
vendored
1367
dist/index.js
vendored
File diff suppressed because one or more lines are too long
14
index.js
14
index.js
@@ -11,6 +11,8 @@ try {
|
|||||||
const file = core.getInput("file");
|
const file = core.getInput("file");
|
||||||
const files = core.getInput("files");
|
const files = core.getInput("files");
|
||||||
const env_vars = core.getInput("env_vars");
|
const env_vars = core.getInput("env_vars");
|
||||||
|
const dir = core.getInput("directory");
|
||||||
|
const write_path = core.getInput("path_to_write_report");
|
||||||
|
|
||||||
fail_ci = core.getInput("fail_ci_if_error").toLowerCase();
|
fail_ci = core.getInput("fail_ci_if_error").toLowerCase();
|
||||||
|
|
||||||
@@ -92,6 +94,12 @@ try {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dir) {
|
||||||
|
execArgs.push(
|
||||||
|
"-s", `${dir}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
execArgs.push(
|
execArgs.push(
|
||||||
"-n", `${name}`,
|
"-n", `${name}`,
|
||||||
"-F", `${flags}`
|
"-F", `${flags}`
|
||||||
@@ -109,6 +117,12 @@ try {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (write_path) {
|
||||||
|
execArgs.push(
|
||||||
|
"-q", `${write_path}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
exec.exec("bash", execArgs, options)
|
exec.exec("bash", execArgs, options)
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (fail_ci) {
|
if (fail_ci) {
|
||||||
|
|||||||
Reference in New Issue
Block a user