Giter Site home page Giter Site logo

codecov / codecov-bash Goto Github PK

View Code? Open in Web Editor NEW
233.0 233.0 187.0 1.16 MB

Global coverage report uploader for Codecov

Home Page: https://codecov.io

License: Apache License 2.0

Shell 99.63% C++ 0.09% Go 0.04% JavaScript 0.03% Kotlin 0.05% PHP 0.06% Ruby 0.10%
codecov coverage shell

codecov-bash's People

Contributors

0xced avatar birmacher avatar blueyed avatar chfast avatar drazisil avatar drazisil-codecov avatar eliatcodecov avatar febg avatar febg-codecov avatar fkorotkov avatar fsouza avatar gsauthof avatar ibrahim0814 avatar joscha avatar jsiirola avatar jwillemsen avatar larsgrefer avatar nijel avatar pablofullana avatar paulofaria avatar phani-srikar avatar rasarora avatar reaperhulk avatar rickpasetto avatar ryancopley avatar sfgeorge avatar stevepeak avatar szepeviktor avatar thiagocodecov avatar thomasrockhu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

codecov-bash's Issues

"raw" upload command?

Would the "raw" upload command be available (in particular for a Go project with a coverage.txt file)? Instead of running a shell download from the internet, some project might choose to use that instead. Thanks

Do not search project root

I think there is no option to disable searching gcov files in project root. The project root contains multiple build dirs and I don't want to upload all of these.

How to configure codecov to stop failing PRs when coverage is decreased by the small value?

Hi,

I'm using codecov in Android library written in Java and I have the following question:
How to configure codecov to stop failing PRs when coverage is decreased by the small value?

Here I have an exemplary pull request: pwittchen/ReactiveNetwork#153.
Here's is my codecov.yml file: https://github.com/pwittchen/ReactiveNetwork/blob/master/codecov.yml

As you can see, code coverage was decreased by 1.8% and I set the threshold to 20%, so I expected my PR to fail when code coverage will by decreased by 20% or more, but the PR failed anyway. My configuration does not work as I expect.

Can you show me, how can I configure codecov in my project, so it won't fail my PR every time when code coverage is decreased by the value lower than 20%?

I'm looking forward to your reply.

PS. I don't know if this project is the correct place for this issue. If not, please show me the place where I can report my issue.

Kind Regards,
Piotr

Following "Codecov outside docker" documentation results in 400 response

While following the documentation for Testing with docker(Codecov outside docker) I retrieve 400 response(s) when uploading report.

It could be interesting to know that I'm trying this in Docker cloud(autotesting)

(Note that I've replaced some uninteresting config specific values with <SOMETHING>)

As stated in the documentation(linked above) I run bash <(curl -s https://codecov.io/bash) as a final step.

Running with the yaml config file:

.codecov.yml

codecov:
  branch: develop

comment:
  layout: "reach, diff, flags, files"
  behavior: default
  require_changes: false
  require_base: no        
  require_head: yes      
  branches: null

I get this result:

_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
Bash-e3f8e98
==> Docker detected.
project root: .
--> token set from env
Yaml found at: .codecov.yml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
+ .
-> Found 1 reports
==> Detecting git/mercurial file structure
==> Appending build variables
+ IMAGE_NAME
==> Reading reports
+ ./coverage-vol/coverage.xml bytes=41817
==> Appending adjustments
http://docs.codecov.io/docs/fixing-reports
-> No adjustments found
==> Gzipping contents
==> Uploading reports
url: https://codecov.io
query: branch=develop&commit=<HASH>&build=&build_url=&name=&tag=latest&slug=index.docker.io%2F<ORG NAME>%2F<REPO NAME>&service=docker&flags=&pr=&job=
-> Pinging Codecov
-> Uploading
X> Failed to upload
-> Sleeping for 30s and trying again...
-> Pinging Codecov
-> Uploading
X> Failed to upload
-> Sleeping for 30s and trying again...
-> Pinging Codecov
/dev/fd/63: line 1441: echo: write error: Broken pipe
-> Uploading
X> Failed to upload
-> Sleeping for 30s and trying again...
-> Pinging Codecov
-> Uploading
X> Failed to upload
-> Sleeping for 30s and trying again...
-> Uploading to Codecov
HTTP 400
slug must match pattern ^[\w\-\.]{1,255}\/[\w\-\.]{1,255}$

I've tried another run by changing the slug value by setting it through the .codecov.yml file. This run results in the following:

.codecov.yml

codecov:
  slug: <ORG NAME>/<REPO NAME>
  branch: develop

comment:
  layout: "reach, diff, flags, files"
  behavior: default
  require_changes: false
  require_base: no        
  require_head: yes      
  branches: null

I get this result:

_____ _
/ ____| | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| | __/ (_| (_) \ V /
\_____\___/ \__,_|\___|\___\___/ \_/
Bash-e3f8e98
==> Docker detected.
project root: .
--> token set from env
Yaml found at: .codecov.yml
--> slug set from yaml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
+ .
-> Found 1 reports
==> Detecting git/mercurial file structure
==> Appending build variables
+ IMAGE_NAME
==> Reading reports
+ ./coverage-vol/coverage.xml bytes=41817
==> Appending adjustments
http://docs.codecov.io/docs/fixing-reports
-> No adjustments found
==> Gzipping contents
==> Uploading reports
url: https://codecov.io
query: branch=develop&commit=<HASH>&build=&build_url=&name=&tag=latest&slug=<ORG NAME>%2F<REPO NAME>&service=docker&flags=&pr=&job=
-> Pinging Codecov
/dev/fd/63: line 1441: echo: write error: Broken pipe
-> Uploading
X> Failed to upload
-> Sleeping for 30s and trying again...
-> Pinging Codecov
-> Uploading
X> Failed to upload
-> Sleeping for 30s and trying again...
-> Pinging Codecov
-> Uploading
X> Failed to upload
-> Sleeping for 30s and trying again...
-> Pinging Codecov
/dev/fd/63: line 1441: echo: write error: Broken pipe
-> Uploading
X> Failed to upload
-> Sleeping for 30s and trying again...
-> Uploading to Codecov
HTTP 400
service must be ci-provider

Error when running codecov -f $resolvedResultFile -X gcov

We have started seeing an error a couple of weeks back when running the following (in AppVeyor using PowerShell script). It seems this is an error that get reported in the Python code for codecov.
Was hoping for some insight what could be going on.

I more detailed write up can be seen in the issue PowerShell/DscResource.Tests#203.

$null = pip install git+git://github.com/codecov/codecov-python.git
uploadResults = codecov -f $resolvedResultFile -X gcov
codecov : The filename, directory name, or volume label syntax is incorrect.
At C:\projects\xnetworking\DscResource.Tests\DscResource.CodeCoverage\CodeCovIo.psm1:336 char:22
+     $uploadResults = codecov -f $resolvedResultFile -X gcov
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (The filename, d...x is incorrect.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

See test run here: https://ci.appveyor.com/project/PowerShell/xnetworking/build/3.1.786.0#L4671

can't detect Wercker.

Codecov
(version) cd5c049
(url) https://codecov.io
==> No CI detected, using git for branch and commit sha.

Wercker Steps - setup enviroment
http://devcenter.wercker.com/docs/environment-variables/available-env-vars.html

 export CI="true" // not True

codecov-bash

elif [ "$CI" = "True" ] && [ "$WERCKER_GIT_BRANCH" != "" ];
then
  say "==> Wercker CI detected."
  # http://devcenter.wercker.com/articles/steps/variables.html
  query="service=wercker\
         &branch=$WERCKER_GIT_BRANCH\
         &build=$WERCKER_MAIN_PIPELINE_STARTED\
         &slug=$WERCKER_GIT_OWNER/$WERCKER_GIT_REPOSITORY\
         &commit=$WERCKER_GIT_COMMIT"

wercker.yml

 export CI="True" // add this line; working properly
 bash <(curl -s https://codecov.io/bash)

Upload code coverage data from unit tests classes

I have a Swift project and its code coverage isn't right. I realised that codecov-bash is taking code coverage data from project's class and its unit tests. I thought it would only get class's code coverage.

screen shot 2016-06-25 at 21 35 48

Upload fail when commit messages contain `merge ... into`

I am using bash script to upload coverage report with command bash <(curl -s https://codecov.io/bash) from CircleCI.

It seems uploading tasks are always fail when commit comment is like Merge branch 'feature' of github.com:suguru/repository into master.

Our logs show that something happened in commit parameter.

(query) branch=debug-test&commit=branch&build=1871.0&build_url=&tag=&slug=suguru/repository&yaml=&service=circleci&flags=&pr=&job=
==> Uploading reports
    Pinging Codecov
    Uploading to S3

bash <(curl -s https://codecov.io/bash) returned exit code 6

Script stopped working on Circle CI

It looks like this commis broke the script. Now if fails on Circle CI. Here is a CI log:

#!/bin/bash -eo pipefail
bash <(curl -s https://codecov.io/bash) -cF jasmine1

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-8ba5469


==> Circle CI detected.
    project root: .
--> token set from env
    Yaml found at: codecov.yml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./coverage/karma/HeadlessChrome 0.0.0 (Linux 0.0.0)/lcov.info bytes=223972
basename: extra operand '(Linux'
Try 'basename --help' for more information.
Exited with code 1

Support AppVeyor

Appveyor has bash installed and in the path, and it should work.

As a short term measure, it should raise an error immediately on Appveyor, informing the user that it does not work on Appveyor.

fails with permission denied in subdirectory

In one of our Java apps, we have integration tests for permissions. Long story short, directories get created that are unreadable.

When codecov-bash recursively looks for coverage files, it bombs on these directories. I would expect the script to continue recursing through other directories rather than aborting the entire search.

(url) https://codecov.io
(root) .
==> Jenkins CI detected.
==> Running gcov (disable via -X gcov)
  -> gcov in .
find: `./reach-engine-core/target/test/reachengine/scratch/bd9d1975-3c89-4b4a-b87a-3d51dcb79ece': Permission denied
find: `./reach-engine-core/target/test/reachengine/scratch/7f239d14-c036-43b5-8693-221940985df0': Permission denied
==> Searching for coverage reports
find: `./reach-engine-core/target/test/reachengine/scratch/bd9d1975-3c89-4b4a-b87a-3d51dcb79ece': Permission denied
find: `./reach-engine-core/target/test/reachengine/scratch/7f239d14-c036-43b5-8693-221940985df0': Permission denied
Something went wrong with Codecov.io coverage upload.

FWIW, I do know about -s DIR. I'm going to add this to my CI as a patch, but it interferes with the ease-of-use that I so much like about codecov-bash.

Get the data from `git`

slug=$(git config --get remote.origin.url)
commit=$(git rev-parse HEAD)

To setup default data during uploading

Last version breaks Jenkins pipeline (not multibranch)

[mixer] Running shell script

/ | | |
| | ___ __| | ___ ___ _____ __
| | / _ \ / ` |/ _ / / _ \ \ / /
| |
| (
) | (
| | __/ (
| (
) \ V /
______/ _,|_|____/ _/
Bash-e4a745b

==> Jenkins CI detected.

And then nothing else. After some investigation I think the issue is in here
https://github.com/codecov/codecov-bash/blob/e4a745b/codecov#L416

I also find it really weird that the script still checks for CI even though I am passing in the arguments.

The last working version for us is:
https://github.com/codecov/codecov-bash/blob/d642346/codecov#L406

Make script installable

Because of security concerns I'd like to install this bash uploader instead of piping the output of a network call through bash. This leaves a couple of options with the current setup.

  1. I can just download the script and include it in my project.
    The downside on this is I love versioning, if there are updates to the script I have to include them into my project manually.
  2. Include this repo as a git submodule in my project. This is a decent solution but does add some complexity to my project as well as some bloat. Its probably what I'll do until there is a better solution.

Are there any plans to add this to homebrew, apt, or other dependency managers?

.coverage is there but not submitted: "No coverage report found"

There's an error in the current https://codecov.io/bash script, reports aren't found - at least verified on Travis.

Debugging, I find that there is a .coverage file:

From https://travis-ci.org/django-wiki/django-wiki/jobs/284586222 :

[snip]


The command "tox" exited with 0.
after_success.1
0.01s$ ls -la
total 176
drwxrwxr-x 9 travis travis  4096 Oct  7 08:56 .
drwxrwxr-x 3 travis travis  4096 Oct  7 08:55 ..
-rw-rw-r-- 1 travis travis  3217 Oct  7 08:55 CODE_OF_CONDUCT.md
-rw-rw-r-- 1 travis travis  2586 Oct  7 08:55 CONTRIBUTING.md
-rw-rw-r-- 1 travis travis 35143 Oct  7 08:55 COPYING
-rw-rw-r-- 1 travis travis 24109 Oct  7 08:56 .coverage
-rw-rw-r-- 1 travis travis    23 Oct  7 08:55 .coveragerc
drwxrwxr-x 4 travis travis  4096 Oct  7 08:55 docs
drwxrwxr-x 8 travis travis  4096 Oct  7 08:55 .git
-rw-rw-r-- 1 travis travis   805 Oct  7 08:55 .gitignore
-rw-rw-r-- 1 travis travis    29 Oct  7 08:55 .isort.cfg
-rw-rw-r-- 1 travis travis  2706 Oct  7 08:55 Makefile
-rw-rw-r-- 1 travis travis   346 Oct  7 08:55 MANIFEST.in
-rw-rw-r-- 1 travis travis   550 Oct  7 08:55 .pre-commit-config.yaml
-rw-rw-r-- 1 travis travis   150 Oct  7 08:55 pytest.ini
-rw-rw-r-- 1 travis travis  8530 Oct  7 08:55 README.rst
-rw-rw-r-- 1 travis travis   315 Oct  7 08:55 requirements_readthedocs.txt
-rwxrwxr-x 1 travis travis  1958 Oct  7 08:55 runtests.py
-rw-rw-r-- 1 travis travis   179 Oct  7 08:55 setup.cfg
-rwxrwxr-x 1 travis travis  2623 Oct  7 08:55 setup.py
drwxrwxr-x 4 travis travis  4096 Oct  7 08:56 src
-rw-rw-r-- 1 travis travis   656 Oct  7 08:55 SUPPORT.rst
drwxrwxr-x 3 travis travis  4096 Oct  7 08:55 testproject
drwxrwxr-x 7 travis travis  4096 Oct  7 08:56 tests
drwxrwxr-x 4 travis travis  4096 Oct  7 08:55 .tox
-rw-rw-r-- 1 travis travis  1263 Oct  7 08:55 tox.ini
-rw-rw-r-- 1 travis travis   766 Oct  7 08:55 .travis.yml
drwxrwxr-x 2 travis travis  4096 Oct  7 08:55 .tx
after_success.2
0.40s$ bash <(curl -s https://codecov.io/bash)
  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-d109cc7
==> Travis CI detected.
    project root: .
    Yaml not found, that's ok! Learn more at http://docs.codecov.io/docs/codecov-yaml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
--> No coverage report found.
    Please visit http://docs.codecov.io/docs/supported-languages
Done. Your build exited with 0.

Workaround

Following this, I stopped using the source from https://codecov.io/bash and switched to a Travis config with install: pip install codecov + after_success: codecov.

That works.

Add invert match for gcov ignore switch.

I'm working with a frontend to a much, much larger project. However both must be built together.

After finishing the build with --coverage this leaves over 900 gcov files that get picked up by the codecov script. However only less than 150 of them are relevant to my project. This results in almost 800 files being scanned, uploaded, then discarded post upload as they don't exist in the repository.

Would it be possible to add the inverse to -g for paths to filter for gcov? Such as -G, which would mean that only files paths that match the given expression get scanned.

This would speed up the collection + upload times from hours to minutes. For instance, see here where the first is 8MB, while the other is over 100MB!
https://codecov.io/gh/ibuclaw/GDC/commit/9225c1b868bbf456d19a5ac27796ec12bedc0348/builds

bash : find: paths must precede expression: ./vendor/bin

Seeing this error in one of my projects:

==> Appveyor CI detected.
    project root: .
    Yaml found at: codecov.yml
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + coverage/coverage.xml bytes=157786
==> Appending adjustments
    http://docs.codecov.io/docs/fixing-reports
bash : find: paths must precede expression: ./vendor/bin
At line:3 char:1
+ bash codecov.sh -f 'coverage/coverage.xml'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (find: paths mus...n: ./vendor/bin:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
    + Found adjustments
==> Uploading reports
    url: https://codecov.io
    query: branch=appveyor&commit=d96c6a413b015a5ca98d60291cc671561879a4d6&build=8x2u2py364mp88w1&build_url=&name=&tag=&slug=felixfbecker%2Fphp-language-server&yaml=codecov.yml&service=appveyor&flags=&pr=&job=felixfbecker%2Fphp-language-server%2F24
    -> Pinging Codecov
    -> Uploading to S3 https://codecov.s3.amazonaws.com
    -> View reports at https://codecov.io/github/felixfbecker/php-language-server/commit/d96c6a413b015a5ca98d60291cc671561879a4d6
Command executed with exception: Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]

https://ci.appveyor.com/project/felixfbecker/php-language-server/build/24#L500

Recent commits broke it

Sorry I don't have a better title. :)

bash <(curl -s https://codecov.io/bash) -X coveragepy -t <token>

/dev/fd/63: line 1: syntax error near unexpected token `newline'
/dev/fd/63: line 1: `<!DOCTYPE html>'

bash <(curl -s https://codecov.io/bash) -X coveragepy -t <token>
 returned exit code 2

Action failed: bash <(curl -s https://codecov.io/bash) -X coveragepy -t <token>

The output above was from output on Circle CI. Jobs were otherwise working well today, the error just started showing up in the last few hours.

Patch Status should compare to merge-base instead of HEAD

A common false-positive I see from Codecov is as follows

  1. I create a pull request which Codecov reports green as improving code coverage by ~ 1%. ✅
  2. Separately, a colleague's PR which improves coverage by ~ 4% is merged into the integration branch. ✅
  3. I trigger a new build on my PR - and now Codecov falsely reports that the Patch Status for the change in coverage introduced by my PR would purportedly decrease coverage by ~3%. ❌

The problem: The base of comparison being used is the latest-and-greatest of the integration branch, even though I branched off from an older commit of the integration branch.

One work-around is for me to simply rebase my feature branch atop the integration branch, and rebuild to get an accurate delta.

But it would be ideal if Codecov did a comparison against the merge-base for the PR. In git terms that would be git merge-base integration-branch feature-branch.

Not possible to process multiple .coverage files

I'm trying to upload multiple .coverage files using the bash uploader.

I have tried specifying -s to specify the location of each file, but this does not work, as the uploader always does a search from $git_root, and always finds the first file.

dry run: do not (try to) upload file, without dumping

You can use -d to dump the upload file instead of uploading, but that is quite verbose.

It would be nice if -d would just output the URL, and only -v -d would dump it - given that a long option like --dry-run is not trivial to do with bash's getops (but would be possible), and that -n is already taken.

Via #86.

Please add license header

Hi!

Without a license header in codecov I need to assume "all rights reserved" for a license. Is that true? Please add a license header stating what the license is. Thank you!

Best, Sebastian

Warn if git is missing

Using the bash script in docker fails to get the config because by default most docker images don't have git installed.

I figured it out eventually, but a warning/error would have been nice.

Trying to get coverage from clang

I do not know if it will actually work in the end, but
The problem: i run codecov bash script with -x llvm-cov-3.8 -a gcov, which i assume should produce what the script expects.
However, $gcov_exe is also run with some hardcoded arguments: -pb or -pbcu

bash -c "find $proj_root -type f -name '*.gcno' $gcov_include $gcov_ignore -exec $gcov_exe -pb $gcov_arg {} +" || true

llvm-cov gcov does not support them, and fails https://travis-ci.org/darktable-org/rawspeed/builds/198960321#L1115

Perhaps these -pb or -pbcu should be configurable somehow?

Support standard stream

Similar to the Node.js module codecov, would be useful if the bash script accepted a coverage report from stdin; e.g.,

$ cat ./lcov.info | bash <(curl -s https://codecov.io/bash) -F test

This would allow support for pipelining without the need to write to disk in order to upload.

codecov-bash not working when using Jenkins pipeline

Hi there,

I am not able to update the codecov coverage report using the bash script in a Jenkins pipeline. After executing my tests, I call the codecov-bash script as follows:

sh "curl -s https://codecov.io/bash | bash -s - -t ${TORM_CODECOV_TOKEN} || echo 'Codecov did not collect coverage reports'"

In the Jenkins console we can check that the bash script failed:

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                              Bash-d109cc7


�[0;90m==>�[0m Jenkins CI detected.
Codecov did not collect coverage reports

Looking for some similar open issues, I found this #68. It seems that the problem is related with the way in which environment variables such as GIT_COMMIT and GIT_BRANCH are read. I tried to solve it changing my Jenkinsfile as follows, but still no luck:

def codecovArgs = '-K '
if (env.GITHUB_PR_NUMBER != '') {
    codecovArgs += "-B ${env.GITHUB_PR_TARGET_BRANCH} " +
        "-C ${env.GITHUB_PR_HEAD_SHA} " +
        "-P ${env.GITHUB_PR_NUMBER} "
} else {
    codecovArgs += "-B ${env.GIT_BRANCH} " +
        "-C ${env.GIT_COMMIT} "
}
sh "curl -s https://codecov.io/bash | bash -s - ${codecovArgs} -t ${TORM_CODECOV_TOKEN} || echo 'Codecov did not collect coverage reports'"

Any idea? Thanks in advance.

Silent failure detecting Jenkins branch

When running against master in our setup, neither $BRANCH_NAME or $GIT_BRANCH exist in the environment. As a result, codecov exits when trying to detect the branch:

+ search_in=.
+ '[' fddf '!=' '' ']'
+ say '\033[0;90m==>\033[0m Jenkins CI detected.'
+ echo -e '\033[0;90m==>\033[0m Jenkins CI detected.'
==> Jenkins CI detected.
+ service=jenkins
++ '[' '!' -z '' ']'
++ '[' '!' -z '' ']'
++ '[' '!' -z '' ']'
+ branch=

I'm not sure what changed, but this used to work fine a few months ago when I last tried.

[ "$(which coverage)" != "coverage not found" ]

I suspect this is the culprit of an error I’m seeing, but I’m not 100% sure. The error is here: https://travis-ci.org/zbeekman/json-fortran/jobs/66252248#L1519 which in turn implicates https://github.com/codecov/codecov-bash/blob/master/codecov#L328 But, L328 should not cause a problem if an executable named coverage exists, and this is checked for in line 321 which leads me to suspect that this test is incorrectly thinking that the coverage program is present when it is not.

Why not just test the return status of the which command? It seems fragile to test against a specific output string. I think this would be more robust:

if which coverage >/dev/null 2>&1; thenelsefi

From the man page:

Which returns the number of failed arguments, or -1 when no `programname´ was given.

codecov seems to handle branch data in incorrect way

example raport:
https://codecov.io/gh/lplewa/codecov_tests/src/7483e6bc6f4b96525eef5657370cae84e7bf8791/foo.c#L15

In the raport above, if in line 15 is "yellow" , but all his branches are green, what looks like the bug.
if we will check a uploaded raport we can find 4 branches where there should be only two

   2:   15:	if (c == 0) {
 branch  0 taken 100% (fallthrough)
 branch  1 taken 0%
 branch  2 taken 0% (fallthrough)
 branch  3 taken 100%
         1:   16:		ret += 4;
         -:   17:	} else {
         1:   18:		ret += 8;
         -:   19:	}

it happened because i compiled this code two times (with two separate binaries) - so i have two separate gcda//gcno files per one source file. When you call gcov command on this two gcda at once
we will get one gcov file with branch data merged in way showed above (imo it might be gcov bug)

anyway i did a try to generate manually gcov files to get separate file per gcda//gcno file

a result this experiment you can find here: https://codecov.io/gh/lplewa/codecov_tests/src/c5c2ca0746b3a3829711a0370c6a8b07764e5ce6/foo.c#L15

now there is two gcov files
first:

        1:   15:	if (c == 0) {
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        1:   16:		ret += 4;
        -:   17:	} else {
    #####:   18:		ret += 8;
        -:   19:	}

second:

        1:   15:	if (c == 0) {
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
    #####:   16:		ret += 4;
        -:   17:	} else {
        1:   18:		ret += 8;
        -:   19:	}

in my opinion in this case "if" should be green, but is still yellow, so it's seems that codecov didn't properly merged branching data.

also i did a test when i uploaded two separate raports - first for tests witch covers first branch, second raport for tests with covers second branch. Unfortunately if is still "yellow"
https://codecov.io/gh/lplewa/codecov_tests/src/ab9474598cd5af066227542962b205dd3cc5e9e4/foo.c

Can you fix merging branch data and add to codecov-bash script option to call gcov per gcda file (with -l flag to protect from file name conflict) instead of calling gcov for all gcda files at once.

Test suite is failing

The current test suite fails, which impedes the ability to make enhancements/fixes.

Failing on busybox 1.26, incorrect flags passed to `find`

See: https://circleci.com/gh/riyazdf/cli/1900 (last step "Upload to Codecov")

==> Circle CI detected.
    project root: .
    Yaml found at: codecov.yml
==> Running gcov in . (disable via -X gcov)
==> Python coveragepy not found
==> Searching for coverage reports in:
    + .
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    + ./coverage.txt bytes=447884
==> Appending adjustments
    http://docs.codecov.io/docs/fixing-reports
find: unrecognized: ./vendor/golang.org
BusyBox v1.26.2 (2017-06-11 06:38:32 GMT) multi-call binary.

Usage: find [-HL] [PATH]... [OPTIONS] [ACTIONS]

It finds no files to upload, so the reports are empty.

change to merge handling has broken handling of real merges and PR diff calculation

One of codecov's key features is that for each PR, it tells you how it changes coverage compared to the current master branch. In order to do this, it needs to have some idea of what the coverage is on the master branch. Sometime in the last week or so, on my project Trio, codecov started miscalculating the master coverage as being ~95%, when my coverage is actually ~99%. Since codecov is still calculating coverage correctly for PRs, this means that it's now reporting that every PR is amazing and causing a big jump in coverage. For example, here's a PR that doesn't touch the code at all, but codecov reports is adding hundreds of lines of new coverage: python-trio/trio#388
Of course this makes the codecov reporting rather useless, since it's impossible to see actual PR-related coverage changes in the noise.

If you look at codecov's commit history for my master branch, then you can see that it's all of the "Merge pull request #XX from XX" commits that have the incorrect coverage.

It looks like the reason this is happening is that this project is tested on Appveyor (Windows), Travis (Linux), and Jenkins (MacOS). The commits with correct coverage show uploads from all three sources (example). The commits with incorrect coverage show uploads only from Appveyor (example), and the 95% is what you get if just running the tests on Windows.

So that all makes sense, but why are my merge commits apparently only getting tested on Windows? Well, they are getting tested on Linux and MacOS... here's a Travis log testing that same 4f65fa74 commit that I linked above. And if you scroll down to the bottom of the Travis log, you can see that coverage is being uploaded to codecov..... but the codecov-bash uploaded says Fixing merge commit SHA and then from the URL at the bottom we can see that even though we were testing 4f65fa74, the coverage has been attributed to commit 87d2c9ca1e3 (which is one of the merge parents).

And then the reason I'm getting different behavior on Windows vs. Linux and MacOS is that on Windows, there is no bash so I'm using codecov-python, while on Linux and MacOS I'm using codecov-bash.

Looking over the recent commit history, the problem seems to be this recent commit: beaae435 (which is also in codecov-python, but I'm guessing that part hasn't been shipped yet). The idea of that commit is to replace a hacky-looking regex check for merges, with a more reliable check based on git parentage.

However, this is based on a fundamental misunderstanding of what that code is doing. It's purpose is not to detect merges in general; its purpose is specifically to detect the temporary refs/pull/XX/merge merge commits that Github generates for testing PRs, which have a special auto-generated commit message. The special handling is only supposed to be triggered on these merges, not for all merges, and in particular not for merge commits that are actually pushed to master, as in my case. So I believe that this change should be reverted from both codecov-bash and codecov-python.

CC: @stevepeak @blueyed

Cannot upload report to S3

Here's my full output of calling codecov-bash:

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

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _` |/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                                5ca7b8c


(url) https://codecov.io
(root) .
==> GitLab CI detected.
==> Trying gcov (disable via -X gcov)
  -> Running gcov
==> Searching for coverage reports
**> Python coverage not found
==> Detecting git/mercurial file structure
==> Reading reports
  + ./target/site/jacoco/jacoco.xml bytes=2806
(query) package=bash-5ca7b8c&branch=feature/codecov&commit=1921b64c41af1819966877003ba9e1780da9cf45&build=640303&build_url=&slug=pvorblab-ci-java-gradle-codecov.git&service=gitlab&pr=&job=&token=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
==> Uploading reports
    Pinging Codecov
    Uploading to S3
Codecov did not collect coverage reports

I obfuscated the token in the output (see #22).

What might be the cause of the problem? I can't really tell from the output, but the code tells me that either "Reports queued to [...]" or "Failed to upload to s3" should be printed after "Uploading to S3".

Statement coverage not sent completely

This is what I get on codacy: https://www.codacy.com/app/vladureche/miniboxing/file/638296884/coverage?bid=2211210&fileBranchId=2211210 (it's not showing missed statements, only the ones hit) and here's what I get on codecov: https://codecov.io/github/miniboxing/miniboxing-plugin/components/plugin/src/miniboxing/plugin/transform/minibox/inject/MiniboxDuplTreeTransformation.scala?ref=wip

I tried to debug the bash script, but afaict it's pushing all the data to the server. Maybe I'm wrong...

Do not print private token to stdout

I am using codecov-bash (commit 5ca7b8c) on GitLab CI. I use the -t parameter to provide the private token of my project on codecov.io. Unfortunately, this private token gets printed to stdout and thus is visible in the build log. Build logs are public on GitLab (I'm not sure what's the case for other build servers).

$ bash <(curl -s https://codecov.io/bash) -p $CI_PROJECT_DIR/target/site/jacoco/jacoco.xml -t $codecov_upload_token

...

==> Reading reports
  + ./target/site/jacoco/jacoco.xml bytes=2691
(query) package=bash-5ca7b8c&branch=feature/codecov&commit=5d994fbbf1dd6554a46a447758783d4f9820a49f&build=640242&build_url=&slug=pvorblab-ci-java-gradle-codecov.git&service=gitlab&pr=&job=&token=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

...

I think this behavior should be avoided. When I first configured CI and code coverage I didn't notice that my private token got published.

My current workaround pipes all output of codecov-bash into sed, which filters the token from the output and then prints what's left.

testing-with-docker: https://codecov.io/env returns access denied

Dear Project maintainer,

Thanks again for providing such a neat infrastructure for managing code coverage 👍

That said, trying to download the env script using https://codecov.io/env (as explained in the testing-with-docker documentation) fails with the following response:

<!DOCTYPE html>
	<html>
	  <head>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<meta charset="utf-8">
		<title>Application Error</title>
		<style media="screen">
		  html,body,iframe {
			margin: 0;
			padding: 0;
		  }
		  html,body {
			height: 100%;
			overflow: hidden;
		  }
		  iframe {
			width: 100%;
			height: 100%;
			border: 0;
		  }
		</style>
	  </head>
	  <body>
		<iframe src="https://d234q63orb21db.cloudfront.net/cd118a714294f80d079e8514f43792f519841d20/media/html/error.html"></iframe>
	  </body>
	</html>

When you have a chance, could you have a look ?

Merci

Cc: @thewtex

Bash script unclear about why it can't find `codecov.yml` when source-control not present

Feature request for codecov bash script:

  1. Allow at least project-root-only codecov.yml files when source control is unavailable
  2. Show why codecov.yml was not found when it's not (eg. "We couldn't find .git or .hg directories, so we only looked in the project-root directory")

Figuring out why codecov.yml wasn't being found sucked up a few hours of my and my coworker's time.

Our builds are in CodeShip Pro; since it's a Docker build, the .git directory is unavailable. Codecov's bash script says Yaml not found! despite it being present in the current directory (the problem was actually that .git is unavailable).

Here's the code in the bash script that is causing this problem for us:

yaml=$(cd "$git_root" && \
       git ls-files "*codecov.yml" "*codecov.yaml" 2>/dev/null \
       || hg locate "*codecov.yml" "*codecov.yaml" 2>/dev/null \
       || echo '')
yaml=$(echo "$yaml" | head -1)

Related: #84

Wrong version advertised in https://codecov.io/bash

The file which is now at https://codecov.io/bash has VERSION="d109cc7"

I have a version cached 10 days ago, which has the same version, but is different to the "latest" on.

Here is the diff.

I think that the version on https://codecov.io/bash should have a different VERSION

diff --git a/tools/codecov.sh b/tools/codecov.sh
index f47caf7..4021502 100755
--- a/tools/codecov.sh
+++ b/tools/codecov.sh
@@ -1207,6 +1207,15 @@ do
   fi
 done <<< "$(echo -e "$files")"
 
+if [[ $(find $upload_file -type f -size +104857600c 2>/dev/null) ]]; then
+  say "${r}-->${x} Sorry, the resulting file is to large for uploading."
+  say "    We are working on a solution for large files and will remove this message"
+  say "    when we have resolved the issue. Thank you for your patience."
+  say "    Max upload size is 100mb."
+  curl https://codecov.io/log?$query 2>/dev/null >/dev/null
+  exit ${exit_with};
+fi
+
 if [ "$fr" = "0" ];
 then
   say "${r}-->${x} No coverage data found."

-x option ignored

Since commit 72c885f the script always uses the "gcov" executable instead of using the executable name provided with the -x parameter. Since I use gcc 5 in my project I need to execute "gcov-5" on travis.

After taking a quick look at the code it also looks as if the gcov arguments are ignored in the latest version since it has $gcovargs instead of $gcov_arg (line 486) and the osx line (line 462) doesn't have either, but I'm not familiar enough with the script to say if this is wrong or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.