NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
50 stars 32 forks source link

set up code coverage #240

Closed bendichter closed 3 years ago

bendichter commented 3 years ago

https://www.mathworks.com/help/matlab/ref/matlab.unittest.plugins.codecoverage-package.html

lawrence-mbf commented 3 years ago

FYI, we do actually generate code coverage in the form of a coverage.xml Cobertura XML file automatically. This was originally intended for use with a Jenkins CI.

http://cobertura.github.io/cobertura/

bendichter commented 3 years ago

Oh cool. Does that just cover Java code or also MATLAB code?

lawrence-mbf commented 3 years ago

I believe this covers MATLAB code so all we would need to do is have a way to actually view the XML file. It's been a while since I've looked at this and I'm not familiar with Cobertura so I'd have to investigate it further but all the heavy lifting regarding code coverage should be there already.

lawrence-mbf commented 3 years ago

Code coverage can be viewed through the azure pipeline here: https://dev.azure.com/NeurodataWithoutBorders/matnwb/_build?definitionId=4

I've also added a coverage badge in README.

acampbel commented 3 years ago

Code coverage can be viewed through the azure pipeline here: https://dev.azure.com/NeurodataWithoutBorders/matnwb/_build?definitionId=4

I've also added a coverage badge in README.

Sorry to lurk on closed issues, but I'm, just excited you guys are getting set up with this. FYI, you may be interested in this service:

https://blogs.mathworks.com/developer/2018/04/17/codecov-and-cobertura/

rly commented 3 years ago

Feel free to lurk, @acampbel ! We definitely appreciate the tips. For some reason, I had assumed cobertura output was not readable by codecov.io. Thanks for letting us know otherwise! I made PR #260 to update the CI to upload the coverage report to codecov. Super easy. Thanks!

oruebel commented 3 years ago

It looks like Codecove currently does not show the line-by-line coverage for individual files correctly, i.e., it shows a GitHub API: Forbidden error with the message Is the path +types/+untyped/DataPipe.m a relative path in your repository? E.g., for DataPipe.m https://codecov.io/gh/NeurodataWithoutBorders/matnwb/src/master/%2Btypes/%2Buntyped/DataPipe.m

rly commented 3 years ago

@oruebel Hm, interesting. I do not see that error when logged in to codecov. I'll look into it.

rly commented 3 years ago

It looks like an issue with codecov and public (non-logged-in) access:

This is caused by rate limiting on the public user used to call the API to fetch the source code for display. We have requested a rate increase for this user and apologize for the inconvenience.