Linux command
codecov 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Upload coverage report with token
codecovcli upload-process -t [token]
Upload a specific coverage file
codecovcli do-upload -t [token] -f [coverage.xml]
Upload with coverage flags
codecovcli do-upload -t [token] -F [unittests]
Upload for a specific commit SHA
codecovcli do-upload -t [token] -C [commit_sha]
Upload with verbose output
codecovcli -v upload-process -t [token]
Create commit and upload in one step
codecovcli upload-process -t [token] -r [owner/repo] --git-service [github]
说明
codecovcli is the command-line interface for the Codecov code coverage service. It uploads coverage reports generated by testing frameworks and provides insights through dashboards and pull request comments. The CLI automatically detects CI environments (GitHub Actions, GitLab CI, Jenkins, etc.) and extracts commit, branch, and build information. It searches for coverage files in common formats (lcov, cobertura, jacoco, etc.) and uploads them. Key commands include upload-process (a wrapper that creates a commit, creates a report, and uploads in one step), do-upload (upload only), create-commit, create-report, and send-notifications.
参数
- -t _TOKEN_
- Repository upload token. Can also be set via CODECOV_TOKEN environment variable.
- -f, --file _FILE_
- Specific coverage report file to upload.
- -F, --flag _NAME_
- Flag to group coverage (e.g., unittests, integration). May be specified multiple times.
- -C, --sha _SHA_
- Commit SHA to associate with the upload.
- -B, --branch _NAME_
- Branch name for the upload.
- -r, --slug _OWNER/REPO_
- Repository slug (owner/repo).
- -n, --name _NAME_
- Custom upload name.
- --git-service _SERVICE_
- Git hosting service (github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server).
- -v, --verbose
- Enable verbose logging.
- -Z, --fail-on-error
- Exit with non-zero status on upload failure.
- -s, --dir _DIR_
- Search for coverage files in a specific directory.
- --enterprise-url _URL_
- Upload host for Codecov Self-Hosted instances.
- --disable-search
- Disable automatic coverage file discovery.
FAQ
What is the codecov command used for?
codecovcli is the command-line interface for the Codecov code coverage service. It uploads coverage reports generated by testing frameworks and provides insights through dashboards and pull request comments. The CLI automatically detects CI environments (GitHub Actions, GitLab CI, Jenkins, etc.) and extracts commit, branch, and build information. It searches for coverage files in common formats (lcov, cobertura, jacoco, etc.) and uploads them. Key commands include upload-process (a wrapper that creates a commit, creates a report, and uploads in one step), do-upload (upload only), create-commit, create-report, and send-notifications.
How do I run a basic codecov example?
Run `codecovcli upload-process -t [token]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -t _TOKEN_ do in codecov?
Repository upload token. Can also be set via CODECOV_TOKEN environment variable.