5monkeys / cobertura-action

GitHub Action to report cobertura coverage
MIT License
63 stars 69 forks source link

[Feature request] Add new parameter "minimum_coverage_per_file" #81

Open tprouvot opened 1 year ago

tprouvot commented 1 year ago

Hi, Thanks for this action, it is very helpful !

It would be nice to have two distinct a new parameter which would be : minimum_coverage_per_file

Example:

- name: cobertura-report
        uses: 5monkeys/cobertura-action@v13
        with:
          path: cobertura/coverage/cobertura.xml
          minimum_coverage: 75
          minimum_coverage_per_file: 70

And result would be

first example KO

File Coverage Lines Missing
All files 75% 75% :white_check_mark:
no-map/AccountTriggerHandler 100% 100% :white_check_mark:
no-map/AccountContactRelation 50% 50% :x:

Minimum coverage requirement was not satisfied (75% global and 70% per file )

- name: cobertura-report
        uses: 5monkeys/cobertura-action@v13
        with:
          path: cobertura/coverage/cobertura.xml
          minimum_coverage: 85
          minimum_coverage_per_file: 75

second example OK

File Coverage Lines Missing
All files 87% 87% :white_check_mark:
no-map/AccountTriggerHandler 100% 100% :white_check_mark:
no-map/AccountContactRelation 75% 75% :white_check_mark:

Minimum coverage requirement satisfied (85% global and 75% per file )

Rasmus-Fink commented 8 months ago

In our project we currently can't fail a build when a single files is below the threshold. The suggested option would come in very handy here!