The Codecov Bash uploader provides a language-agnostic alternative for uploading reports. 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
Not Required for some CI Providers
If you have a public project on TravisCI, CircleCI, AppVeyor, or Azure Pipelines 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 (
A repository on codecov with no uploaded coverage reports. Note the upload token.
bash <(curl -s https://codecov.io/bash) -t token
export CODECOV_TOKEN="token" bash <(curl -s https://codecov.io/bash)
echo "token" > .cc_token bash <(curl -s https://codecov.io/bash) -t @.cc_token
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.
Codecov can automatically detect coverage files in your project. A thorough filename search will grab everything that is known to be a coverage report.
Here are some options for discovering reports:
# 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"
When the upload script is called, the general flow is as follows:
- The CI is discovered through environment variables.
- Language specific process (e.g. xcode, python).
- Reports are discovered.
- 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 to prevent failing the build, if there are issues. If you would like Codecov to exit with
bash <(curl -s https://codecov.io/bash) -Z.
exit 0 is not foolproof. Please use this command to always exit with
bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'.
If there is an issue with the upload process, it helps to run in verbose mode. Supply the
-v flag for better debugging output:
bash <(curl -s https://codecov.io/bash) -v