These docs are for v4.6. Click to read the latest docs for v2023.

Common Configurations

A list of common tasks and configurations

We've made a list of the commonly asked tasks and created a recipe guide on how to do them by adjusting your codecov.yml.

📘

Changing one of these common configurations?

When modifying the Codecov YAML, please validate the new YAML using curl -X POST --data-binary @codecov.yml https://codecov.io/validate

I want to:

Set status checks to block coverage

Set status checks to block coverage values on my pull requests

coverage:
  status:
    project:
      default:
        target: 80%    # the required coverage value
        threshold: 1%  # the leniency in hitting the target

Increase overall coverage on each pull request

Set blocking coverage targets so that each PR must increase coverage

coverage:
  status:
    project:
      default:
        target: auto  # auto compares coverage to the previous base commit

Ease target coverage

Relax my coverage target, because I have flaky tests

coverage:
  status:
    project:
      default:
        target: auto
        # adjust accordingly based on how flaky your tests are
        # this allows a 10% drop from the previous base commit coverage
        threshold: 10%

Ensure all code is covered

Set blocking coverage so that new code must be fully tested

coverage:
  status:
    patch:
      default:
        target: 100%

Set non-blocking status checks

See status checks but prevent them from blocking

coverage:
  status:
    project:
      default:
        informational: true
    patch:
      default:
        informational: true

Change the pull request comment

Change the format of the pull request comment

comment:
  layout: "reach, diff, flags, files"  # Remove items here to change the format

Only comment on coverage changes

  1. Show the comment only on coverage changes
comment:
  require_changes: true

See coverage on CI test failures

Show the Codecov status without waiting for other status checks to complete or pass

codecov:
  require_ci_to_pass: false

Send coverage notifications even if all CI statuses have not completed

Send notifications as soon as possible, even if the CI has not completed or a manual CI workflow step is required.

codecov:
  notify:
    wait_for_ci: false

Isolate my coverage

Isolate coverage based on the coverage report uploads

flags:
  projectA:
    paths: 
      - src/projectA/
  projectB:
    paths:
      - src/projectB/
  
# To see status checks based on flags
coverage:
  status:
    project:
      default:
        flags:
          - projectA
          - projectB
      projectA:
        flags:
          - projectA
      projectB:
        flags:
          - projectB

You will need to assign a flag to each coverage report uploaded. We strongly do not recommend using multiple flags on the same report. Instead, upload the report twice.

##Your Codecov Uploader approach here
##See more at https://docs.codecov.com/docs/codecov-uploader

./codecov  -f coverage.xml -F projectA
./codecov  -f coverage.xml -F projectB

Disable pull request comments

Disable PR comments from Codecov

comment: false