Status: Not currently used Reason: Project has 1 developer, local coverage sufficient
This guide is preserved for future reference if the project grows and external coverage reporting becomes valuable.
For a single-developer project:
- ✅ Local HTML coverage reports are sufficient
- ✅ No need for PR coverage comments (you see it locally)
- ✅ GitHub Actions can display coverage in logs
- ✅ Saves setup time and external dependencies
When to reconsider:
- Multiple active contributors
- Need for coverage trends over time
- Want PR-based coverage diff comments
- Public repo with community contributions
- Go to https://codecov.io
- Sign up with GitHub account
- Grant access to
pwsh-profilerepository
- Navigate to repository settings in Codecov
- Copy the
CODECOV_TOKEN - Add to GitHub repository secrets:
- Go to: https://github.com/zentala/pwsh-profile/settings/secrets/actions
- Click "New repository secret"
- Name:
CODECOV_TOKEN - Value: [paste token]
Add to .github/workflows/tests.yml:
- name: Upload coverage to Codecov
if: matrix.os == 'windows-latest' && matrix.powershell == '7.4'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./tests/Coverage/coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false[](https://codecov.io/gh/zentala/pwsh-profile)Create codecov.yml in repository root:
coverage:
status:
project:
default:
target: 75%
threshold: 2%
patch:
default:
target: 80%
comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: false
ignore:
- "tests/**"
- "**/*.Tests.ps1"Recommended approach for now:
Display coverage directly in GitHub Actions logs:
- name: Display Coverage Summary
run: |
$coverage = [xml](Get-Content tests/Coverage/coverage.xml)
$lineRate = $coverage.coverage.LineRate
$percent = [math]::Round($lineRate * 100, 2)
Write-Host "📊 Code Coverage: $percent%" -ForegroundColor CyanStore coverage as artifact:
- name: Upload Coverage Report
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: tests/Coverage/| Solution | Cost | Setup Time | Features |
|---|---|---|---|
| Local only | Free | 0 min | Basic coverage, HTML reports |
| GH Actions | Free | 15 min | Coverage in logs, artifacts |
| Codecov | Free (public repos) | 30 min | Trends, badges, PR comments |
For oh-my-pwsh:
- Use local coverage reports (
./scripts/Show-Coverage.ps1) - Display coverage in GitHub Actions logs
- Store coverage as artifacts in CI
- Revisit Codecov if project scales
- TESTING-STRATEGY.md - Overall testing strategy
- ADR-003 - Coverage targets decision
- Task 005 - Testing infrastructure implementation