Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1bf6a11b authored by ANDREY Paul's avatar ANDREY Paul
Browse files

Merge branch 'coverage' into 'develop'

Compute coverage as part of CI/CD.

See merge request !38
parents 34779af9 d6fe02b4
No related branches found
No related tags found
1 merge request!38Compute coverage as part of CI/CD.
Pipeline #778598 canceled
...@@ -12,6 +12,11 @@ test: ...@@ -12,6 +12,11 @@ test:
script: script:
- pip install -U tox - pip install -U tox
- tox -e py38 - tox -e py38
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
rules: rules:
- if: ($CI_PIPELINE_SOURCE == "push") && - if: ($CI_PIPELINE_SOURCE == "push") &&
(($CI_COMMIT_BRANCH == "develop") || ($CI_COMMIT_BRANCH =~ "/^r\d\.\d+/")) (($CI_COMMIT_BRANCH == "develop") || ($CI_COMMIT_BRANCH =~ "/^r\d\.\d+/"))
...@@ -26,6 +31,11 @@ test-full: ...@@ -26,6 +31,11 @@ test-full:
script: script:
- pip install -U tox - pip install -U tox
- tox -e py38 -- --fulltest - tox -e py38 -- --fulltest
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
rules: rules:
- if: ($CI_PIPELINE_SOURCE == "merge_request_event") && - if: ($CI_PIPELINE_SOURCE == "merge_request_event") &&
($CI_MERGE_REQUEST_TITLE !~ /^Draft:.*/) ($CI_MERGE_REQUEST_TITLE !~ /^Draft:.*/)
......
...@@ -86,6 +86,7 @@ tests = [ ...@@ -86,6 +86,7 @@ tests = [
"pylint >= 2.14", "pylint >= 2.14",
"pytest >= 6.1", "pytest >= 6.1",
"pytest-asyncio", "pytest-asyncio",
"pytest-cov >= 4.0",
] ]
[project.urls] [project.urls]
...@@ -96,6 +97,21 @@ repository = "https://gitlab.inria.fr/magnet/declearn/declearn2.git" ...@@ -96,6 +97,21 @@ repository = "https://gitlab.inria.fr/magnet/declearn/declearn2.git"
line-length = 79 line-length = 79
extend-exclude = "(.*_pb2.*py$)" # exclude auto-generated protobuf code files extend-exclude = "(.*_pb2.*py$)" # exclude auto-generated protobuf code files
[tool.coverage.run]
# enable coverage collection within multiprocessing
concurrency = ["multiprocessing"]
parallel = true
sigterm = true
# define rules to select the code files that need covering
source_pkgs = ["declearn"]
omit = [
"**/grpc/protobufs/*.py", # auto-generated rotobuf code files
"**/test_utils/*.py", # dev-only test-oriented utils
]
[tool.coverage.paths]
source = ["declearn", ".tox/**/declearn"]
[tool.mypy] [tool.mypy]
exclude = [".*_pb2.*.py$"] exclude = [".*_pb2.*.py$"]
follow_imports = "skip" # otherwise excluded files are checked follow_imports = "skip" # otherwise excluded files are checked
......
...@@ -12,11 +12,15 @@ allowlist_externals = ...@@ -12,11 +12,15 @@ allowlist_externals =
commands= commands=
# run unit tests first # run unit tests first
pytest {posargs} \ pytest {posargs} \
--cov --cov-report= \ # reset then accumulate coverage quietly
--ignore=test/functional/ \ --ignore=test/functional/ \
test test
# run functional tests (that build on units) # run functional tests (that build on units)
pytest {posargs} \ pytest {posargs} \
--cov --cov-append --cov-report=term \ # acc. and display coverage
test/functional/ test/functional/
# export the finalized coverage report to xml
coverage xml
# verify code acceptance by pylint # verify code acceptance by pylint
pylint declearn pylint declearn
pylint --recursive=y test pylint --recursive=y test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment