mirror of
https://github.com/jazzband/django-defender.git
synced 2026-03-16 22:10:32 +00:00
Add GitHub Actions test workflow.
This commit is contained in:
parent
9a322c4729
commit
516306ccd7
5 changed files with 61 additions and 9 deletions
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 }}
|
||||
|
|
@ -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/python-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 = (
|
||||
|
|
|
|||
5
tox.ini
5
tox.ini
|
|
@ -4,7 +4,7 @@ envlist =
|
|||
py{36,37,38,39,py3}-django{22,30,31,master}
|
||||
py38-{lint,docs}
|
||||
|
||||
[travis]
|
||||
[gh-actions]
|
||||
python =
|
||||
3.6: py36
|
||||
3.7: py37
|
||||
|
|
@ -21,8 +21,9 @@ deps =
|
|||
djangomaster: 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:py38-docs]
|
||||
basepython = python3.8
|
||||
|
|
|
|||
Loading…
Reference in a new issue