Skip to content

Resolve "merge request code coverage CLI helper"

Flavien BRIDAULT requested to merge 79-merge-request-code-coverage-cli-helper into dev

Description

A new CLI is available, sight-cov.py. Here is the synopsis:

usage: sight-cov.py [-h] [-d] [--html] repository merge-request

Download the code coverage report from the latest pipeline of a merge-request.

positional arguments:
  repository     Name of the repository: "sight", "night", or any private repository.
  merge-request  Identifier of the merge-request, same as the one present in its URL.

options:
  -h, --help     show this help message and exit
  -d, --diff     Compute the diff of the coverage with the dev branch.
  --html         Html output instead of text.

Results

# ~/dev/sight/sight-git/sight-cov.py -d sight 470 --html 
Downloading merge-request !470 artifacts for project sight...

Coverage report is available at:
file:///home/user/dev/sight/.coverage/sight%21470%23301939/coverage/index.html

Downloading dev branch artifacts for project sight

Diff coverage report is available at:
file:///home/user/dev/sight/.coverage/report.html

How to test it?

The following python packages are required: python-gitlab, pycobertura. Please install it with your favorite package manager.

For python-gitlab to work, a configuration file .python-gitlab.cfg is needed in your home repository:

[global]
default = ircad.fr
ssl_verify = <PATH_TO_IRCAD_CERTIFICATE>
timeout = 10

[ircad.fr]
url = https://git.ircad.fr
private_token = <YOUR_GITLAB_TOKEN_THERE>
api_version = 4

Run the command in the root of one of your git repositories, and try the script with an existing merge-request.

Related issue(s)

Closes #79 (closed)

Edited by Flavien BRIDAULT

Merge request reports