Upload test coverage reports to CodeAnt AI for comprehensive analysis, visualization, and tracking of your code coverage metrics.
- 📊 Upload coverage reports in multiple formats (XML, JSON, LCOV, etc.)
- 🔍 Automatic coverage analysis and insights
- 📈 Track coverage trends over time
- 🎯 Integration with pull requests
- 🚀 Easy setup with minimal configuration
name: Test Coverage
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests with coverage
run: |
# Your test command that generates coverage report
pytest --cov --cov-report=xml
- name: Upload coverage to CodeAnt AI
uses: CodeAnt-AI/codeant-coverage-action@v0.0.1
with:
access_token: ${{ secrets.ACCESS_TOKEN_GITHUB }}
coverage_file: coverage.xml- name: Upload coverage to CodeAnt AI
uses: CodeAnt-AI/codeant-coverage-action@v0.0.1
with:
access_token: ${{ secrets.ACCESS_TOKEN_GITHUB }}
coverage_file: coverage.json
api_base: https://api.codeant.ai
platform: github
base_url: https://github.com| Input | Description | Required | Default |
|---|---|---|---|
access_token |
GitHub Access Token for authentication | Yes | - |
coverage_file |
Path to the coverage file (e.g., coverage.xml, coverage.json) | Yes | coverage.xml |
api_base |
CodeAnt AI API base URL | No | https://api.codeant.ai |
platform |
Git platform (github, gitlab, bitbucket) | No | github |
base_url |
Base URL of the git platform | No | https://github.com |
- Cobertura XML (
.xml) - JaCoCo XML
- LCOV (
.lcov) - JSON coverage reports
- And more...
First, ensure your test suite generates a coverage report. Here are examples for common languages:
pytest --cov --cov-report=xmljest --coverage --coverageReporters=coberturamvn test jacoco:reportgo test -coverprofile=coverage.out ./...
gocov convert coverage.out | gocov-xml > coverage.xmlAdd your CodeAnt AI access token to your repository secrets:
- Go to your repository Settings
- Navigate to Secrets and variables → Actions
- Click "New repository secret"
- Name:
ACCESS_TOKEN_GITHUB - Value: Your CodeAnt AI access token
Add the action to your GitHub Actions workflow as shown in the usage examples above.
- The action fetches the latest coverage upload script from CodeAnt AI
- Decodes and prepares the script for execution
- Uploads your coverage report along with commit and branch information
- CodeAnt AI processes the report and provides analysis
Ensure the coverage_file path is correct and the file exists before running this action.
Verify that your ACCESS_TOKEN_GITHUB is valid and has the necessary permissions.
Check that the CodeAnt AI API is accessible from your runner environment.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- 📧 Email: support@codeant.ai
- 📚 Documentation: https://docs.codeant.ai
- 🐛 Issues: https://github.com/CodeAnt-AI/codeant-coverage-action/issues
- CodeAnt AI - AI-powered code analysis platform
- GitHub Actions Documentation