Shields: Codecov monorepo support

Created on 30 May 2019  路  9Comments  路  Source: badges/shields

:clipboard: Description

I have a code coverage badge for codecov. It takes the overall coverage value for the whole repository.
I would like to include the values per project (or directories).
Codecov, at least in the UI displays like. I'm unsure of any APIs:

image

image

My goal is to have the coverage value on the table with the package links.
Is there a way already to do this? Or does it make sense to create a new badge for it?

question

Most helpful comment

I'm working on this exact issue, I'll let you know what i come up wirh!

All 9 comments

Ultimately, we're constrained by the breakdown of data that the service provider (Codecov in this case) makes available to us.

I believe Codecov has mechanisms to support monorepo scenarios (I'd suggest checking out their docs on flags). If a project uses those mechanisms, and then if the API provides a way for us to get that specific set of data, then this is certainly something we'd consider!

I don't think any of us on the maintainer team have the bandwidth to do the research into things on the Codecov side, so if you (or anyone else) would be willing to dig into that, that would be a big help in getting the ball rolling on this.

My suggestion would be to apply whatever mechanisms Codecov provides/recommends for monorepos in one of your project, and then see what kind of data structure the Codecov API returns for that project, whether it is queryable/filterable by those mechanisms, etc.

Feel free to ping us on this thread and/or in Discord with any questions

I'm working on this exact issue, I'll let you know what i come up wirh!

Any updates?

Humbly paging @acao <3

I did a quick look at the API and everything else, and I thought of a workaround that might work.

I realized that the Icicle SVG chart has the file paths embedded into it, to display the tooltips (GitHub does not show interactive SVG though).


https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graphs/icicle.svg.


There's a rect xml tag for every rectangle in the image:

<rect xmlns="http://www.w3.org/2000/svg" x="64.459049545" y="75.0" width="101.693629929" height="33.75" fill="#5fcc0b" stroke="white" stroke-width="1" class=" tooltipped" data-content="/lib/evm/precompiles"><title>/lib/evm/precompiles</title></rect>

The important bits are:

  1. File/directory path: data-content="/lib/evm/precompiles"
  2. Color: fill="#5fcc0b"

A microservice would parse that SVG url, make a reverse calculation based on the fill color and output them in a JSON format Shields.io can understand. One question remain: are the colors generated by threshold or scalar values, based exactly on the coverage percentage?

The microservice could search by path and be used by package /packages/my-package, other subdirectories or even files.

OR you could upload reports using flags, which you can then have a badge for it.

https://community.codecov.io/t/badges-for-flags/270/3

Badge format with flag=

https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graph/badge.svg?flag=vm

Thanks for the tip, @ryanio!

Seems like this is something we could scrape for Shields, yea?

Great that a fix got merged. Is there a release we can follow in order to go look for some docs or sample?

You can find our badges here: https://github.com/ethereumjs/ethereumjs-vm

Was this page helpful?
0 / 5 - 0 ratings

Related issues

irgolic picture irgolic  路  3Comments

kirankotari picture kirankotari  路  3Comments

PyvesB picture PyvesB  路  3Comments

chadwhitacre picture chadwhitacre  路  4Comments

niccokunzmann picture niccokunzmann  路  3Comments