From f6a7a5278a6a105866d1e4463736a5cbaa67ddde Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Sat, 14 Mar 2020 18:01:57 +0100 Subject: [PATCH] enable Codecov (#1133) * update config * try Drone cache * drop Drone cache * move import * remove token --- .codecov.yml | 12 +++++++++--- .drone.yml | 9 ++++++--- README.md | 2 +- docs/source/_static/images/coverage.svg | 21 --------------------- pytorch_lightning/trainer/trainer.py | 3 +-- tox.ini | 4 ++-- 6 files changed, 19 insertions(+), 32 deletions(-) delete mode 100644 docs/source/_static/images/coverage.svg diff --git a/.codecov.yml b/.codecov.yml index 51d32ee8a3..726a198d5a 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -2,9 +2,15 @@ # Validation check: # $ curl --data-binary @.codecov.yml https://codecov.io/validate + +# https://docs.codecov.io/docs/codecovyml-reference codecov: + bot: "codecov-io" + strict_yaml_branch: "yaml-config" + require_ci_to_pass: yes notify: - require_ci_to_pass: yes + # after_n_builds: 2 + wait_for_ci: yes coverage: precision: 0 # 2 = xx.xx%, 0 = xx% @@ -16,7 +22,7 @@ coverage: default: against: auto target: 99% # specify the target coverage for each commit status - threshold: 20% # allow this little decrease on project + threshold: 30% # allow this little decrease on project # https://github.com/codecov/support/wiki/Filtering-Branches # branches: master if_ci_failed: error @@ -24,7 +30,7 @@ coverage: patch: default: against: auto - target: 40% # specify the target "X%" coverage to hit + target: 50% # specify the target "X%" coverage to hit # threshold: 50% # allow this much decrease on patch changes: false diff --git a/.drone.yml b/.drone.yml index 60a6375bbe..4f2259ef2c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -7,6 +7,10 @@ name: torch-GPU steps: - name: testing image: nvcr.io/nvidia/pytorch:20.02-py3 + environment: + SLURM_LOCALID: 0 + CODECOV_TOKEN: + from_secret: codecov_token commands: - python --version - pip install pip -U @@ -14,10 +18,9 @@ steps: - nvidia-smi #- pip install torch==1.3 - pip install -r requirements.txt --user - - pip install coverage pytest pytest-cov pytest-flake8 + - pip install coverage pytest pytest-cov pytest-flake8 codecov - pip install -r ./tests/requirements.txt --user - pip list - - export SLURM_LOCALID=0 - python -c "import torch ; print(' & '.join([torch.cuda.get_device_name(i) for i in range(torch.cuda.device_count())]) if torch.cuda.is_available() else 'only CPU')" - coverage run --source pytorch_lightning -m py.test pytorch_lightning tests pl_examples -v --doctest-modules # --flake8 - - coverage report + - codecov --token $CODECOV_TOKEN # --pr $DRONE_PULL_REQUEST --build $DRONE_BUILD_NUMBER --branch $DRONE_BRANCH --commit $DRONE_COMMIT --tag $DRONE_TAG diff --git a/README.md b/README.md index a9f742e028..ea289d7307 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ [![PyPI Status](https://badge.fury.io/py/pytorch-lightning.svg)](https://badge.fury.io/py/pytorch-lightning) [![PyPI Status](https://pepy.tech/badge/pytorch-lightning)](https://pepy.tech/project/pytorch-lightning) -[![Coverage](docs/source/_static/images/coverage.svg)](https://github.com/PytorchLightning/pytorch-lightning/tree/master/tests#running-coverage) +[![codecov](https://codecov.io/gh/PyTorchLightning/pytorch-lightning/branch/master/graph/badge.svg)](https://codecov.io/gh/PyTorchLightning/pytorch-lightning) [![CodeFactor](https://www.codefactor.io/repository/github/pytorchlightning/pytorch-lightning/badge)](https://www.codefactor.io/repository/github/pytorchlightning/pytorch-lightning) [![ReadTheDocs](https://readthedocs.org/projects/pytorch-lightning/badge/?version=0.7.1)](https://pytorch-lightning.readthedocs.io/en/0.7.1/) diff --git a/docs/source/_static/images/coverage.svg b/docs/source/_static/images/coverage.svg deleted file mode 100644 index 6bfc8faf24..0000000000 --- a/docs/source/_static/images/coverage.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - coverage - coverage - 99% - 99% - - diff --git a/pytorch_lightning/trainer/trainer.py b/pytorch_lightning/trainer/trainer.py index 7668a1f6de..3f6d97091c 100644 --- a/pytorch_lightning/trainer/trainer.py +++ b/pytorch_lightning/trainer/trainer.py @@ -1,3 +1,4 @@ +import inspect import logging as log import os import sys @@ -437,8 +438,6 @@ class Trainer( @classmethod def default_attributes(cls): - import inspect - init_signature = inspect.signature(Trainer) args = {} diff --git a/tox.ini b/tox.ini index 3243beb420..f181bc64dd 100644 --- a/tox.ini +++ b/tox.ini @@ -38,8 +38,8 @@ commands = pip list check-manifest python setup.py check --metadata --strict - flake8 . - coverage run --source pytorch_lightning -m py.test pytorch_lightning tests pl_examples -v --doctest-modules + coverage run --source pytorch_lightning -m py.test pytorch_lightning tests -v --doctest-modules + coverage report python setup.py sdist twine check dist/*