Skip to main content

CodeAnt AI Coverage Upload Action

Upload test coverage reports to CodeAnt AI for comprehensive analysis, visualization, and tracking of your code coverage metrics. You can find this action on the GitHub Marketplace.

Features

  • 📊 Upload coverage reports in XML format (Cobertura XML, JaCoCo XML)
  • 🔍 Automatic coverage analysis and insights
  • 📈 Track coverage trends over time
  • 🎯 Integration with pull requests
  • 🚀 Easy setup with minimal configuration

Usage

Connect your repository to CodeAnt before uploading coverage. Save the complete workflow examples in .github/workflows/codeant-coverage.yml, or add the action steps to an existing job with contents: read permission.

Basic Example

.github/workflows/codeant-coverage.yml

Advanced Example

.github/workflows/codeant-coverage.yml

Inputs

Multiple Coverage Files (Monorepo)

When a single commit produces several coverage reports - for example one per service in a monorepo - give each upload its own module and module_path. CodeAnt AI keeps the reports separate so each module is tracked, displayed, and gated independently. Without module, every upload writes to the same key and later steps overwrite earlier ones.
  • module is the logical name shown in the UI (e.g. backend, frontend).
  • module_path is the directory used to resolve source files referenced in the coverage XML (e.g. services/backend). If your XML’s filename attributes are relative to the module root, set module_path to that root.
Instead of duplicating the upload step per module, define it once and fan it out with strategy.matrix. Each matrix entry becomes its own parallel job; adding a new module is one new entry instead of an entire job stanza.
.github/workflows/codeant-coverage.yml
GitHub spawns one job per matrix entry - coverage (backend), coverage (frontend), etc. - and each runs the upload independently with its own module, module_path, and coverage_file.

Alternative: one step per module

If you prefer the explicit form (e.g. each module has a different test command that can’t be parameterized cleanly), call the action once per module:
.github/workflows/codeant-coverage.yml

Supported Coverage Formats

Important: Only XML format is supported for coverage reports.
  • Cobertura XML (.xml)
  • JaCoCo XML

Setup

1. Generate Coverage Report

First, ensure your test suite generates a coverage report. Here are examples for common languages: Python (pytest)
JavaScript/TypeScript (Jest)
Java (Maven)
Go

2. Configure Workflow

Add the action steps shown above. A successful upload reports Coverage data processed.

Coverage config file

You have to create a .coveragerc file in the project’s root folder to include all the source files in the test coverage calculation. Example:
.coveragerc
When you assign source to ”.” , It checks for every python file in the root folder and its sub directories. You can omit some directories by placing them in the omit section of the file.

How it works

With the above configuration:
  1. coverage run -m pytest tests/ will count every .py under the workspace as “valid” lines except for those in the omitted directories.
  2. Lines actually executed by your tests are marked “covered.”
  3. coverage xml -o coverage.xml produces a Cobertura-style report reflecting true coverage over the entire codebase.
  4. Using this coverage xml, we calculate the coverage percentage and the status check will be done on every new push to the branch.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For issues, questions, or contributions, please visit the GitHub repository.

Use a CodeAnt token as a fallback

If the built-in token is unavailable, create a CodeAnt token with the Codeant CI/CD role and repository access. Save it as the GitHub Actions secret CODEANT_TOKEN and replace the input:

Authentication troubleshooting

For 401 or 403, check that the action receives the running job’s GITHUB_TOKEN, the job has contents: read, and the CodeAnt GitHub App has repository access. If using CODEANT_TOKEN, check that it is active and has the Codeant CI/CD role and repository access.