Codecov not failing Github action check

657 views Asked by At

I have a private Github repository that I'd like to integrate with Codecov and check coverage on each PR that's opened. Everything is fine as far as generating the coverage report and uploading that report to Codecov, but I'm having trouble having the Github check fail if test coverage of the project does not meet a certain percentage.

For reference, my codecode.yml config for the repo is:

codecov:
  require_ci_to_pass: yes

coverage:
  precision: 2
  round: down
  range: '90...100'
  status:
    project:
      default: # This can be anything, but it needs to exist as the name
        # basic settings
        target: 90%
        threshold: 0%
        if_ci_failed: error #success, failure, error, ignore
        only_pulls: false
    patch:
      default:
        target: auto
        threshold: 0%

parsers:
  gcov:
    branch_detection:
      conditional: yes
      loop: yes
      method: no
      macro: no

comment:
  layout: 'reach,diff,flags,files,footer'
  behavior: default
  require_changes: no
1

There are 1 answers

0
Thomas Hu On

You need to name it codecov.yml or codecov.yaml. Codecov is probably not picking up that file. See the docs.

Side note, I don't think you need to set patch.default here.