cicirello / jacoco-badge-generator

Coverage badges, and pull request coverage checks, from JaCoCo reports in GitHub Actions
https://actions.cicirello.org/jacoco-badge-generator/
MIT License
101 stars 42 forks source link

Feature Req: Generate badges from JaCoCo reports in xml format #82

Open japarson opened 2 years ago

japarson commented 2 years ago

Is your feature request related to a problem? Please describe. The Pester PowerShell testing framework allows users to output code coverage reports as JaCoCo xml files. However, this action requires input in the form of csv files.

Describe the solution you'd like A new input option jacoco-xml-file that works for JaCoCo xml files.

Describe alternatives you've considered I could not find any simple way to convert from csv to xml. I could also request that the Pester framework add an option to output as csv, but I think it makes more sense to start here.

Additional context N/A

Thank you for your consideration!

cicirello commented 2 years ago

@japarson I'm not familiar with Pester so I took a look at it. Based on their docs it looks like only the xml report is generated. It looks like they adopted jacoco's xml format but not jacoco itself.

Anyway, I think xml report support is a reasonable request. It shouldn't be difficult to parse. I don't think an input to turn on option is likely necessary, and can probably just go by file extension. I know jacoco uses the standard xml extension when it generates an xml report. Can you confirm whether Pester's report uses xml file extension as well?

japarson commented 2 years ago

@japarson I'm not familiar with Pester so I took a look at it. Based on their docs it looks like only the xml report is generated. It looks like they adopted jacoco's xml format but not jacoco itself.

Anyway, I think xml report support is a reasonable request. It shouldn't be difficult to parse. I don't think an input to turn on option is likely necessary, and can probably just go by file extension. I know jacoco uses the standard xml extension when it generates an xml report. Can you confirm whether Pester's report uses xml file extension as well?

Pester reports use the xml file extension by default: image

Thank you so much for considering this request. I mentioned the new input option to turn it on because I saw there was an input specifically for csv files: jacoco-csv-file. Would I still use this input for an xml file?

cicirello commented 2 years ago

@japarson when I replied earlier I had forgotten that the input has csv in its name. So a new input definitely makes more sense.

japarson commented 2 years ago

@japarson when I replied earlier I had forgotten that the input has csv in its name. So a new input definitely makes more sense.

I should have included my reasoning in the original post. My bad there.

Thinking it through some more, I think there are actually 2 options here:

  1. Change the name of the existing input to jacoco-file and add some documentation about the possible input types.
    • This is a "major" level breaking change (in the context of semantic versioning).
  2. Add a new input specifically for xml files jacoco-xml-file.
    • This is a "minor" level change.

I'm not sure what the best option is. What do you think?

cicirello commented 2 years ago

I thought of an additional option, essentially a variation of the first one: Create a new input without csv/xml in its name, and deprecate the existing jacoco-csv-file input, but keep it around for now. It avoids the potential downside of just adding jacoco-xml-file (e.g., might cause confusion leading to false assumption that both reports are needed, as well as the possibility that jacoco might later introduce yet another format). But at the same time it temporarily avoids a breaking change.

manoj-paypay commented 1 year ago

Hi @cicirello Thanks :). I wanted to know if this support is added or not? I am trying to use the command line utility but it doesn't work for xml with and without file type format jacoco-xml-file and jacoco-file.

cicirello commented 1 year ago

Hi @manoj-paypay no, it doesn't support JaCoCo XML reports yet, only the CSV reports at the present time.