From f7ac506815ef09026c5b3f3e2c5bd7d96f09a99d Mon Sep 17 00:00:00 2001 From: Casper Welzel Andersen <43357585+CasperWA@users.noreply.github.com> Date: Tue, 28 Apr 2020 14:45:28 +0200 Subject: [PATCH] Add codecov.yml codecov configuration file (#3976) 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. --- .github/workflows/tests.sh | 6 +++++- codecov.yml | 14 ++++++++++++++ pytest.ini | 1 - 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/tests.sh b/.github/workflows/tests.sh index 3aff3b28f9..66ad9b5e76 100755 --- a/.github/workflows/tests.sh +++ b/.github/workflows/tests.sh @@ -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 diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..ce1468c19b --- /dev/null +++ b/codecov.yml @@ -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% diff --git a/pytest.ini b/pytest.ini index c5128a6476..c8f247074f 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,4 @@ [pytest] -addopts= --durations=50 --cov-config=.coveragerc --cov-report xml --cov=aiida testpaths = tests filterwarnings = ignore::DeprecationWarning:babel: