Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to GitHub Actions. #126

Merged
merged 13 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[bumpversion]
current_version = 1.7.1
files = setup.py docs/conf.py
commit = True
tag = True
tag_name = {new_version}
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Release

on:
push:
tags:
- '*'

jobs:
build:
if: github.repository == 'jazzband/django-user-sessions'
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-user-sessions/upload
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
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.6', '3.7', '3.8', '3.9']
django-version: ['2.2', '3.0', '3.1', 'master']
jezdez marked this conversation as resolved.
Show resolved Hide resolved

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 }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/htmlcov/

/.coverage

coverage.xml
/.tox/

/docs/_build/
Expand Down
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Django User Sessions
:target: https://jazzband.co/
:alt: Jazzband

.. image:: https://travis-ci.org/jazzband/django-user-sessions.svg?branch=master
:alt: Build Status
:target: https://travis-ci.org/jazzband/django-user-sessions
.. image:: https://github.com/jazzband/django-user-sessions/workflows/Test/badge.svg
:alt: GitHub Actions
:target: https://github.com/jazzband/django-user-sessions/actions

.. image:: https://codecov.io/gh/jazzband/django-user-sessions/branch/master/graph/badge.svg
:alt: Test Coverage
Expand All @@ -35,7 +35,7 @@ contains the package `django-two-factor-auth`_, but that application is not a
dependency for this package. Also have a look at the bundled example templates
and views to see how you can integrate the application into your project.

Compatible with Django 2.2, 3,0 and 3.1 on Python 3.6, 3.7, 3.8 and 3.9.
Compatible with Django 2.2, 3.0 and 3.1 on Python 3.6, 3.7, 3.8 and 3.9.
Documentation is available at `readthedocs.org`_.


Expand Down
9 changes: 4 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# serve to show the default.

import os
import sys
from pkg_resources import get_distribution

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -54,10 +54,9 @@
#

# The full version, including alpha/beta/rc tags.
release = '1.7.1'

# The short X.Y version.
version = '.'.join(release.split('.')[0:2])
release = get_distribution('django-user-sessions').version
# for example take major/minor
version = '.'.join(release.split('.')[:2])

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
7 changes: 7 additions & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Release Notes
=============

Unreleased
----------
* New: Support for Django 3.0 and 3.1.
jezdez marked this conversation as resolved.
Show resolved Hide resolved
* New: Support for Python 3.9.
* Moved CI to GitHub Actions.
* Dropped Python 3.5 support.

1.7.0
-----
* new: Support for Django 2.2+.
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

setup(
name='django-user-sessions',
version='1.7.1',
use_scm_version={"version_scheme": "post-release"},
setup_requires=["setuptools_scm"],
description='Django sessions with a foreign key to the user',
long_description=open('README.rst').read(),
author='Bouke Haarsma',
Expand All @@ -19,6 +20,7 @@
'Framework :: Django',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
Expand Down
15 changes: 10 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
; Minimum version of Tox
minversion = 1.8
envlist =
py{36,37,38,39}-{dj22,dj30,dj31,djmaster},
py{36,37,38,39}-dj{22,30,31,master}
flake8

[travis]
unignore_outcomes = True
[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38, flake8
3.9: py39

[travis:env]
[gh-actions:env]
DJANGO =
2.2: dj22
3.0: dj30
3.1: dj31
master: djmaster

[testenv]
commands =
commands =
coverage run {envbindir}/django-admin test -v 2 --pythonpath=./ --settings=tests.settings
coverage report
coverage xml
deps =
coverage
dj22: Django<2.3
Expand Down
7 changes: 7 additions & 0 deletions user_sessions/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pkg_resources import get_distribution, DistributionNotFound

try:
__version__ = get_distribution("django-user-sessions").version
except DistributionNotFound:
# package is not installed
__version__ = None