Skip to content

Commit 6af081c

Browse files
MattBlack85jezdez
andauthored
Migrate to GitHub Actions (#907)
* WIP - GH actions * drop pypy * Fix tox.ini * Try to fix coverage * Add 3.5 (for django 2.2) to GH actions * Minor doc updates. * Rename some tox config. * Minor typo. * Add release workflow. * Remove tarball from download URL. * Ignore errors on Django masters. * Minor fix. Co-authored-by: Jannis Leidel <[email protected]>
1 parent f344b06 commit 6af081c

File tree

7 files changed

+152
-125
lines changed

7 files changed

+152
-125
lines changed

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
if: github.repository == 'jazzband/django-oauth-toolkit'
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: 3.8
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install -U pip
26+
python -m pip install -U setuptools twine wheel
27+
28+
- name: Build package
29+
run: |
30+
python setup.py --version
31+
python setup.py sdist --format=gztar bdist_wheel
32+
twine check dist/*
33+
34+
- name: Upload packages to Jazzband
35+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
36+
uses: pypa/gh-action-pypi-publish@master
37+
with:
38+
user: jazzband
39+
password: ${{ secrets.JAZZBAND_RELEASE_KEY }}
40+
repository_url: https://jazzband.co/projects/django-oauth-toolkit/upload

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
max-parallel: 5
11+
matrix:
12+
python-version: ['3.5' ,'3.6', '3.7', '3.8', '3.9']
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v2
19+
with:
20+
python-version: ${{ matrix.python-version }}
21+
22+
23+
- name: Get pip cache dir
24+
id: pip-cache
25+
run: |
26+
echo "::set-output name=dir::$(pip cache dir)"
27+
28+
- name: Cache
29+
uses: actions/cache@v2
30+
with:
31+
path: ${{ steps.pip-cache.outputs.dir }}
32+
key:
33+
${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/tox.ini') }}
34+
restore-keys: |
35+
${{ matrix.python-version }}-v1-
36+
37+
- name: Install Python dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
python -m pip install --upgrade tox tox-gh-actions
41+
42+
- name: Tox tests
43+
run: |
44+
tox -v
45+
46+
- name: Upload coverage
47+
uses: codecov/codecov-action@v1
48+
with:
49+
name: Python ${{ matrix.python-version }}

.travis.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

README.rst

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ Django OAuth Toolkit
1010
.. image:: https://badge.fury.io/py/django-oauth-toolkit.png
1111
:target: http://badge.fury.io/py/django-oauth-toolkit
1212

13-
.. image:: https://travis-ci.org/jazzband/django-oauth-toolkit.png
14-
:alt: Build Status
15-
:target: https://travis-ci.org/jazzband/django-oauth-toolkit
16-
17-
.. image:: https://coveralls.io/repos/github/jazzband/django-oauth-toolkit/badge.svg?branch=master
18-
:alt: Coverage Status
19-
:target: https://coveralls.io/github/jazzband/django-oauth-toolkit?branch=master
13+
.. image:: https://github.com/jazzband/django-oauth-toolkit/workflows/Test/badge.svg
14+
:target: https://github.com/jazzband/django-oauth-toolkit/actions
15+
:alt: GitHub Actions
2016

17+
.. image:: https://codecov.io/gh/jazzband/django-oauth-toolkit/branch/master/graph/badge.svg
18+
:target: https://codecov.io/gh/jazzband/django-oauth-toolkit
19+
:alt: Coverage
2120

2221
If you are facing one or more of the following:
2322
* Your Django app exposes a web API you want to protect with OAuth2 authentication,

docs/contributing.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ When you begin your PR, you'll be asked to provide the following:
8484
* Any new or changed code requires that a unit test be added or updated. Make sure your tests check for
8585
correct error behavior as well as normal expected behavior. Strive for 100% code coverage of any new
8686
code you contribute! Improving unit tests is always a welcome contribution.
87-
If your change reduces coverage, you'll be warned by `coveralls <https://coveralls.io/>`_.
87+
If your change reduces coverage, you'll be warned by `Codecov <https://codecov.io/>`_.
8888

8989
* Update the documentation (in `docs/`) to describe the new or changed functionality.
9090

@@ -190,7 +190,7 @@ You can check your coverage locally with the `coverage <https://pypi.org/project
190190

191191
Open mycoverage/index.html in your browser and you can see a coverage summary and coverage details for each file.
192192

193-
There's no need to wait for coveralls to complain after you submit your PR.
193+
There's no need to wait for Codecov to complain after you submit your PR.
194194

195195
Code conventions matter
196196
-----------------------

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ long_description_content_type = text/x-rst
77
author = Federico Frenguelli, Massimiliano Pippi
88
author_email = [email protected]
99
url = https://github.com/jazzband/django-oauth-toolkit
10-
download_url = https://github.com/jazzband/django-oauth-toolkit/tarball/master
1110
keywords = django, oauth, oauth2, oauthlib
1211
classifiers =
1312
Development Status :: 5 - Production/Stable

tox.ini

Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,81 @@
11
[tox]
22
envlist =
3-
py37-flake8,
4-
py37-docs,
5-
py39-django{31,30,22},
6-
py38-django{31,30,22},
7-
py37-django{31,30,22},
8-
py36-django{31,30,22},
9-
py35-django{22},
10-
py39-djangomaster,
11-
py38-djangomaster,
12-
py37-djangomaster,
13-
py36-djangomaster,
3+
flake8,
4+
docs,
5+
py{36,37,38,39}-dj{31,30,22},
6+
py35-dj{22},
7+
py{36,37,38,39}-djmaster,
8+
9+
[gh-actions]
10+
python =
11+
3.5: py35
12+
3.6: py36
13+
3.7: py37
14+
3.8: py38, docs
15+
3.9: py39
1416

1517
[pytest]
1618
django_find_project = false
1719

1820
[testenv]
19-
commands = pytest --cov=oauth2_provider --cov-report= --cov-append {posargs}
21+
commands =
22+
pytest --cov=oauth2_provider --cov-report= --cov-append {posargs}
23+
coverage report
24+
coverage xml
2025
setenv =
21-
DJANGO_SETTINGS_MODULE = tests.settings
22-
PYTHONPATH = {toxinidir}
23-
PYTHONWARNINGS = all
26+
DJANGO_SETTINGS_MODULE = tests.settings
27+
PYTHONPATH = {toxinidir}
28+
PYTHONWARNINGS = all
2429
deps =
25-
django22: Django>=2.2,<3
26-
django30: Django>=3.0,<3.1
27-
django31: Django>=3.1,<3.2
28-
djangomaster: https://github.com/django/django/archive/master.tar.gz
29-
djangorestframework
30-
oauthlib>=3.1.0
31-
coverage
32-
pytest
33-
pytest-cov
34-
pytest-django
35-
pytest-xdist
36-
py27: mock
37-
requests
30+
dj22: Django>=2.2,<3
31+
dj30: Django>=3.0,<3.1
32+
dj31: Django>=3.1,<3.2
33+
djmaster: https://github.com/django/django/archive/master.tar.gz
34+
djangorestframework
35+
oauthlib>=3.1.0
36+
coverage
37+
pytest
38+
pytest-cov
39+
pytest-django
40+
pytest-xdist
41+
requests
3842
passenv =
3943
PYTEST_ADDOPTS
4044

41-
[testenv:py37-docs]
42-
basepython = python
45+
[testenv:py{36,37,38,39}-djmaster]
46+
ignore_errors = true
47+
ignore_outcome = true
48+
49+
[testenv:docs]
50+
basepython = python3.8
4351
changedir = docs
4452
whitelist_externals = make
4553
commands = make html
4654
deps =
47-
sphinx<3
48-
oauthlib>=3.1.0
49-
m2r>=0.2.1
55+
sphinx<3
56+
oauthlib>=3.1.0
57+
m2r>=0.2.1
5058

51-
[testenv:py37-flake8]
59+
[testenv:flake8]
60+
basepython = python3.8
5261
skip_install = True
53-
commands =
54-
flake8 {toxinidir}
62+
commands = flake8 {toxinidir}
5563
deps =
56-
flake8
57-
flake8-isort
58-
flake8-quotes
59-
flake8-black
64+
flake8
65+
flake8-isort
66+
flake8-quotes
67+
flake8-black
6068

6169
[testenv:install]
6270
deps =
63-
twine
64-
setuptools>=39.0
65-
wheel
66-
whitelist_externals=
67-
rm
71+
twine
72+
setuptools>=39.0
73+
wheel
74+
whitelist_externals = rm
6875
commands =
69-
rm -rf dist
70-
python setup.py sdist bdist_wheel
71-
twine upload dist/*
76+
rm -rf dist
77+
python setup.py sdist bdist_wheel
78+
twine upload dist/*
7279

7380

7481
[coverage:run]

0 commit comments

Comments
 (0)