Code coverage reporting in CI/CD pipeline
Currently, We do not see any adoption for using code coverage in any of the pipelines. It's very important to maintain good code quality as OSDU platform gets adopted by different vendors/clients.
Observation:
- we do see that there are unit test cases already written but not updated diligently.
- there were issues created long back to have code coverage in OSDU standard pipelines but No action on implementation e.g. here #19 (closed).
- Not all projects have unit test coverage written which shall be standard practice.
Implementation:
- We got to use code coverage in the pipeline itself. We could enable Git lab code coverage in the pipeline Documentation here https://docs.gitlab.com/ee/ci/testing/code_coverage.html
- Get contributions from vendors to make existing unit test cases updated with the current code.
- Circulate standard guidelines to contribute to any project with unit test cases included and up-to-date with at least 80% code coverage.
- Once unit tests are updated keep failures in the pipeline at least at 70%.
tools from git lab documentation can be used:
- gcovr (C/C++)
- JaCoCo (Java/Kotlin)
- pytest-cov (Python)
Edited by Om Prakash Gupta