Codecov

Code coverage done right.®

Welcome to Codecov Documentation. You'll find comprehensive guides and documentation to help you start working with Codecov as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started

Notifications

Notice about delayed notifications

Codecov delays notifications to make sure all reports are uploaded. Learn more at Merging Reports.

Customization of pull request comments?

If you are looking to customize your comments, including turning them off, please see Pull Request Comments

Slack

Below is a basic configuration for adding a Slack notification.

coverage:
  notify:
    slack:
      default:
        url: "https://hooks.slack.com/services/abc/123"
        threshold: 1%
			  only_pulls: false
        branches: null
        flags: null
				paths: null

Create a Slack Webhook URL

  1. Navigate to https://slack.com/apps.
  2. Search for incoming webhook and click on the Incoming WebHooks result.
  3. Click Add Configuration.
  4. Follow the instructions to select a room and click Add Incoming Webhooks Integration.
  5. Copy the Webhook URL into your yaml.

Gitter

Here is demonstrated the basic configuration for adding a Gitter notification.

coverage:
  notify:
    gitter:
      default:
        url: "https://webhooks.gitter.im/e/9d1957r0a481787c756z"
        threshold: 1%
			  only_pulls: false
        branches: null
        flags: null
				paths: null

Create a Gitter Integration URL

  1. Navigate to your room in Gitter. ex. https://gitter.im/codecov/support.
  2. Click Room Settings icon (top-right corner).
  3. Click Integrations from the dropdown.
  4. Click on Codecov from the integration list.
  5. Copy the webhook url into your yaml.

Hipchat

Below is the basic configuration for adding a Hipchat notification.

coverage:
  notify:
    hipchat:
      default:
        url: ""
        threshold: 1%
			  only_pulls: false
        branches: null
        flags: null
				paths: null

Create a Hipchat Webhook URL

  1. Login to your HipChat home: https://TEAM.hipchat.com/home.
  2. Click Rooms tab.
  3. Select the room you wish to post the notification to.
  4. Click the Tokens tab.
  5. Create a new token with Send Notification permission. Label it Codecov.
  6. Copy the token into this url, as seen below.
coverage:
  notify:
    hipchat:
      default:
        # replace ROOM_ID_OR_NAME and ROOM_TOKEN below
        url: "https://api.hipchat.com/v2/room/ROOM_ID_OR_NAME/notification?auth_token=ROOM_TOKEN"
			  only_pulls: false
        branches: null
        flags: null
				paths: null

Advanced Configuration

All Codecov notifications can be customized. The advanced configuration shown below can be applied to any of the notifications services.

Multiple Notifications

You may create additional notifications that post to different channels with different coverage metrics.

coverage:
  notify:
    slack:
      frontui:
        url: "https://hooks.slack.com/services/T04KHQ16W/B225J94BG"
        flags:
          - frontend
          - ui
	    backunit:
        url: "https://hooks.slack.com/services/T04KHQ16W/B225J94BG"
        threshold: 2%  # allow coverage to drop by 2% without posting a notification
        flags:
          - backend

Notice how we added two unique notifications. Each of them are measuring different reports based on Flags.

Preventing notifications until after N builds

You may want to prevent any notifications until after a known number of builds. In this case, the Codecov YAML allows you to set notification paramaters as follows:

coverage:
    notify:
        after_n_builds: 5
# do not notify until at least 5 builds have been uploaded from the CI pipeline

In this YAML, at least 5 builds would need to be received before Codecov would push a notification.

Notifications


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.