fix: bump to v5 and update README (#1655)

* fix: bump to v5 and update README

* Update README.md

* Update README.md

Co-authored-by: Joe Becher <joe.becher@sentry.io>

* Update README.md

---------

Co-authored-by: Joe Becher <joe.becher@sentry.io>
This commit is contained in:
Tom Hu
2024-11-19 10:35:56 -05:00
committed by GitHub
parent 21f471b090
commit fb6775daf7

View File

@@ -43,7 +43,7 @@ You can see their usage in the `action.yml` [file](https://github.com/codecov/co
## Usage ## Usage
To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number (`@v4` is recommended) as a `step` within your `workflow.yml` file. To integrate Codecov with your Actions pipeline, specify the name of this repository with a tag number (`@v5` is recommended) as a `step` within your `workflow.yml` file.
This Action also requires you to [provide an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) from [codecov.io](https://www.codecov.io) (tip: in order to avoid exposing your token, [store it](https://docs.codecov.com/docs/adding-the-codecov-token#github-actions) as a `secret`). This Action also requires you to [provide an upload token](https://docs.codecov.io/docs/frequently-asked-questions#section-where-is-the-repository-upload-token-found-) from [codecov.io](https://www.codecov.io) (tip: in order to avoid exposing your token, [store it](https://docs.codecov.com/docs/adding-the-codecov-token#github-actions) as a `secret`).
@@ -60,13 +60,13 @@ Inside your `.github/workflows/workflow.yml` file:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@main - uses: actions/checkout@main
- uses: codecov/codecov-action@v4 - uses: codecov/codecov-action@v5
with: with:
fail_ci_if_error: true # optional (default = false) fail_ci_if_error: true # optional (default = false)
files: ./coverage1.xml,./coverage2.xml # optional files: ./coverage1.xml,./coverage2.xml # optional
flags: unittests # optional flags: unittests # optional
name: codecov-umbrella # optional name: codecov-umbrella # optional
token: ${{ secrets.CODECOV_TOKEN }} # required token: ${{ secrets.CODECOV_TOKEN }}
verbose: true # optional (default = false) verbose: true # optional (default = false)
``` ```
@@ -75,7 +75,7 @@ The Codecov token can also be passed in via environment variables:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@main - uses: actions/checkout@main
- uses: codecov/codecov-action@v4 - uses: codecov/codecov-action@v5
with: with:
fail_ci_if_error: true # optional (default = false) fail_ci_if_error: true # optional (default = false)
files: ./coverage1.xml,./coverage2.xml # optional files: ./coverage1.xml,./coverage2.xml # optional
@@ -92,7 +92,7 @@ steps:
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. 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 ```yaml
- uses: codecov/codecov-action@v4 - uses: codecov/codecov-action@v5
with: with:
use_oidc: true use_oidc: true
``` ```
@@ -105,38 +105,50 @@ Codecov's Action supports inputs from the user. These inputs, along with their d
| Input | Description | Required | | Input | Description | Required |
| :--- | :--- | :---: | | :--- | :--- | :---: |
| `token` | Repository Codecov token. Used to authorize report uploads | *Required | `binary` | The file location of a pre-downloaded version of the CLI. If specified, integrity checking will be bypassed. | Optional
| `codecov_yml_path` | Specify the path to the Codecov YML | Optional | `codecov_yml_path` | The location of the codecov.yml file. This is crrently ONLY used for automated test selection (https://docs.codecov.com/docs/getting-started-with-ats). Note that for all other cases, the Codecov yaml will need to be locate
| `commit_parent` | Override to specify the parent commit SHA | Optional d as described here: https://docs.codecov.com/docs/codecov-yaml#can-i-name-the-file-codecovyml | Optional
| `directory` | Directory to search for coverage reports. | Optional | `commit_parent` | SHA (with 40 chars) of what should be the parent of this commit. | Optional
| `disable_search` | Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option. | Optional | `directory` | Folder to search for coverage files. Default to the current working directory | 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). Read more here https://docs.codecov.com/docs/fixing-reports | Optional
| `disable_search` | Disable search for coverage files. This is helpful when specifying what files you want to upload with the files option. | Optional
| `disable_safe_directory` | Disable setting safe directory. Set to true to disable. | 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` | Comma-separated list of 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` | On error, exit with non-zero code | Optional
| `file` | Path to coverage file to upload | Optional | `files` | Comma-separated explicit list of files to upload. These will be added to the coverage files found for upload. If you wish to only upload the specified files, please consider using "disable-search" to disable uploading other files. | Optional
| `files` | Comma-separated list of files to upload | Optional tional
| `flags` | Flag upload to group coverage metrics (e.g. unittests \| integration \| ui,chrome) | Optional | `flags` | Comma-separated list of flags to upload to group coverage metrics. | Optional
| `handle_no_reports_found` | Raise no exceptions when no coverage reports found | Optional | `git_service` | Override the git_service (e.g. github_enterprise) | Optional
| `job_code` | The job code | Optional | `gcov_args` | Extra arguments to pass to gcov | Optional
| `name` | User defined upload name. Visible in Codecov UI | Optional | `gcov_executable` | gcov executable to run. Defaults to 'gcov' | Optional
| `os` | Override the assumed OS. Options are linux \| macos \| windows \| . | Optional | `gcov_ignore` | Paths to ignore during gcov gathering | Optional
| `override_branch` | Specify the branch name | Optional | `gcov_include` | Paths to include during gcov gathering | Optional
| `override_build` | Specify the build number | Optional | `handle_no_reports_found` | If no coverage reports are found, do not raise an exception. | Optional
| `job_code` | | Optional
| `name` | Custom defined name of the upload. Visible in the Codecov UI | Optional
| `network_filter` | Specify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing. | Optional
| `network_prefix` | Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing. | Optional
| `os` | Override the assumed OS. Options available at cli.codecov.io | Optional
| `override_branch` | Specify the branch to be displayed with this commit on Codecov | Optional
| `override_build` | Specify the build number manually | 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` | Commit SHA (with 40 chars) | Optional
| `override_pr` | Specify the pull request number | Optional | `override_pr` | Specify the pull request number manually. Used to override pre-existing CI environment variables. | Optional
| `plugin` | plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. | Optional | `plugins` | Comma-separated list of plugins to run. Specify `noop` to turn off all plugins | Optional
| `plugins` | Comma-separated list of plugins for use during upload. | Optional | `report_code` | The code of the report if using local upload. If unsure, leave unset. Read more here https://docs.codecov.com/docs/the-codecov-cli#how-to-use-local-upload | Optional
| `report_code` | The code of the report. If unsure, do not include | Optional | `report_type` | The type of file to upload, coverage by default. Possible values are "testing", "coverage". | Optional
| `root_dir` | Used to specify the location of your .git root to identify project root directory | Optional | `root_dir` | Root folder from which to consider paths on the network section. Defaults to current working directory. | Optional
| `slug` | Specify the slug manually (Enterprise use) | Optional | `skip_validation` | Skip integrity checking of the CLI. This is NOT recommended. | Optional
| `url` | Specify the base url to upload (Enterprise use) | Optional | `slug` | [Required when using the org token] Set to the owner/repo slug used instead of the private repo token. Only applicable to some Enterprise users. | Optional
| `use_legacy_upload_endpoint` | Use the legacy upload endpoint | Optional | `swift_project` | Specify the swift project name. Useful for optimization. | 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. | `token` | Repository Codecov token. Used to authorize report uploads | Optional
| `verbose` | Specify whether the Codecov output should be verbose | Optional | `url` | Set to the Codecov instance URl. Used by Dedicated Enterprise Cloud customers. | Optional
| `version` | Specify which version of the Codecov CLI should be used. Defaults to `latest` | Optional | `use_legacy_upload_endpoint` | Use the legacy upload endpoint. | Optional
| `use_oidc` | Use OIDC instead of token. This will ignore any token supplied | Optional
| `verbose` | Enable verbose logging | Optional
| `version` | Which version of the Codecov CLI to use (defaults to 'latest') | Optional
| `working-directory` | Directory in which to execute codecov.sh | Optional | `working-directory` | Directory in which to execute codecov.sh | Optional
### Example `workflow.yml` with Codecov Action ### Example `workflow.yml` with Codecov Action
@@ -165,7 +177,7 @@ jobs:
pip install pytest-cov pip install pytest-cov
pytest --cov=./ --cov-report=xml pytest --cov=./ --cov-report=xml
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v4 uses: codecov/codecov-action@v5
with: with:
directory: ./coverage/reports/ directory: ./coverage/reports/
env_vars: OS,PYTHON env_vars: OS,PYTHON