The Codecov Bash Uploader is a very unique and original style to uploading reports. It has been a tradition for other products that integrate with different languages to create a specific plugin for each language. We believe this is a bad practice that quickly leads to out-of-date and poorly maintained packages.
One uploader to rule them all.
bash <(curl -s https://codecov.io/bash)
The source code is entirely open source, and we invite anyone to contribute to make the uploader more powerful.
The main objective to uploader is to detect the environment, gather reports and upload them to Codecov. First, you query Codecov for the latest file version, and then you allow bash to execute the uploader. At this time, the uploader runs its code and outputs its progress to stdout
.
Not required for *public* projects tested on TravisCI, CircleCI or AppVeyor
We require you to provide your unique upload token to identify your projects uploads. You can find this token in your repository settings (/gh/:owner/:repo/settings
).
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.
- Using Docker? Please review Testing with Docker.
- Using Python Tox? Please review Testing with Tox.
Codecov can automatically detect coverage files in your project. We have an aggressive file name search that 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 logic of what happens is as follows:
- The CI is discovered through environment variables.
- Language specific process (e.g. xcode, python).
- Reports are discovered.
- Reports are uploaded to Amazon S3 for archiving (secret location).
- Codecov is informed of the upload, and will queue the report processing server side.
- Fin.
exit 0
.
Exit 0
Codecov will exit 0
to prevent failing the build, if there are issues. If you would like Codecov to exit with 1
, use bash <(curl -s https://codecov.io/bash) -Z
.
exit 0
is not full proof. Please use this command to always exit with 0
: bash <(curl -s https://codecov.io/bash) || echo 'Codecov failed to upload'
.