# Codecov

- Section: Documentation > Integrations > Codecov
- Canonical: https://covdbg.com/docs/integrations/codecov/

---

[Codecov](https://codecov.io) (by Sentry) is a coverage reporting service that integrates with GitHub, GitLab, and Bitbucket. It visualizes code coverage, tracks trends over time, and provides coverage feedback directly on pull requests.

covdbg outputs LCOV format, which Codecov supports natively. This makes integration straightforward—generate an LCOV file from your coverage run and upload it to Codecov.

## Prerequisites

1. Create an account at [codecov.io](https://codecov.io)
2. Add your repository to Codecov
3. Copy your upload token and add it as a repository secret named `CODECOV_TOKEN`

## Basic Usage

For simple projects where all code is exercised through tests, you only need to run tests and upload.

### Step 1: Run Tests with Coverage

```yaml
- name: Run tests with coverage
  run: covdbg --output coverage.covdb --config .covdbg.yaml tests.exe
```

### Step 2: Convert to LCOV

```yaml
- name: Convert to LCOV
  run: covdbg convert --input coverage.covdb --format LCOV --output coverage.lcov
```

### Step 3: Upload to Codecov

```yaml
- name: Upload coverage to Codecov
  uses: codecov/codecov-action@v5
  with:
    files: coverage.lcov
  env:
    CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
```

## Advanced Usage

For projects with static libraries, multiple binaries, or code that isn't directly executed by tests, you'll want to include uncovered lines in your report. The `analyze` command extracts all coverable lines from binaries, ensuring code that was never executed still appears as uncovered (rather than being omitted entirely).

### Step 1: Run Tests with Coverage

```yaml
- name: Run tests with coverage
  run: covdbg --output tests.covdb --config .covdbg.yaml tests.exe
```

### Step 2: Analyze Binaries for Uncovered Code

Extract symbol information from your application binaries. This captures all coverable lines, including code in static libraries that tests may not exercise:

```yaml
- name: Analyze binaries
  run: |
    covdbg analyze --input app.exe --output app.covdb --config .covdbg.yaml
    covdbg analyze --input app-ui.exe --output app-ui.covdb --config .covdbg.yaml
```

### Step 3: Merge Coverage Databases

Combine the test coverage with the symbol databases:

```yaml
- name: Merge coverage databases
  run: covdbg merge --input tests.covdb --input app.covdb --input app-ui.covdb --output merged.covdb
```

### Step 4: Convert to LCOV

```yaml
- name: Convert to LCOV
  run: covdbg convert --input merged.covdb --format LCOV --output coverage.lcov
```

### Step 5: Upload to Codecov

```yaml
- name: Upload coverage to Codecov
  uses: codecov/codecov-action@v5
  with:
    files: coverage.lcov
  env:
    CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
```

## What You Get

Once configured, Codecov provides coverage feedback on every pull request, tracks how coverage changes over time, and offers a dashboard to explore coverage at the file and line level. Visit [codecov.io](https://codecov.io) to configure thresholds, notifications, and other project settings.
