Skip to content
Latchkey

codecov/codecov-action: Upload Coverage Reports

codecov-action uploads your coverage report to Codecov after your tests run.

Generate a coverage file in your test step, then hand it to codecov-action. Use a token for private repos and flags to separate coverage by suite.

Key inputs (with:)

  • token: Codecov upload token (required for private repos).
  • files: explicit coverage file paths.
  • flags: label coverage by test type or package.
  • fail_ci_if_error: fail the job on upload errors.
  • slug: owner/repo override.

Example workflow

.github/workflows/ci.yml
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: pytest --cov=app --cov-report=xml
      - uses: codecov/codecov-action@v4
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: coverage.xml

On any runner

This action runs on any runner. Latchkey managed runners run it unchanged.

Key takeaways

  • Produce a coverage file before calling the action.
  • Private repos require a token; public repos often do not.
  • flags split coverage by suite in the Codecov UI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →