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

Fix CI and Update Tested Versions #239

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
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
74 changes: 59 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,78 @@ jobs:
build:

runs-on: ubuntu-latest
services:
memcached:
image: memcached
ports:
- 11211:11211
strategy:
fail-fast: false
matrix:
python-version: [3.5, 3.6, 3.7, 3.8]
django: [2.2, 3.0, 3.1, master]
python-version: ['3.6', '3.7', '3.8', '3.9']
django: ['2.2', '3.1', '3.2', 'main']
memcache: ['pylibmc', 'pymemcache', 'python-memcached']
exclude:
- python-version: 3.5
django: 3.0
- python-version: 3.5
django: 3.1
- python-version: 3.5
django: master
- python-version: 3.6
django: master
- python-version: 3.7
django: master
- python-version: '3.6'
django: 'main'
memcache: 'pylibmc'
- python-version: '3.6'
django: 'main'
memcache: 'pymemcache'
- python-version: '3.6'
django: 'main'
memcache: 'python-memcached'
- python-version: '3.7'
django: 'main'
memcache: 'pylibmc'
- python-version: '3.7'
django: 'main'
memcache: 'pymemcache'
- python-version: '3.7'
django: 'main'
memcache: 'python-memcached'

- memcache: 'pymemcache'
django: '2.2'
python-version: '3.6'
- memcache: 'pymemcache'
django: '2.2'
python-version: '3.7'
- memcache: 'pymemcache'
django: '2.2'
python-version: '3.8'
- memcache: 'pymemcache'
django: '2.2'
python-version: '3.9'
- memcache: 'pymemcache'
django: '3.1'
python-version: '3.6'
- memcache: 'pymemcache'
django: '3.1'
python-version: '3.7'
- memcache: 'pymemcache'
django: '3.1'
python-version: '3.8'
- memcache: 'pymemcache'
django: '3.1'
python-version: '3.9'

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install PyLibMC Dependencies
if: ${{ matrix.memcache == 'pylibmc' }}
run: |
sudo apt-get install -y libmemcached-dev zlib1g-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [[ ${{ matrix.django }} != master ]]; then pip install --pre -q "Django>=${{ matrix.django }},<${{ matrix.django }}.99"; fi
if [[ ${{ matrix.django }} == master ]]; then pip install https://github.com/django/django/archive/master.tar.gz; fi
pip install flake8 django-redis python3-memcached
if [[ ${{ matrix.django }} != main ]]; then pip install --pre -q "Django>=${{ matrix.django }},<${{ matrix.django }}.99"; fi
if [[ ${{ matrix.django }} == main ]]; then pip install https://github.com/django/django/archive/main.tar.gz; fi
pip install flake8 django-redis ${{ matrix.memcache }}
- name: Lint with flake8
run: |
./run.sh flake8
Expand Down
15 changes: 13 additions & 2 deletions test_settings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
try:
import pylibmc # noqa: F401
memcache_backend = "PyLibMCCache"
except ImportError:
try:
import pymemcache # noqa: F401
memcache_backend = "PyMemcacheCache"
except ImportError:
import memcache # noqa: F401
memcache_backend = "MemcachedCache"

SECRET_KEY = 'ratelimit'

INSTALLED_APPS = (
Expand All @@ -12,8 +23,8 @@
'LOCATION': 'ratelimit-tests',
},
'connection-errors': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'test-connection-errors',
'BACKEND': f'django.core.cache.backends.memcached.{memcache_backend}',
'LOCATION': '127.0.0.1:57823',
},
'connection-errors-redis': {
'BACKEND': 'django_redis.cache.RedisCache',
Expand Down
25 changes: 13 additions & 12 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
[tox]
envlist =
py34-django{111,20},
py35-django{111,20,21,22b},
py36-django{111,20,21,22b,master},
py37-django{20,21,22b,master},
pypy35-django{111,20,21,22b,master},
py36-django-{22,31,32}-{pylibmc,python-memcached,pymemcache},
py37-django-{22,31,32}-{pylibmc,python-memcached,pymemcache},
py38-django{22,31,32,main}-{pylibmc,python-memcached,pymemcache},
py39-django{22,31,32,main}-{pylibmc,python-memcached,pymemcache},
pypy36-django{22,31,32,main}-{pylibmc,python-memcached,pymemcache},

[testenv]
deps =
django111: Django>=1.11,<1.12
django20: Django>=2.0,<2.1
django21: Django>=2.1,<2.2
django22b: https://github.com/django/django/archive/stable/2.2.x.tar.gz
djangomaster: https://github.com/django/django/archive/master.tar.gz
python3-memcached>=1.51
django-redis==4.10.0
django22: Django>=2.2,<3.0
django31: Django>=3.1,<3.2
django32: Django>=3.2,<3.3
djangomain: -e git+https://github.com/django/django.git#egg=django
python-memcached
pylibmc
pymemcache
django-redis
flake8

commands =
Expand Down