From 0d681a4fd25af2a1acdd0a98df9360a7df43b801 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleksi=20H=C3=A4kli?= Date: Fri, 14 Jan 2022 21:03:33 +0200 Subject: [PATCH] Update Python and Django versions and CI setup Migrate from TravisCI to GitHub Actions Add dependabot configuration for automatic pakcageu pdates Update test setup to include QA and doc runs in main tox file Update requirements and move them into a single requirements.txt file --- .github/dependabot.yml | 8 ++++ .github/workflows/test.yml | 80 +++++++++++++++++++++++++++++++++++++ .gitignore | 2 + .travis.yml | 25 ------------ Makefile | 4 +- README.md | 12 ++++-- pytest.ini | 3 +- requirements.txt | 8 ++++ requirements_test.txt | 5 --- setup.py | 48 +++++++++------------- tox.ini | 82 ++++++++++++++++++++++++-------------- 11 files changed, 181 insertions(+), 96 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml create mode 100644 requirements.txt delete mode 100644 requirements_test.txt diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2ba83e6 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: +- package-ecosystem: "pip" + directory: "/" + schedule: + interval: "daily" + time: "12:00" + open-pull-requests-limit: 10 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..74bea64 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,80 @@ +name: Test + +on: [push, pull_request] + +jobs: + build: + name: build (Python ${{ matrix.python-version }}, Django ${{ matrix.django-version }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 5 + matrix: + python-version: ['3.7', '3.8', '3.9', '3.10', 'pypy-3.8'] + django-version: ['2.2', '3.2'] + include: + # Tox configuration for documentation environment + - python-version: '3.7' + django-version: 'docs' + # Tox configuration for QA environment + - python-version: '3.7' + django-version: 'qa' + # # Django 4.0 + # - python-version: '3.8' + # django-version: '4.0' + # - python-version: '3.9' + # django-version: '4.0' + # - python-version: '3.10' + # django-version: '4.0' + # # Django main + # - python-version: '3.8' + # django-version: 'main' + # experimental: true + # - python-version: '3.9' + # django-version: 'main' + # experimental: true + # - python-version: '3.10' + # django-version: 'main' + # experimental: true + exclude: + # Exclude Django main branch for Python 3.7 as it is not supported + - python-version: '3.7' + django-version: 'main' + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: Cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + ${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ matrix.python-version }}-v1- + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade tox tox-gh-actions + + - name: Tox tests + run: | + tox -v + env: + DJANGO: ${{ matrix.django-version }} + + - name: Upload coverage + uses: codecov/codecov-action@v1 + with: + name: Python ${{ matrix.python-version }} diff --git a/.gitignore b/.gitignore index ade228a..7742ebc 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ dist/ /.idea /.vscode /venv +coverage.xml +.eggs/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ac58d8a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,25 +0,0 @@ -language: python -python: 3.6 - -cache: - directories: - - $HOME/.pip-cache/ - -env: - - TOX_ENV=py36-111 - - TOX_ENV=py36-21 - - TOX_ENV=py36-22 - - TOX_ENV=py36-master - - TOX_ENV=docs - - TOX_ENV=flake8 - -matrix: - allow_failures: - - env: TOX_ENV=py36-master - fast_finish: true - -install: - - pip install tox --cache-dir $HOME/.pip-cache - -script: - - tox -e $TOX_ENV diff --git a/Makefile b/Makefile index 1b1f8ce..3a40063 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ coverage: - py.test --cov-report html --cov-report term-missing --cov recurrence + pytest test: - py.test + pytest testall: tox diff --git a/README.md b/README.md index 6985e0b..e108afe 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ # django-recurrence -[![Build Status](https://travis-ci.org/django-recurrence/django-recurrence.svg?branch=master)](https://travis-ci.org/django-recurrence/django-recurrence) +[![GitHub](https://img.shields.io/github/stars/django-recurrence/django-recurrence.svg?label=Stars&style=socialcA)](https://github.com/jazzband/django-recurrence) +[![PyPI releases](https://img.shields.io/pypi/v/django-recurrence.svg)](https://pypi.org/project/django-recurrence/) +[![Supported Python versions](https://img.shields.io/pypi/pyversions/django-recurrence.svg)](https://pypi.org/project/django-recurrence/) +[![Supported Django versions](https://img.shields.io/pypi/djversions/django-recurrence.svg)](https://pypi.org/project/django-recurrence/) +[![Documentation](https://img.shields.io/readthedocs/django-recurrence.svg)](https://django-recurrence.readthedocs.io/) +[![GitHub Actions](https://github.com/django-recurrence/django-recurrence/workflows/Test/badge.svg)](https://github.com/django-recurrence/django-recurrence/actions) +[![Coverage](https://codecov.io/gh/django-recurrence/django-recurrence/branch/master/graph/badge.svg)](https://codecov.io/gh/django-recurrence/django-recurrence) django-recurrence is a utility for working with recurring dates in Django. Documentation is available at -https://django-recurrence.readthedocs.org/. - -**Django-recurrence is unmaintained** and looking for a maintainer to take over the project. (You may wish to open an issue, reply on [this thread](https://github.com/django-recurrence/django-recurrence/pull/182#issuecomment-784467431) or reach out on [Twitter](https://twitter.com/dominicrodger/).) +https://django-recurrence.readthedocs.io/. It provides: diff --git a/pytest.ini b/pytest.ini index 66886cb..ca03988 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,4 @@ [pytest] DJANGO_SETTINGS_MODULE = tests.settings -addopts = --tb=short +addopts = --cov recurrence --cov-append --cov-branch --cov-report term-missing --cov-report=xml +testpaths = tests diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4f3ce97 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +flake8==4.0.1 +pytest-cov==3.0.0 +pytest-django==4.5.2 +pytest-sugar==0.9.4 +pytest==6.2.5 +sphinx==4.3.2 +sphinx_rtd_theme==1.0.0 +tox==3.24.5 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index d1041c3..0000000 --- a/requirements_test.txt +++ /dev/null @@ -1,5 +0,0 @@ -pytest==5.0.1 -pytest-cov==2.7.1 -pytest-django==3.5.1 -pytest-sugar==0.9.2 -tox==3.13.2 diff --git a/setup.py b/setup.py index 331dd7f..7ac2d07 100644 --- a/setup.py +++ b/setup.py @@ -1,52 +1,43 @@ import os -import sys from setuptools import setup -from setuptools.command.test import test as TestCommand - - -class PyTest(TestCommand): - def finalize_options(self): - self.test_args = [] - self.test_suite = True - - super().finalize_options() - - def run_tests(self): - import pytest - - errno = pytest.main(self.test_args) - sys.exit(errno) - - -with open("README.md", "r") as fh: - long_description = fh.read() - setup( name="django-recurrence", - version="1.10.3", + use_scm_version=True, license="BSD", description="Django utility wrapping dateutil.rrule", - long_description=long_description, + long_description=open("README.md", encoding="utf-8").read(), long_description_content_type="text/markdown", author="Tamas Kemenczy", author_email="tamas.kemenczy@gmail.com", url="https://github.com/django-recurrence/django-recurrence", - classifiers=( + classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", + "Environment :: Plugins", + "Framework :: Django", "Framework :: Django", + "Framework :: Django :: 2.2", + "Framework :: Django :: 3.2", + # "Framework :: Django :: 4.0", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", - ), - install_requires=("Django", "pytz", "python-dateutil"), - packages=("recurrence", "recurrence.migrations"), + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + ], + python_requires=">=3.7", + install_requires=["django>=2.2,<4.0", "pytz", "python-dateutil"], + setup_requires=["setuptools_scm"], + packages=["recurrence", "recurrence.migrations"], package_dir={"recurrence": "recurrence"}, package_data={ "recurrence": [ @@ -59,5 +50,4 @@ def run_tests(self): }, zip_safe=False, include_package_data=True, - cmdclass={"test": PyTest}, ) diff --git a/tox.ini b/tox.ini index a33960a..fbe8a41 100644 --- a/tox.ini +++ b/tox.ini @@ -1,37 +1,59 @@ [tox] -envlist = {py36,py37}-{111,21,22,master},docs,flake8 +envlist = + py37-djdocs + py37-djqa + py{37,38,39,310,py38}-dj22 + py{37,38,39,310,py38}-dj32 + # py{38,39,310,py38}-dj40 + # py{38,39,310,py38}-djmain + +[gh-actions] +python = + 3.7: py37 + 3.8: py38 + 3.9: py39 + 3.10: py310 + pypy-3.8: pypy38 + +[gh-actions:env] +DJANGO = + docs: djdocs + qa: djqa + 2.2: dj22 + 3.2: dj32 + # 4.0: dj40 + # main: djmain [testenv] -basepython = - py36: python3.6 - py37: python3.7 -deps= - -r requirements_test.txt - 111: django>=1.11,<1.12 - 21: django>=2.1,<2.2 - 22: django>=2.2,<2.3 - master: https://github.com/django/django/archive/master.tar.gz -commands=python setup.py test +usedevelop = true +setenv = + PYTHONDONTWRITEBYTECODE=1 +deps = + -r requirements.txt + dj22: django>=2.2,<2.3 + dj32: django>=3.2,<3.3 + # dj40: django>=4.0,4.1 + # djmain: https://github.com/django/django/archive/main.tar.gz +commands = + pytest -[testenv:docs] -basepython=python -changedir=docs -deps= - sphinx - sphinx_rtd_theme -whitelist_externals = echo -commands= - sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html - echo "" - echo "The built documentation is available in {envtmpdir}/html" +[testenv:py37-djqa] +basepython = python3.7 +ignore_errors = true +deps = + -r requirements.txt +commands = + flake8 recurrence + flake8 setup.py + flake8 tests -[testenv:flake8] -basepython=python -deps=flake8==2.1.0 -commands= - flake8 recurrence - flake8 setup.py - flake8 tests +[testenv:py37-djdocs] +basepython = python3.7 +changedir = docs +deps = + -r requirements.txt +commands = + sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html [flake8] -ignore = E122,E125,E129,E501 +ignore = E122,E125,E129,E501,W503,W504