Skip to content

Commit

Permalink
enable Codecov (Lightning-AI#1133)
Browse files Browse the repository at this point in the history
* update config

* try Drone cache

* drop Drone cache

* move import

* remove token
  • Loading branch information
Borda authored and tullie committed Apr 3, 2020
1 parent 963f87a commit 58eaa46
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 32 deletions.
12 changes: 9 additions & 3 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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%
Expand All @@ -16,15 +22,15 @@ 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
# https://github.com/codecov/support/wiki/Patch-Status
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

Expand Down
9 changes: 6 additions & 3 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ 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
- pip --version
- 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
21 changes: 0 additions & 21 deletions docs/source/_static/images/coverage.svg

This file was deleted.

3 changes: 1 addition & 2 deletions pytorch_lightning/trainer/trainer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import inspect
import logging as log
import os
import sys
Expand Down Expand Up @@ -437,8 +438,6 @@ def slurm_job_id(self) -> int:

@classmethod
def default_attributes(cls):
import inspect

init_signature = inspect.signature(Trainer)

args = {}
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

Expand Down

0 comments on commit 58eaa46

Please sign in to comment.