Skip to content

codecov/codecov-bash

master
Switch branches/tags
Code

Latest commit

* Pull in `1.0.4` into `master` (#448)

* Releasing new version of the uploader (#445)

* Fix go regex (#436)

* Send Upload Token via Header (#439)

* Send token via HTTP header vs. URL param

* Revert testing change

* Update script to use token in header

* update SHASUM

* maybe fix tests?

* Undo accidental deletion

* More test fixes

* fix build

Co-authored-by: Tom Hu <thomasrockhu@users.noreply.github.com>
Co-authored-by: Andrew Jaeger <mrjaeger00@gmail.com>

* Update to 1.0.4

Co-authored-by: Subhi Beidas <subhibeidas@gmail.com>
Co-authored-by: Andrew Jaeger <mrjaeger00@gmail.com>

* 1.0.5 - Fix token uploads for self-hosted (#454)

* fix: Prevent deploys if tag is not unique (#452)

* docs: Add deprecation warning (#451)

* fix: add query support for token (self-hosted) (#453)

* fix: add query support for token (self-hosted)

* fix: mask the token in output

Co-authored-by: Tom Hu <thomasrockhu@users.noreply.github.com>

* chore: bump version

* chore: trigger new deploy with tag 1.0.5

* fail if release fails (#447)

* fix: Do not set PR on closed GitHub PRs (#456)

* fix: Update GitHub Actions server URL (#457)

* fix: Update GitHub Actions server URL

* fix: Update tests

* patch: bump to 1.0.6 (#458)

Co-authored-by: Subhi Beidas <subhibeidas@gmail.com>
Co-authored-by: Andrew Jaeger <mrjaeger00@gmail.com>
Co-authored-by: Joe Becher <71270647+drazisil-codecov@users.noreply.github.com>
Co-authored-by: Joe Becher <joe@codecov.io>
Co-authored-by: Matthew Berryman <matthew@acrossthecloud.net>
1817ab2

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
env
 
 
 
 
 
 

⚠️ Deprecation Warning ⚠️

On February 1, 2022, this uploader will be fully sunset and no longer function

We recommend all users migrate to the uploader to prevent any breakages in usage. You can learn more about our deprecation plan and the new uploader on our blog.


Codecov Bash Uploader

Upload reports to Codecov for almost every supported language.

codecov

Deployed Version

Running the bash uploader


# All CI
bash <(curl -s https://codecov.io/bash)
 
# Pipe to bash (Jenkins)
curl -s https://codecov.io/bash | bash -s - -t token
#                                           ^ add your extra config here

# No bash method
curl -s https://codecov.io/bash > .codecov
chmod +x .codecov
./.codecov

⚠️ Verifying the bash uploader

As an additional layer of security, users may wish to check the script against the provided SHASUMs.

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")
done
./codecov

or for older versions of shasum

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")
done
./codecov

Languages

Codecov supports many languages, you can find a full list here: https://docs.codecov.io/docs/supported-languages

Other Usage

Below are most commonly used settings. View full list of commands to see the full list of commands.

# public repo on Travis CI
after_success:
  - bash <(curl -s https://codecov.io/bash)
# private repo
after_success:
  - bash <(curl -s https://codecov.io/bash) -t your-repository-upload-token
# Flag build types
after_success:
  - bash <(curl -s https://codecov.io/bash) -F unittests
# Include environment variables to store per build
after_success:
  - bash <(curl -s https://codecov.io/bash) -e TOX_ENV,CUSTOM_VAR

When running the codecov-bash uploader on Alpine Linux, you are likely to run into a parsing issue because of the default shell. To be able to upload reports, you need to issue the following commands.

after_success:
  - apk -U add git curl bash findutils
  - bash -c '/bin/bash <(curl -s https://codecov.io/bash)'

Prevent build failures

If Codecov fails to upload reports, you can ensure the CI build does not fail by adding a catch-all:

bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"

CI Providers

Company Supported Token Required
Travis CI Yes Build Status FOSSA Status Private only
Azure Pipelines Yes Private only
CircleCI Yes Private only
Codeship Yes Public & Private
Jenkins Yes Public & Private
Semaphore Yes Public & Private
TeamCity. Yes Public & Private
drone.io Yes Public & Private
AppVeyor Yes Private only
Bamboo Yes Public & Private
Bitbucket Yes Public & Private
Bitrise Yes Public & Private
buddybuild Yes Public & Private
Buildkite Yes Public & Private
Heroku Yes Public & Private
Wercker Yes Public & Private
Shippable Yes Public & Private
Gitlab CI Yes Public & Private
Buildkite Yes Public & Private
GitHub Actions Yes Private only
Cirrus CI Yes Public & Private
AWS CodeBuild Yes Public & Private
git Yes (as a fallback) Public & Private

Caveats

  1. Jenkins: Unable to find reports? Try PWD=WORKSPACE bash <(curl -s https://codecov.io/bash)

Development

To automatically update the hash files after a change to the Codecov uploader script, run

./install.sh

which will add the pre-commit hooks. You can also update the hash files manually via:

for i in 1 256 512; do shasum -a "${i}" codecov > "SHA${i}SUM"; done

and add the change to your pull request.

License

FOSSA Status