Skip to content

Coverage in CI #758

@BDonnot

Description

@BDonnot

It would be good to have:

  1. assessment of the full coverage in CI, when a new release is made
  2. assment of the branch coverage before a branch is merged (and preventing the merge is the coverage falls bellow a certain threshold)

The blocking point is that the full CI takes a long time and is split into different places (circle ci, github actions etc.)

A possible implementation would be to:

  1. have circleci generate some coverage with unique names

̀yaml

  • run:
    name: Run tests (shard N)
    command: |
    python -m pytest grid2op/tests/
    --cov=grid2op
    --cov-branch
    --cov-report= \ # no report yet, just raw data
    --cov-append
    -p no:randomly # keep shards deterministic
    mv .coverage .coverage.shard_$CIRCLE_NODE_INDEX
    ̀
  1. then combine everything :

̀yaml

  • run:
    name: Merge and report coverage
    command: |
    pip install coverage
    coverage combine .coverage.shard_* # merges all partial files
    coverage report --branch --fail-under=80
    coverage xml -o coverage.xml
    ̀

A problem is that it does not take into account github.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions