Skip to content

Commit

Permalink
Add codecov.yml codecov configuration file (#3976)
Browse files Browse the repository at this point in the history
A Codecov configuration file `codecov.yml` is added in the package root.
In it, the following is specified:

  * Upload only if CI passes (I guess this is only true for the CI jobs
    that run pytest in Python 3.5).
  * Add PR comment/status report when two builds have been received i.e.
    when the Python 3.5 pytest jobs have run for both backends in order
    to avoid confusion when only one of the CI jobs have finished and'
    the codecov report is suddenly reporting missing lines.
  * Use default range for coloration 70-100 %
  * Round percentages up (instead of down).
  * Set threshold for failing codecov/project CI status to 0.02% which
    will prevent false positives from failing the build.

The options to report the timings are removed from `pytest.ini` and
moved to the CI test script such that they do not spam developers when
running the tests locally since there is no way to disable this output
dynamically and so it was always being printed.
  • Loading branch information
CasperWA authored Apr 28, 2020
1 parent e8d1c90 commit f7ac506
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ export PYTHONPATH="${PYTHONPATH}:${GITHUB_WORKSPACE}/.ci"
# - pytest-cov configuration taken from top-level .coveragerc
# - coverage is reported as XML and in terminal,
# including the numbers/ranges of lines which are not covered
# - coverage results of multiple tests are collected
# - coverage results of multiple tests (within a single GH Actions CI job) are collected
# - coverage is reported on files in aiida/
export PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --durations=50"
export PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov-config=${GITHUB_WORKSPACE}/.coveragerc"
export PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov-report xml"
export PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov-append"
export PYTEST_ADDOPTS="${PYTEST_ADDOPTS} --cov=aiida"

# daemon tests
verdi daemon start 4
Expand Down
14 changes: 14 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
codecov:
notify:
after_n_builds: 2
wait_for_ci: yes
require_ci_to_pass: yes

coverage:
precision: 2 # default, here for transparency
round: up
range: "70...100" # default, here for transparency
status:
project:
default:
threshold: 0.02%
1 change: 0 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[pytest]
addopts= --durations=50 --cov-config=.coveragerc --cov-report xml --cov=aiida
testpaths = tests
filterwarnings =
ignore::DeprecationWarning:babel:
Expand Down

0 comments on commit f7ac506

Please sign in to comment.