-
Notifications
You must be signed in to change notification settings - Fork 47
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
Closes #83: report JavaScript code coverage in PRs #84
Conversation
…io service. Also tweak Travis-CI to build commits on master too (to ensure we have code coverage base report).
Codecov Report
@@ Coverage Diff @@
## master #84 +/- ##
=========================================
Coverage ? 11.78%
=========================================
Files ? 1
Lines ? 280
Branches ? 0
=========================================
Hits ? 33
Misses ? 247
Partials ? 0 Continue to review full report at Codecov.
|
As mentioned, this comment ☝️ has no "base" code coverage report to compare against in master. If/when these changes get merged, every commit on master moving forward will have base reports be generated and stored, so moving forward we'll have code coverage reporting in PRs. |
@filmaj: Thanks for taking care of the Hubble infrastructure. I agree that it’s nice to have code coverage tracked by Codecov 😃. From my experience, Codecov tends to babble about very minor coverage changes, for instance, when doing small refactorings. Is limiting Codecov output to bigger coverage changes (for instance, more than 0.5 %) something we could or should do? If not, that’s still a detail we could certainly live with given the benefit of being notified about more significant changes in code coverage. |
@pluehne I will take a look and see if that's possible. I agree with you that it can be pretty verbose 😞 A perfectly acceptable answer is also "no thanks" - consider this PR just as much soliciting feedback as recommending changes. I appreciate honesty :) |
Ah yes, looks like the pull request comments from codecov are completely customizable. I'm going to play around with those and see if I can create a few examples that we can look at. |
Couple things we could try to make codecov less verbose:
Last thing that I just learned, and is kind of cool, is codecov's flags. Seems like this allows us to set code coverage targets and have these somehow (still figuring it out!) show up as requirements or checks in GitHub PRs. That is, we can say the Let me know what you think and I can put together a proof of concept with some of this stuff on my fork. |
I've put the above changes into practice on my fork, you can check out a test PR I opened against my fork to see how the output will look. Worth noting that I had to merge a A summary of the changes and things to note / discuss:
Let me know what y'all think. |
There's also a lot more detail about customizing the behaviour in codecov's support wiki. We could also:
|
@filmaj: Gosh, thank you so much for all your research on Codecov! When I said that Codecov tends to be verbose, that wasn’t meant as an absolute blocker from my side 🙂. Still, I like the Codecov options you have experimented with—in particular, the I wouldn’t set hard limits on pull requests, though. I like the fact that @larsxschneider and I can keep track of code coverage, but I’d prefer not to enforce that strictly and rather request test coverage personally where it makes most sense. Thanks also for figuring out how to track coverage for Setting a permissive threshold of, say, 1–2 % is something I’d like to have for the reason mentioned earlier (very small fluctuations in the coverage can quickly become annoying to be notified about with a red cross 🙂). Finally, I also agree with your point that patch coverage might be very interesting to look at for individual pull requests. And I like the compact “header” layout very much—it’s concise and contains a link to the full report in case someone’s interested. |
… coverage to commit status. set a threshold of 2% project code coverage for commit status setting. render lean PR comments, and ensure codecov deletes/creates a new comment in PRs that change.
I've updated this PR with the codecov behaviour details you mentioned:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@filmaj: That sounds great! Let’s try it out like this for some time, as we can still adjust the settings later if we wanted to.
"version": "1.6.0", | ||
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", | ||
"integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", | ||
"dev": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Crazy. Why do we need all these packages? I assume codecov references them somehow?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I guess it must come from codecov. It is indeed crazy. Not sure what to do about it though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. I guess that's the NPM world...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed...
For what it's worth, all of these dependencies come out from the devDependencies
section of package.json
, which means these are dependencies only needed for development of the Hubble dashboard/webapp. Consumers won't need any of this. Only developers of the webapp need to run npm install
and pull all these extra modules in.
@filmaj I want to second @pluehne , thanks a lot for you work! That's super great! The only blocking issue is Codecov right now. They want write access for "Repository webhooks and services" and "Commit statuses" as well as read access for "Organizations and teams". I need to carefully check that first. |
@larsxschneider completely understand that, makes sense. If I recall correctly, you don't need to give codecov access to webhooks if you configure the webhook codecov requires on your own. It only asks for webhook write access if you feel lazy and don't want to muck about in the repo settings. Org read access, I believe, is so codecov can determine what repos are available and offer to set up codecov integrations for them automatically for you. The only permission that it absolutely needed is write for commit statuses - that gives codecov the ability to mark a PR as red x or green checkmark by writing code coverage status to each commit as metadata. |
I use the codecov.io service on a lot of my JavaScript projects, as it automatically comments how test code coverage changes with each incoming PR to a project. I find that feature useful. If the owners of Hubble agree, feel free to pull this PR, but please read the sections below for some details on how it all works and what permission changes are needed.
How It Works
npm run codecov
after the tests complete. This will go through and parse the JS code coverage report files that our karma test runner creates to understand what the JS code coverage level is in the PR.Permission Requirements
We'd need to give codecov.io permission to access the repo, though. Someone with autodesk organization rights would need to head over to https://codecov.io/gh/autodesk/hubble, sign in with their GitHub credentials, and give codecov.io the necessary access. The setup is not complex - I think you just need to flip a switch for a particular repository (similar to how Travis does it).
If we do merge this in, every PR created after this gets merged in would start getting JS code coverage reported as a bot comment directly inside new PRs.