Commit fbce21d
authored
Add comprehensive code coverage and test reporting to CI/CD (#423)
* feat: add comprehensive code coverage and test reporting to CI/CD
Add comprehensive testing infrastructure with code coverage tracking:
Just Recipes:
- test-coverage: Run tests with coverage, merge profiles, show summary
- test-junit: Run tests with JUnit XML output using gotestsum
CI/CD Enhancements:
- Generate coverage on all test runs with atomic coverage mode
- Upload coverage artifacts and test results
- Publish test summaries using test-summary/action v2.4
- Add coverage-report job for PR comments with fgrosse/go-coverage-report
- Continue uploading to Codecov for historical tracking
Configuration:
- Add coverage/, coverage.out, test-results/ to .gitignore
- Update test job to use test-junit recipe for comprehensive reporting
Documentation:
- Add Testing and Code Coverage section to morphir-go-preview.md
- Document local testing commands and coverage workflows
- Explain CI/CD integration and PR coverage comments
- Include emoji indicators for coverage changes
Benefits:
- Track code coverage trends over time
- See coverage impact directly in PR reviews
- Better visibility into test results with GitHub Actions summaries
- Identify untested code paths
- Automated test result reports
Relates to morphir-rnt
* fix: create coverage directory before running tests in test-junit
The test-junit recipe was failing because the coverage directory didn't
exist when tests tried to write coverage files. Now we create both
test-results and coverage directories upfront.
Also added coverage merging step to test-junit recipe to generate
the final coverage.out file that CI expects.
* fix: use absolute paths for coverage and test-results directories
The test-junit and test-coverage recipes were failing because they used
relative paths (../coverage/) which don't work correctly when cd'ing into
subdirectories. When in cmd/morphir, ../coverage/ points to morphir/cmd/coverage/
instead of morphir/coverage/.
Now we capture the repo root path upfront and use absolute paths for all
coverage and test result file locations.
* fix: allow coverage-report job to continue if baseline doesn't exist
The coverage-report job fails when trying to download baseline coverage
from the main branch if it doesn't exist yet (which is expected for the
first time adding coverage support). Adding continue-on-error allows the
job to proceed gracefully without failing the entire CI run.
Once this PR is merged and main has coverage artifacts, future PRs will
be able to compare against the baseline.1 parent b66afdc commit fbce21d
File tree
5 files changed
+256
-53
lines changed- .beads
- .github/workflows
- docs
5 files changed
+256
-53
lines changed
0 commit comments