[Deprecating] Bash Uploader
Deprecation Notice and Schedule
Deprecation NoticeSupport for the Bash Uploader will be deprecated in the future.
Please refer to the this page and the main Codecov Uploader page for implementation and upgrades.
With the Codecov Uploader released, the Bash Uploader is subject to deprecation in the future.
You can refer back to this page to plans around deprecation of the Bash Uploader and/or see additional context around this release and change can be found on our blog.
Introduction
The Codecov Bash uploader provides a language-agnostic alternative for sending your coverage reports to Codecov. Its usage is both simple and convenient:
bash <(curl -s https://codecov.io/bash)The main objectives of the uploader are to:
- detect the environment
- gather reports
- upload them to Codecov
The above command silently requests the latest version of the uploader from Codecov and executes via Bash; all output is directed to stdout.
Upload token
Not Required for some CI ProvidersIf you have a public project on TravisCI, CircleCI, AppVeyor, Azure Pipelines, or GitHub Actions an upload token is not required.
A unique upload token is required to identify which project the coverage belongs to. This token is located in the repository settings (/<github>/<owner>/<repo>/settings).

A repository on codecov with no uploaded coverage reports. Note the upload token.
There are three ways to provide the upload token to the Bash uploader:
Flag
bash <(curl -s https://codecov.io/bash) -t tokenEnvironment variable
export CODECOV_TOKEN="token"
bash <(curl -s https://codecov.io/bash)Loading token from a file
echo "token" > .cc_token
bash <(curl -s https://codecov.io/bash) -t @.cc_tokenCI detection
The bash uploader detects all CI providers through environment variables. This process helps to identify the source of the build and maintain a relationship back to the source of the coverage collection.
- Using Docker? Please review Testing with Docker.
- Using Python Tox? Please review Testing with Tox.
Finding reports and specifying file names
Codecov can automatically detect coverage files in your project. A thorough filename search will grab everything that is known to be a coverage report. You can also specify exactly which file(s) should be uploaded.
Here are some options for discovering report files:
# only upload this file
-f path/to/foo.bar
# also search this folder that is outside the project directory
-s /home/user/reports/foo/bar
# ignore all files at pattern *.bar
-f "!*.bar"
# include all files at pattern *.foo
-f "*.foo"Validating the bash script
The Codecov bash uploader is open source, and it can be validated for correctness by calculating the
SHASUM on download and comparing to the result we store in the GitHub repository.
You can calculate the checksum on download by running
curl https://codecov.io/bash | shasum -a 512
# Codecov provides SHA1, SHA256, and SHA512 hashesThis will not check against the provided checksums provided by Codecov that are located in GitHub.
You can compare the result to the publicly posted values at https://github.com/codecov/codecov-bash/blob/{{ VERSION }}/SHA512SUM. We calculate and publish the SHA1, SHA256, and SHA512 checksums.
For builds with the versions of shasum that support the --ignore-missing flag, you can also verify the checksums by running
curl -fLso codecov https://codecov.io/bash;
VERSION=$(grep -o 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2);
for i in 1 256 512
do
shasum -a $i -c --ignore-missing <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM")
doneFor older shasum versions, you can run
curl -fLso codecov https://codecov.io/bash;
VERSION=$(grep -o 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2);
for i in 1 256 512
do
shasum -a $i -c <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM" | grep -w "codecov")
doneUploading process
When the upload script is called, the general flow is as follows:
- The CI is discovered through environment variables.
- Language specific processing and formatting (e.g. xcode, python).
- Reports are found in the filesystem.
- Reports are prepended with file paths and appended with file adjustments.
- Reports are uploaded to cloud storage for archiving (secret location).
- Codecov is informed of the upload, and will queue the report processing server side.
- Done (
exit 0).
Exit 0Codecov will
exit 0to prevent failing the build, if there are issues. If you would like Codecov to exit with1, usebash <(curl -s https://codecov.io/bash) -Z.
exit 0is not foolproof. Please use this command to always exit with0:bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'.
Verbose modeIf there is an issue with the upload process, it helps to run in verbose mode. Supply the
-vflag for better debugging output:
bash <(curl -s https://codecov.io/bash) -v
Arguments
The bash uploader provides various arguments to work with many complex environments. Listed below are the full list of possible arguments and their usage.
Argument | Usage |
|---|---|
| Extra curl arguments to communicate with AWS. |
| Move discovered coverage reports to the trash |
| Don't upload, but dump upload file to stdout |
| Specify environment variables to be included with this build
|
| Flag the upload to group coverage metrics |
| Target file(s) to upload Must use single quotes. |
| Display this help and exit |
| Remove color from the output |
| The commit SHA of the parent for which you are uploading coverage. If not present, the parent will be determined using the API of your repository provider. When using the repository provider's API, the parent is determined via finding the closest ancestor to the commit. |
| Custom defined name of the upload. Visible in Codecov UI |
| Write upload file to path |
| Used when not in git/hg project to identify project root directory |
| Directory to search for coverage reports. |
| Set the private repository token
|
| Extra curl arguments to communicate with Codecov. e.g., |
| Verbose mode |
| Toggle functionalities
|
| Exit with 1 if not successful. Default will Exit with 0 |
enterprise | |
| owner/repo slug used instead of the private repo token in Enterprise |
| File path to your cacert.pem file used to verify ssl with Codecov Enterprise (optional) |
| Set the target url for Enterprise customers |
env vars | Used to override pre-existing CI environment variables |
| Specify the branch name |
| Specify the build number |
| Specify the commit SHA. Please use the long version to ensure a match between the submitted SHA and the git provider's API response. |
| Specify the pull request number |
| Specify the git tag |
gcov | |
| Extra arguments to pass to gcov |
| Paths to include during gcov gathering |
| Paths to ignore during gcov gathering |
| Prefix filepaths to help resolve path fixing |
| Project root directory |
| gcov executable to run. Defaults to |
xcode | |
| Custom Derived Data Path for Coverage.profdata and gcov processing |
| Specify packages to build coverage. Uploader will only build these packages. |
Updated 4 days ago