diff --git a/.coveragerc b/.coveragerc index 188cbaf..d908e8e 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,6 +2,7 @@ source = result omit = + setup.py result/typetests.py [report] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..87e30a8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,58 @@ +on: + push: + branches: + - master + pull_request: + +name: CI + +jobs: + + test: + runs-on: ubuntu-latest + strategy: + matrix: + python: + - '3.5' + - '3.6' + - '3.7' + - '3.8' + name: Python ${{ matrix.python }} + steps: + # Python + - name: Setup python ${{ matrix.python }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python }} + + # Check out code + - uses: actions/checkout@v2 + + # Cached dependencies + - uses: actions/cache@v1 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-py${{ matrix.python }}-${{ hashFiles('**/requirements-dev.txt') }} + restore-keys: | + ${{ runner.os }}-pip-py${{ matrix.python }}- + - name: Install dev dependencies + run: pip install -r requirements-dev.txt + + # Install library + - name: Install result + run: pip install -e . + + # Tests + - name: Run tests + run: pytest --cov-report term --cov-report xml:coverage.xml + - name: Run mypy on result.py + run: mypy result/result.py + - name: Run typetests + run: mypy result/typetests.py + + # Coverage + - name: Upload coverage to codecov.io + uses: codecov/codecov-action@v1 + if: matrix.python == '3.8' + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore index 88728f9..5a03d25 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .cache/ .coverage +coverage.xml *.swp *.pyc __pycache__ @@ -8,3 +9,4 @@ dist/ build/ .idea/ .mypy_cache/ +venv/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d80972c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: python -dist: xenial -python: - - 3.4 - - 3.5 - - 3.6 - - 3.7 -install: - - pip install -r requirements-dev.txt - - pip install coveralls -script: - - pip install -e . - - py.test - - if [ $(python -c 'import sys; print(sys.version_info.minor)') -gt 4 ]; then - mypy result/result.py; - mypy result/typetests.py; - echo "Mypy tests done"; - else - echo "Skipping mypy"; - fi -after_success: - - coveralls diff --git a/CHANGELOG.md b/CHANGELOG.md index 91bc97d..eae0e45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ Possible log types: ## Unreleased -... +- [deprecated] Python 3.4 support is deprecated and will be removed in the next + release ## [0.5.0] - 2020-03-03 diff --git a/README.rst b/README.rst index 03181fb..62c5a16 100644 --- a/README.rst +++ b/README.rst @@ -1,13 +1,13 @@ Result ====== -.. image:: https://img.shields.io/travis/dbrgn/result/master.svg - :alt: Build status - :target: https://travis-ci.org/dbrgn/result +.. image:: https://img.shields.io/github/workflow/status/dbrgn/result/CI/master + :alt: GitHub Workflow Status (branch) + :target: https://github.com/dbrgn/result/actions?query=workflow%3ACI+branch%3Amaster -.. image:: https://img.shields.io/coveralls/dbrgn/result/master.svg +.. image:: https://codecov.io/gh/dbrgn/result/branch/master/graph/badge.svg :alt: Coverage - :target: https://coveralls.io/github/dbrgn/result + :target: https://codecov.io/gh/dbrgn/result A simple Result type for Python 3 `inspired by Rust `__, fully type annotated. diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..a5623e4 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,13 @@ +coverage: + precision: 2 + round: nearest + range: "80...100" + status: + project: + default: + target: 85% + threshold: 3% +comment: + layout: "diff, flags, files" + behavior: default + require_changes: yes diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 4a7b375..0000000 --- a/pytest.ini +++ /dev/null @@ -1,12 +0,0 @@ -[pytest] -addopts = --pep8 --tb=short --cov -python_files = tests.py -norecursedirs = *.egg tmp* build .tox -pep8ignore = - *.py E126 E127 E128 - setup.py ALL - */tests/* ALL - */docs/* ALL - */build/* ALL - */TOXENV/* ALL -pep8maxlinelength = 99 diff --git a/requirements-dev.txt b/requirements-dev.txt index f023f7b..4773fab 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,4 +1,4 @@ -pytest==2.8.5 -pytest-cov==2.2.0 -pytest-pep8==1.0.6 +pytest>=5,<6 +pytest-cov>=2.8,<3 +pytest-flake8>=1,<2 mypy==0.720 diff --git a/setup.cfg b/setup.cfg index 0c9e0fc..9fef5ce 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,16 @@ [metadata] license_file = LICENSE + +[tool:pytest] +addopts = --flake8 --tb=short --cov=. +python_files = tests.py +norecursedirs = *.egg tmp* build .tox +flake8-ignore = + *.py E126 E127 E128 W504 F811 # Note: Remove F811 after the next flake8 upgrade + setup.py ALL + */tests/* ALL + */docs/* ALL + */build/* ALL + */venv/* ALL + */TOXENV/* ALL +flake8-max-line-length = 99 diff --git a/setup.py b/setup.py index 12d190f..624b964 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,6 @@ 'Development Status :: 4 - Beta', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7',