Skip to content

Commit 2345ba2

Browse files
authored
Add codecov to CI and badges to readme (#32)
* 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
1 parent 1d1e3e7 commit 2345ba2

File tree

5 files changed

+53
-40
lines changed

5 files changed

+53
-40
lines changed

.codecov.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
comment: off

.github/workflows/ci.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/ci_build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: ci-build
5+
6+
on:
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
11+
12+
jobs:
13+
ci-build:
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
python-version: [3.5, 3.6, 3.7, 3.8]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python ${{ matrix.python-version }}
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: ${{ matrix.python-version }}
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install -e .[tests]
29+
- name: Lint with flake8
30+
run: |
31+
pip install flake8
32+
# stop the build if there are Python syntax errors or undefined names
33+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
34+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
35+
flake8 . --count --exit-zero --max-complexity=15 --max-line-length=127 --statistics
36+
- name: Run tests and generate coverage
37+
run: |
38+
pytest --cov=torch_lr_finder --cov-report=xml tests/
39+
- name: Upload coverage to Codecov
40+
if: matrix.python-version == 3.8
41+
uses: codecov/codecov-action@v1
42+
with:
43+
file: ./coverage.xml
44+
flags: unittests
45+
name: codecov-ci
46+
fail_ci_if_error: false

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# PyTorch learning rate finder
22

3+
![](https://github.com/davidtvs/pytorch-lr-finder/workflows/ci-build/badge.svg?branch=master)
4+
[![codecov](https://codecov.io/gh/davidtvs/pytorch-lr-finder/branch/master/graph/badge.svg)](https://codecov.io/gh/davidtvs/pytorch-lr-finder)
5+
[![](https://img.shields.io/pypi/v/torch-lr-finder)](https://github.com/davidtvs/pytorch-lr-finder)
6+
37
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).
48

59
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.

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,10 @@
5757
python_requires=">=3.5.9",
5858
install_requires=["matplotlib", "numpy", "torch>=0.4.1", "tqdm"],
5959
extras_require={
60-
"tests": ["pytest"],
60+
"tests": ["pytest", "pytest-cov"],
6161
"dev": [
6262
"pytest",
63+
"pytest-cov",
6364
"flake8",
6465
"black",
6566
"pep8-naming",

0 commit comments

Comments
 (0)