Skip to content

Commit

Permalink
Add GitHub Actions integration
Browse files Browse the repository at this point in the history
  • Loading branch information
mvantellingen committed Mar 8, 2020
1 parent 6a30df4 commit 58e6120
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 119 deletions.
11 changes: 11 additions & 0 deletions .bumpversion.cfg
@@ -0,0 +1,11 @@
[bumpversion]
current_version = 0.1.0
commit = true
tag = true
tag_name = {new_version}

[bumpversion:file:setup.py]

[bumpversion:file:docs/conf.py]

[bumpversion:file:src/django_cognito_jwt/__init__.py]
24 changes: 24 additions & 0 deletions .github/workflows/python-release.yml
@@ -0,0 +1,24 @@
name: Release to PyPi

on:
release:
types: [created]

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install build requirements
run: python -m pip install wheel
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
85 changes: 85 additions & 0 deletions .github/workflows/python-test.yml
@@ -0,0 +1,85 @@
name: Python Tests

on: [push]

jobs:

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: pip install tox
- name: Validate formatting
run: tox -e format

test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
tox_env:
- py36-django22
- py36-django30
- py37-django22
- py37-django30
- py38-django22
- py38-django30
include:
- python-version: 3.6
tox_env: py36-django22
- python-version: 3.6
tox_env: py36-django30
- python-version: 3.7
tox_env: py37-django22
- python-version: 3.7
tox_env: py37-django30
- python-version: 3.8
tox_env: py38-django22
- python-version: 3.8
tox_env: py38-django30

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox -e ${{ matrix.tox_env }}
- name: Prepare artifacts
run: mkdir .coverage-data && mv .coverage.* .coverage-data/
- uses: actions/upload-artifact@master
with:
name: coverage-data
path: .coverage-data/

coverage:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@master
with:
name: coverage-data
path: .
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Prepare Coverage report
run: tox -e coverage-report
- name: Upload to codecov
uses: codecov/codecov-action@v1.0.6
46 changes: 0 additions & 46 deletions azure-pipelines.yml

This file was deleted.

26 changes: 26 additions & 0 deletions pyproject.toml
@@ -0,0 +1,26 @@

[build-system]
requires = ["setuptools>=40.6.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.coverage.run]
branch = true
source = ["django_cognito_jwt"]

[tool.coverage.paths]
source = ["src", ".tox/*/site-packages"]

[tool.coverage.report]
show_missing = true

[tool.isort]
line_length = 88
multi_line_output = 3
include_trailing_comma = true
balanced_wrapping = true
default_section = "THIRDPARTY"
known_first_party = ["django_cognito_jwt", "tests"]
use_parentheses = true
indent_style = "space"
indent_size = 4
tab_width = 4
29 changes: 0 additions & 29 deletions setup.cfg
@@ -1,9 +1,3 @@
[bumpversion]
current_version = 0.0.3
commit = true
tag = true
tag_name = {new_version}

[tool:pytest]
minversion = 3.0
strict = true
Expand All @@ -12,26 +6,3 @@ testpaths = tests
[wheel]
universal = 1

[flake8]
max-line-length = 119

[bumpversion:file:setup.py]

[bumpversion:file:docs/conf.py]

[bumpversion:file:src/django_cognito_jwt/__init__.py]

[coverage:run]
branch = True
source =
django_cognito_jwt

[coverage:paths]
source =
src/django_cognito_jwt
.tox/*/lib/python*/site-packages/django_cognito_jwt
.tox/pypy*/site-packages/django_cognito_jwt

[coverage:report]
show_missing = True

71 changes: 34 additions & 37 deletions setup.py
@@ -1,61 +1,58 @@
from setuptools import find_packages, setup

install_requires = [
'Django>=1.11',
'cryptography',
'djangorestframework',
'pyjwt',
'requests',
"Django>=1.11",
"cryptography",
"djangorestframework",
"pyjwt",
"requests",
]


docs_require = [
'sphinx>=1.4.0',
"sphinx>=1.4.0",
]

tests_require = [
'coverage==.4.4.2',
'pytest==3.3.2',
'pytest-cov==2.5.1',
'pytest-django==3.1.2',
'pytest-responses==0.3.0',

"coverage[toml]==5.0.3",
"pytest==5.3.5",
"pytest-django==3.8.0",
"pytest-cov==2.8.1",
"pytest-responses==0.4.0",
# Linting
'isort==4.2.15',
'flake8==3.5.0',
'flake8-blind-except==0.1.1',
'flake8-imports==0.1.1',
'flake8-debugger==3.0.0',
"isort[pyproject]==4.3.21",
"flake8==3.7.9",
"flake8-imports==0.1.1",
"flake8-blind-except==0.1.1",
"flake8-debugger==3.1.0",
]

setup(
name='django-cognito-jwt',
version='0.0.3',
name="django-cognito-jwt",
version="0.0.3",
description="Django backends for AWS Cognito JWT",
long_description=open('README.rst', 'r').read(),
url='https://github.com/LabD/django-cognito-jwt',
long_description=open("README.rst", "r").read(),
url="https://github.com/LabD/django-cognito-jwt",
author="Michael van Tellingen",
author_email="m.vantellingen@labdigital.nl",
install_requires=install_requires,
extras_require={
'docs': docs_require,
'test': tests_require,
},
extras_require={"docs": docs_require, "test": tests_require,},
use_scm_version=True,
entry_points={},
package_dir={'': 'src'},
packages=find_packages('src'),
package_dir={"": "src"},
packages=find_packages("src"),
include_package_data=True,
license='MIT',
license="MIT",
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 1.11',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 1.11",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
zip_safe=False,
)
32 changes: 25 additions & 7 deletions tox.ini
@@ -1,18 +1,36 @@
[tox]
envlist = py{36}-django{111},py{36}-django{20}
envlist = py{36,37,38}-django{22,30}


[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38

[testenv]
commands = coverage run --parallel -m pytest {posargs}
commands = coverage run --source django_cognito_jwt --parallel -m pytest {posargs}
deps =
django111: Django>=1.11,<2.0
django20: Django>=2.0,<2.1
django22: Django>=2.2,<2.3
django30: Django>=3.0,<3.1
extras = test

# Uses default basepython otherwise reporting doesn't work on Travis where
# Python 3.5 is only available in 3.5 jobs.
[testenv:coverage-report]
deps = coverage
basepython = python3.7
deps = coverage[toml]
skip_install = true
commands =
coverage combine
coverage xml
coverage report

[testenv:format]
basepython = python3.7
deps =
black
isort[toml]
skip_install = true
commands =
isort --recursive --check-only src tests
black --check src/ tests/

0 comments on commit 58e6120

Please sign in to comment.