merge request code coverage CLI helper
Description
Checking the code coverage for a given test is today a bit boring. One has to:
- click on the MR,
- download the archive artefacts,
- open the file explorer,
- often, clean the previously extracted artefacts to avoid troubles...
- extract the archive,
- open the extracted files,
- reach the index folder
- find at last the index.html in the middle of thousands of HTML files
Having a CLI written in Python that could automate these steps would be very useful. In a later step, this could be adapted to be run on a server that pushes the page on GitLab pages.
Functional specifications
sight_coverage sight/night 448
Merge-request found.
You can now review the code coverage here:
/home/fbridault/doc/coverage/sight/night/448/index.html
Clicking on the favorite link in your terminal, if it supports it, or just copy&paste in your browser, will give you access to the code coverage of your MR.
Technical specifications
We need a base
directory to configure this. I would advise to use a dedicated user config file for this. You will be asked to do it on the first launch. The program refuses to launch if it is not configured.
Then we just use the GitLab API to download the coverage artefact of the latest pipeline of the MR. If anything goes wrong the user is warned.
The archive is then extracted in the base directory. The archive itself is removed.
Test plan
Manual testing