diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..dde96b5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,38 @@ +name: Release + +on: + push: + tags: + - '*' + +jobs: + build: + if: github.repository == 'jazzband/django-invitations' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U setuptools twine wheel + - name: Build package + run: | + python setup.py --version + python setup.py sdist --format=gztar bdist_wheel + twine check dist/* + - name: Upload packages to Jazzband + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@master + with: + user: jazzband + password: ${{ secrets.JAZZBAND_RELEASE_KEY }} + repository_url: https://jazzband.co/projects/django-invitations/upload \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..a57ee4d --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,51 @@ +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 + matrix: + python-version: ['3.5', '3.6', '3.7', '3.8'] + django-version: ['1.1', '2.2', '3.2'] + + 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.cfg') }}-${{ hashFiles('**/tox.ini') }} + 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 }} \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a096a22..0000000 --- a/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -sudo: false -language: python -python: - - 3.5 - - 3.6 - - 3.7 - - 3.8 - -cache: - directories: - - $HOME/.cache/pip - - $TRAVIS_BUILD_DIR/.tox - -install: - - pip install --upgrade pip wheel setuptools - - pip install tox coveralls tox-travis - -script: tox - -after_success: - - coveralls diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ad78220 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +[![Jazzband](https://jazzband.co/static/img/jazzband.svg)](https://jazzband.co/) + +This is a [Jazzband](https://jazzband.co/) project. By contributing you agree to abide by the [Contributor Code of Conduct](https://jazzband.co/about/conduct) and follow the [guidelines](https://jazzband.co/about/guidelines). diff --git a/README.md b/README.md index d4a6c8d..5e46136 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,22 @@ -## Django-invitations - Generic invitations app +# Django-invitations - Generic invitations app +[![Jazzband](https://jazzband.co/static/img/badge.svg)](https://jazzband.co/) +[![PyPI Download](https://img.shields.io/pypi/v/django-invitations.svg)](https://pypi.python.org/pypi/django-invitations) +[![PyPI Python Versions](https://img.shields.io/pypi/pyversions/django-invitations.svg)](https://pypi.python.org/pypi/django-invitations) [![Build Status](https://travis-ci.org/bee-keeper/django-invitations.svg?branch=master)](https://travis-ci.org/bee-keeper/django-invitations) - [![Coverage Status](https://coveralls.io/repos/bee-keeper/django-invitations/badge.svg?branch=master&service=github)](https://coveralls.io/github/bee-keeper/django-invitations?branch=master) -### About +## About + Generic invitations solution with adaptable backend and support for django-allauth. All emails and messages are fully customisable. Originally written as an invitations solution for the excellent [django-allauth](https://github.com/pennersr/django-allauth), this app has been refactored to remove the allauth dependency whilst retaining 100% backwards compatibility. -Generic Invitation flow: - -* Priviledged user invites prospective user by email (via either Django admin, form post, JSON post or programmatically) -* User receives invitation email with confirmation link -* User clicks link and is redirected to a preconfigured url (default is accounts/signup) +## Contributing +As we are members of a [JazzBand project](https://jazzband.co/projects), `django-invitations` contributors should adhere to the [Contributor Code of Conduct](https://jazzband.co/about/conduct). -Allauth Invitation flow: - -* As above but.. -* User clicks link, their email is confirmed and they are redirected to signup -* The signup URL has the email prefilled and upon signing up the user is logged into the site - - -### Generic Installation +## Installation ``` pip install django-invitations @@ -39,6 +32,24 @@ url(r'^invitations/', include('invitations.urls', namespace='invitations')), python manage.py migrate ``` +## Usage + +There are two primary ways to use `django-invitations` described below. + +Generic Invitation flow: + +* Priviledged user invites prospective user by email (via either Django admin, form post, JSON post or programmatically) +* User receives invitation email with confirmation link +* User clicks link and is redirected to a preconfigured url (default is accounts/signup) + +Allauth Invitation flow: + +* As above but.. +* User clicks link, their email is confirmed and they are redirected to signup +* The signup URL has the email prefilled and upon signing up the user is logged into the site + +Further details can be found in the following sections. + ### Allauth Integration As above but note that invitations must come after allauth in the INSTALLED_APPS @@ -150,6 +161,7 @@ The following signals are emitted: ### Management Commands + Expired and accepted invites can be cleared as so: `python manage.py clear_expired_invitations` diff --git a/requirements.txt b/requirements.txt index 44192ec..dfd9619 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +Django>=1.1.* coverage==4.5.4 flake8==3.7.9 freezegun==0.3.12 diff --git a/setup.py b/setup.py index 4b91102..cfcfe0e 100644 --- a/setup.py +++ b/setup.py @@ -14,6 +14,7 @@ download_url='https://github.com/' 'bee-keeper/django-invitations/tarball/1.9.3', keywords=['django', 'invitation', 'django-allauth', 'invite'], + license='GPL-3.0-only', classifiers=[ 'Development Status :: 4 - Beta', 'Intended Audience :: Developers', @@ -25,6 +26,7 @@ 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: GPL-3.0-only', 'Framework :: Django', ], ) diff --git a/tox.ini b/tox.ini index 059ebf5..28f9d7f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,25 +1,35 @@ +[gh-actions] +python = + 3.5: py35 + 3.6: py36 + 3.7: py37 + 3.8: py38, flake8 + +[gh-actions:env] +DJANGO = + 1.1: django111 + 2.2: django22 + 3.2: django32 + [tox] envlist = - py35-django{111}-backend{Basic} - py36-django{111}-backend{Basic} - py37-django{111}-backend{Basic} - py35-django22-backend{Basic,Allauth} - py36-django{22,3}-backend{Basic,Allauth} - py37-django{22,3}-backend{Basic,Allauth} - py38-django{22,3}-backend{Basic,Allauth} + py{35,36,37}-django111-backendBasic + py35-django22-backendAllauth + py{36,37,38}-django32-backend{Basic,Allauth} flake8 [pytest] python_files = tests.py test_*.py [testenv] +description = Unit tests setenv = PYTHONWARNINGS = all deps = -r requirements.txt django111: Django>=1.11.17,<2.0 - django22: Django>=2.2.6 - django3: Django>=3.0.1 + django22: Django>=2.2.6,<3.0 + django32: Django>=3.2,<3.3 backendAllauth: django-allauth commands = python -V @@ -28,6 +38,7 @@ commands = coverage report [testenv:flake8] +description = Static code analysis and code style checker skip_install = True deps=flake8 commands=flake8 invitations --exclude=migrations