Skip to content

Add integration with codecov #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Conversation

albfan
Copy link

@albfan albfan commented Oct 12, 2015

resolves #1

https://codecov.io/github/albfan/example-bash
https://travis-ci.org/albfan/example-bash

See

  - git clone https://github.com/albfan/bashcov.git
  - cd bashcov/
  - gem build bashcov.gemspec
  - gem install bashcov-1.2.1.gem

is a patch meanwhile PR is accepted

Anyway I found a common problem on your system. It caches too much and doesn't realize HEAD was rebased.

if you issue:

$ bashcov ./script.sh
$ firefox coverage/index.html

you will see a coverage of 87%

image

Don't know how to refresh code. (See actual .travis.yml remove bashcov gem compilation and codecov shows it as if exists)

@codecov-io
Copy link

Current coverage is 92.85%

Branch #2 has no coverage reports uploaded yet.

No diff could be generated. No reports for master found.
Review entire Coverage Diff as of 630ade0

Powered by Codecov. Updated on successful CI builds.

@albfan
Copy link
Author

albfan commented Oct 12, 2015

uhmm

https://codecov.io/github/albfan/example-bash/commits

rebased commit is detected, but since no code changes on it, codecov ignores it. That's wrong!.

@stevepeak
Copy link
Contributor

Is it possible to use the pip install --user codecov && codecov command here?

I'm not sure what happened on the rebase. Is there something wrong on our end?

@albfan
Copy link
Author

albfan commented Oct 23, 2015

I will add traces on bashcov. Seems it is the faulty piece on 0% code coverage.

@albfan albfan force-pushed the master branch 5 times, most recently from 18cffe0 to a1205b4 Compare October 24, 2015 03:23
@albfan
Copy link
Author

albfan commented Oct 24, 2015

All is clear now. bashcov is based on BASH_XTRACEFD

https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html

and script is not executed against bash if shebang is not set explicit. I can imagine you can do bashcov bash script or something like that

https://codecov.io/github/albfan/example-bash/script.sh?ref=a1205b45abc86cd6c7210c6621b7fedf201815c6

But real question is the codecov example bash. How is it suppose to work with pip --install codecov && codecov. Are you suggesting to reimplement what is already working on bashcov and what is using your own report generator based on simplecov (a wide used coverage tool indeed) https://github.com/codecov/codecov-ruby

Another thing to consider supporting bashcov is it generates local reports (don't miss the great part of show coverage until you push to repo)

@stevepeak
Copy link
Contributor

@albfan we do have a Bash uploader: https://github.com/codecov/codecov-bash that would be the preferred uploader for this case

@albfan
Copy link
Author

albfan commented Oct 25, 2015

I will try and compare results.

@albfan
Copy link
Author

albfan commented Oct 25, 2015

I have rebased all the work, to expose my contribution

albfan@27b6620

and your upload style suggestion

albfan@2508da6

I think you miss the point at all. See compilation

https://travis-ci.org/albfan/example-bash

It is looking for gcov output to upload reports. Here we have no report generated. bashcov is the report generator, but it's based on simplecov and use your simplecov uploader to upload its results. There's no gcov results on bashcov.

Now you need to make a decision. Support bash through gcov data reports (don't know a tool for that ) or use your existing working uploader with a gem install (really typical workflow on travis)

For me bashcov is the way to go, so let me know if sometime it's an option for you. I have a succesful workflow and hope others can benefit for it, but seems you're not agnostic about tools to upload reports. You are facing the most typical mistake for a wide scope service (the cathedral and the bazaar)

https://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar

I'm pretty confortable with my bazaar as it let me stick on the edge of all these new tecnologies arising, when one gets obsolete or gets the wrong way, I simply change the tool.

We are working here to improve bashcov:

infertux/bashcov#13

Feel free to suggest or point out anything there

@albfan albfan closed this Oct 25, 2015
@stevepeak
Copy link
Contributor

https://travis-ci.org/albfan/example-bash

I still don't fully understand the use of simplecov in this. The straight forward simple question I have is: can bashcov, without simplecov, produce any coverage export? If that is a yes, then I propose skipping simplecov and uploading these directly to Codecov. According to bashcov usage it appears to have a html export...does this require simplecov? Is there any other formats: xml, json, txt?

Support bash through gcov data reports

The Bash uploader calls gcov automatically. But from here it looks like it finds no .gcno. How would you produce gcov in bash?

you're not agnostic about tools to upload reports

I'm happy to share more on this if you'd like in a Skype call. This may be very helpful because I feel lost like I'm not on the right wavelength with all this...

Thank you :)

@albfan
Copy link
Author

albfan commented Oct 25, 2015

simplecov offers a coverage api. Forget the ruby part. On top of simplecov, you can build a coverage tool for whatever. That's the idea behind bashcov. Using xtrace bash option, execute a bash script, and detect covered lines from bash execution. bashcov make that part and left the rest to simplecov.

By default simplecov offers "SimpleCov::Formatter::HTMLFormatter". I find it useful (see I added it by default)

albfan/bashcov@b7bbe0c

but in this world of cloud services, that part could simply be ignored (adding a --no-local option or the like to bashcov)

so at this point, you have the simplecov data report generated (in memory) how to upload to codecov?. Hey! all work is done, you have a simplecov formatter that does all the work:

https://github.com/codecov/codecov-ruby

From CatB:

  1. Any tool should be useful in the expected way, but a truly great tool lends itself to uses you never expected.

that's what codecov-ruby is.

Forget what's behind scenes, here you have:

  • coverage api (simplecov)
  • bash runner lexer and parser (bashcov)
  • codecov uploader (codecov-ruby)

You are ready to go.

Contact me on my email. I will be really pleased to do that skype call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants