dwyl / learn-istanbul

:checkered_flag: Learn how to use the Istanbul JavaScript Code Coverage Tool
340 stars 41 forks source link

Advice needed :-) on implementation of Codecov without key on Travis #12

Open Cleop opened 7 years ago

Cleop commented 7 years ago

I'm trying to use Codecov on Travis without using the key as you told me it can be done without and so in the name of efficiency I want to learn how it's done! My .travis.yml and package.json look like yours: https://github.com/Cleop/triumph-website/blob/master/.travis.yml#L3-L6 https://github.com/Cleop/triumph-website/blob/master/package.json#L10

And I'm registered on Codecov and have selected the repo.

However I'm not getting any data on Codecov when I merge PR or on the badge on my README.

Any advice would be greatly appreciated 😄 Thank you!

Cleop commented 7 years ago

The last few amends I've made using Travis to try and fix this have all failed on the build. The only one which passed in Travis but didn't have working Codecov looked like this in the package.json:

before_install:

which is what I had used in a previous project which had used the token.

nelsonic commented 7 years ago

Hi @Cleop thank you for creating this question! ❤️ Are the instructions in the readme for setting up Codecov no longer valid? 😞 I'm just about to set this up for my weekend project: https://github.com/dwyl/stars so will be checking if I can replicate it. will report back shortly. thanks! 👍

nelsonic commented 7 years ago

Hi @Cleop, Haven't "forgotten" you. 💭 I've implemented Travis-CI with Codecov including the PR comments: https://github.com/dwyl/stars/pull/3#issuecomment-272723467 the PR isn't quite done yet but you can see that it's working with the following .travis.yml: https://github.com/dwyl/stars/blob/e084a225ce43f2a019720955111c41ac1d1d9bf7/.travis.yml#L8-L11

Did you have any luck? 🍀

Cleop commented 7 years ago

I've managed to get Travis to pass by removing the coverage script I had in my package.json before for istanbul. However I'm still getting codecov: unknown on my badge on the readme and I have no commit histories in my codecov profile.

Any ideas @nelsonic?

nelsonic commented 7 years ago

@Cleop good question, we could do a hangout to figure it if you have time... 🤔

nelsonic commented 6 years ago

@Cleop were you able to get this working?

Gamecock commented 5 years ago

@nelsonic I found this trying to resolve the codecov badge showing unknown in Github, when codecov.io has coverage metrics, and I noticed the dwyl/stars#3 also shows codecov status as unknown. Does that feature no longer work?

nelsonic commented 5 years ago

@Gamecock Good question. It appears that recently Codecov have changed how they implement coverage via CI service. I recently updated on of our JS projects https://github.com/dwyl/learn-json-web-tokens and it required me adding a CODECOV_TOKEN environment variable to Travis-CI to get it to work. 🙄

The feature definitely works. We use Codecov on over 50 dwyl repositories: https://codecov.io/gh/dwyl Ironically, the repo you have linked to (stars) is on page 3 of our list of repos: https://codecov.io/gh/dwyl?page=3 and shows 100% coverage: image So the badge just needs to be updated ...

[![codecov](https://codecov.io/gh/dwyl/stars/branch/master/graph/badge.svg)](https://codecov.io/gh/dwyl/stars)

codecov

[![codecov.io](https://img.shields.io/codecov/c/github/dwyl/stars/master.svg?style=flat-square)](http://codecov.io/github/dwyl/stars?branch=master)

codecov.io

Gamecock commented 5 years ago

Thanks, this pointed me in the correct direction. I just had to add ?token=:graph_token to the end of my request.
https://docs.codecov.io/reference#about-graphs