Skip to content

Commit

Permalink
Add codecov to CI and badges to readme (#32)
Browse files Browse the repository at this point in the history
* Add CI step to generateand upload codecov report

* Temporarly change CI branch to test codecov

* Fix package name given to pytest

* Add codecov badge to README

* Fix badge link

* Change CI action name

* Add codecov badge (for real this time)

The badge I added before was the GitHub action badge not the codecov badge 😫

* Upload report only once per CI job

* Add PyPI badge

* Change branch from dev to master

* Disable codecov PR comments
  • Loading branch information
davidtvs committed Apr 22, 2020
1 parent 1d1e3e7 commit 2345ba2
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 40 deletions.
1 change: 1 addition & 0 deletions .codecov.yml
@@ -0,0 +1 @@
comment: off
39 changes: 0 additions & 39 deletions .github/workflows/ci.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/ci_build.yml
@@ -0,0 +1,46 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: ci-build

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
ci-build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=15 --max-line-length=127 --statistics
- name: Run tests and generate coverage
run: |
pytest --cov=torch_lr_finder --cov-report=xml tests/
- name: Upload coverage to Codecov
if: matrix.python-version == 3.8
uses: codecov/codecov-action@v1
with:
file: ./coverage.xml
flags: unittests
name: codecov-ci
fail_ci_if_error: false
4 changes: 4 additions & 0 deletions README.md
@@ -1,5 +1,9 @@
# PyTorch learning rate finder

![](https://github.com/davidtvs/pytorch-lr-finder/workflows/ci-build/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/davidtvs/pytorch-lr-finder/branch/master/graph/badge.svg)](https://codecov.io/gh/davidtvs/pytorch-lr-finder)
[![](https://img.shields.io/pypi/v/torch-lr-finder)](https://github.com/davidtvs/pytorch-lr-finder)

A PyTorch implementation of the learning rate range test detailed in [Cyclical Learning Rates for Training Neural Networks](https://arxiv.org/abs/1506.01186) by Leslie N. Smith and the tweaked version used by [fastai](https://github.com/fastai/fastai).

The learning rate range test is a test that provides valuable information about the optimal learning rate. During a pre-training run, the learning rate is increased linearly or exponentially between two boundaries. The low initial learning rate allows the network to start converging and as the learning rate is increased it will eventually be too large and the network will diverge.
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -57,9 +57,10 @@
python_requires=">=3.5.9",
install_requires=["matplotlib", "numpy", "torch>=0.4.1", "tqdm"],
extras_require={
"tests": ["pytest"],
"tests": ["pytest", "pytest-cov"],
"dev": [
"pytest",
"pytest-cov",
"flake8",
"black",
"pep8-naming",
Expand Down

0 comments on commit 2345ba2

Please sign in to comment.