mirror of
https://github.com/jazzband/django-defender.git
synced 2026-03-16 22:10:32 +00:00
Migrate to GitHub Actions. (#174)
* Add GitHub Actions test workflow. * Add release workflow. * Remove Travis cruft and update changelog. * Fix deps. * Remove Celery version restriction. * Relax installation requirements a bit. * Update README.rst * Update tox.ini
This commit is contained in:
parent
9a322c4729
commit
b4a5f886d4
10 changed files with 118 additions and 44 deletions
40
.github/workflows/release.yml
vendored
Normal file
40
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository == 'jazzband/django-defender'
|
||||
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-defender/upload
|
||||
51
.github/workflows/test.yml
vendored
Normal file
51
.github/workflows/test.yml
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
name: Test
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: 5
|
||||
matrix:
|
||||
python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy3']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Start Redis
|
||||
uses: supercharge/redis-github-action@1.1.0
|
||||
|
||||
- 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') }}-${{ hashFiles('**/tox.ini') }}
|
||||
restore-keys: |
|
||||
${{ matrix.python-version }}-v1-
|
||||
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
python -m pip install --upgrade tox tox-gh-actions
|
||||
|
||||
- name: Tox tests
|
||||
run: |
|
||||
tox -v
|
||||
|
||||
- name: Upload coverage
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
name: Python ${{ matrix.python-version }}
|
||||
27
.travis.yml
27
.travis.yml
|
|
@ -1,27 +0,0 @@
|
|||
language: python
|
||||
dist: xenial
|
||||
cache: pip
|
||||
python:
|
||||
- '3.6'
|
||||
- '3.7'
|
||||
- '3.8'
|
||||
- '3.9'
|
||||
- pypy3
|
||||
services:
|
||||
- redis-server
|
||||
install: pip install tox-travis codecov
|
||||
script: tox
|
||||
after_success:
|
||||
- codecov
|
||||
deploy:
|
||||
provider: pypi
|
||||
user: jazzband
|
||||
server: https://jazzband.co/projects/django-defender/upload
|
||||
distributions: sdist bdist_wheel
|
||||
skip_existing: true
|
||||
password:
|
||||
secure: d/PVFgBDMpG6UvBOxXBLH4vc7+tiPsjhq4YLgXfX0iXbdNHUnnCyDLg/XUQ7x0e7kRj+lhmBzytZxu3IpOY+5MuWk4JTqwoBHGuUlmTC9XEVvioqd/nFW7qVe36YKZHKuMDlmwBNQarJZdSBUFAoCfklZKI09sXA1qc8E3BLAb8=
|
||||
on:
|
||||
tags: true
|
||||
repo: jazzband/django-defender
|
||||
python: 3.7
|
||||
|
|
@ -2,6 +2,11 @@
|
|||
Changes
|
||||
=======
|
||||
|
||||
Unreleased
|
||||
----------
|
||||
|
||||
- Move CI to GitHub Actions.
|
||||
|
||||
0.8.0
|
||||
-----
|
||||
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ django-defender
|
|||
:target: https://pypi.org/project/django-defender/
|
||||
:alt: Supported Django versions
|
||||
|
||||
.. image:: https://travis-ci.org/jazzband/django-defender.svg
|
||||
:target: https://travis-ci.org/jazzband/django-defender
|
||||
:alt: Build Status
|
||||
.. image:: https://github.com/jazzband/django-defender/workflows/Test/badge.svg
|
||||
:target: https://github.com/jazzband/django-defender/actions
|
||||
:alt: GitHub Actions
|
||||
|
||||
.. image:: https://codecov.io/gh/jazzband/django-defender/branch/master/graph/badge.svg
|
||||
:target: https://codecov.io/gh/jazzband/django-defender
|
||||
:alt: Coverage
|
||||
|
||||
.. image:: https://readthedocs.org/projects/python-dockerflow/badge/?version=latest
|
||||
.. image:: https://readthedocs.org/projects/django-defender/badge/?version=latest
|
||||
:alt: Documentation Status
|
||||
:target: https://django-defender.readthedocs.io/en/latest/?badge=latest
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ LOGIN_REDIRECT_URL = "/admin"
|
|||
DEFENDER_LOGIN_FAILURE_LIMIT = 10
|
||||
DEFENDER_COOLOFF_TIME = 2
|
||||
DEFENDER_REDIS_URL = "redis://localhost:6379/1"
|
||||
# don't use mock redis in unit tests, we will use real redis on travis.
|
||||
# don't use mock redis in unit tests, we will use real redis on CI.
|
||||
DEFENDER_MOCK_REDIS = False
|
||||
|
||||
# Celery settings:
|
||||
|
|
@ -68,7 +68,7 @@ BROKER_BACKEND = "memory"
|
|||
BROKER_URL = "memory://"
|
||||
|
||||
# set the default Django settings module for the 'celery' program.
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "defender.travis_settings")
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "defender.ci_settings")
|
||||
|
||||
app = Celery("defender")
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ LOGIN_REDIRECT_URL = "/admin"
|
|||
DEFENDER_LOGIN_FAILURE_LIMIT = 1
|
||||
DEFENDER_COOLOFF_TIME = 60
|
||||
DEFENDER_REDIS_URL = "redis://localhost:6379/1"
|
||||
# don't use mock redis in unit tests, we will use real redis on travis.
|
||||
# don't use mock redis in unit tests, we will use real redis on CI.
|
||||
DEFENDER_MOCK_REDIS = False
|
||||
# Let's use custom function and strip username string from request.
|
||||
DEFENDER_GET_USERNAME_FROM_REQUEST_PATH = (
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
-e .
|
||||
coverage
|
||||
mockredispy
|
||||
django-redis-cache==2.1.1
|
||||
celery<5
|
||||
django-redis-cache
|
||||
celery
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -61,7 +61,7 @@ setup(
|
|||
packages=find_packages(),
|
||||
package_data=get_package_data("defender"),
|
||||
python_requires='~=3.5',
|
||||
install_requires=["Django>=2.2,<3.2", "redis<3.6"],
|
||||
install_requires=["Django", "redis"],
|
||||
tests_require=[
|
||||
"mockredispy>=2.9.0.11,<3.0",
|
||||
"coverage",
|
||||
|
|
|
|||
19
tox.ini
19
tox.ini
|
|
@ -1,10 +1,10 @@
|
|||
[tox]
|
||||
envlist =
|
||||
# list of supported Django/Python versioons:
|
||||
py{36,37,38,39,py3}-django{22,30,31,master}
|
||||
py{36,37,38,39,py3}-dj{22,30,31,master}
|
||||
py38-{lint,docs}
|
||||
|
||||
[travis]
|
||||
[gh-actions]
|
||||
python =
|
||||
3.6: py36
|
||||
3.7: py37
|
||||
|
|
@ -15,14 +15,19 @@ python =
|
|||
[testenv]
|
||||
deps =
|
||||
-rrequirements.txt
|
||||
django22: django>=2.2,<2.3
|
||||
django30: django>=3.0,<3.1
|
||||
django31: django>=3.1,<3.2
|
||||
djangomaster: https://github.com/django/django/archive/master.tar.gz
|
||||
dj22: django>=2.2,<2.3
|
||||
dj30: django>=3.0,<3.1
|
||||
dj31: django>=3.1,<3.2
|
||||
djmaster: https://github.com/django/django/archive/master.tar.gz
|
||||
usedevelop = True
|
||||
commands =
|
||||
{envbindir}/coverage run --source=defender {envbindir}/django-admin test defender --settings=defender.travis_settings
|
||||
{envbindir}/coverage run --source=defender {envbindir}/django-admin test defender --settings=defender.ci_settings
|
||||
{envbindir}/coverage report -m
|
||||
{envbindir}/coverage xml
|
||||
|
||||
[testenv:py{36,37,38,39,py3}-dj{master}]
|
||||
ignore_errors = true
|
||||
ignore_outcome = true
|
||||
|
||||
[testenv:py38-docs]
|
||||
basepython = python3.8
|
||||
|
|
|
|||
Loading…
Reference in a new issue