oceanprotocol / ocean.py

🦑 Ocean Protocol's Python library to privately & securely publish, exchange, and consume data.
https://oceanprotocol.com
Apache License 2.0
173 stars 78 forks source link

make code coverage more visible #121

Closed kremalicious closed 3 years ago

kremalicious commented 3 years ago

Problem

Hard to figure out what the current code test coverage is (69%) cause it can only be found here: https://travis-ci.com/github/oceanprotocol/ocean.py/jobs/480270206#L696

Suggested solution There should be a badge in the readme, sourced from whatever tool is used here to collect the coverage reports.

Example: ocean.js readme badges line: https://github.com/oceanprotocol/ocean.js

Notes After this is done, a good follow-up is: #146 Only allow code merges if unit test code coverage ratchets up

kremalicious commented 3 years ago

Found ocean.py on Codacy but looks like we do not send any code coverage reports to there, or it's broken. Until that is solved there is no badge to display https://app.codacy.com/gh/oceanprotocol/ocean.py

calina-c commented 3 years ago

@kremalicious Can we do something like this? It doesn't include third parties: https://itnext.io/github-actions-code-coverage-without-third-parties-f1299747064d

kremalicious commented 3 years ago

sure, whatever works without too much maintenance on our part. Also depends on what backend team chooses to monitor and measure code coverage and code quality. But in the end everything works which provides us with PR status notifications based on diff coverage. On js repos we use CodeClimate and it also posts this PR comments like https://github.com/oceanprotocol/ocean.js/pull/622#issuecomment-784305049. But pretty sure that's all possible to put together in GitHub Actions too

trentmc commented 3 years ago

Codacy docs show how to create badges.

How: in codacity.com, go to repo's settings page, scroll to the bottom, generate a badge, and copy the code. Here's the ocean.py page.

So I did this! And I added the badge into ocean.py's README, in this commit: https://github.com/oceanprotocol/ocean.py/commit/085a8e8bd6b70e2d51230add20c24d1a2f563ea9

However it doesn't complete this issue, since it's only a grade for code quality, not for code coverage. But it's a start.

(And I see that ocean.js has like 10 badges, cool! Challenge accepted :P )

trentmc commented 3 years ago

Towards the actual issue at hand, it appears that we can get Codacy to generate coverage reports. That page links to using the coverage tool for python, which is already in setup.py's list of imports for dev tools. If the report is properly generated, perhaps Codacy will give us a badge for it.