From da0cff4a159c3b272697beb01fed590bd2f9fc14 Mon Sep 17 00:00:00 2001 From: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com> Date: Thu, 6 May 2021 14:32:16 -0400 Subject: [PATCH 01/17] Fix CI and Update Tested Versions * CI testing Django 3.0 would actually only test Django 3.2 because GitHub actions converted 3.0 to an integer and tax didn't read it correctly (testing on Django 3.2a according to the logs) * Updated Python and Django versions --- .github/workflows/test.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a96ffdc..8a8d63f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,19 +8,19 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8] - django: [2.2, 3.0, 3.1, master] + python-version: [3.5, 3.6, 3.7, 3.8, 3.9] + django: ['2.2', '3.0', '3.1', '3.2', 'master'] exclude: - python-version: 3.5 - django: 3.0 + django: '3.0' - python-version: 3.5 - django: 3.1 + django: '3.1' - python-version: 3.5 - django: master + django: 'master' - python-version: 3.6 - django: master + django: 'master' - python-version: 3.7 - django: master + django: 'master' steps: - uses: actions/checkout@v2 From e2969bab295e2d5e862682a860c61bb43db7cf01 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 14:26:59 -0400 Subject: [PATCH 02/17] Fix tox and test --- .github/workflows/test.yml | 15 ++------------- tox.ini | 19 +++++++++---------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8a8d63f..0128c2d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,19 +8,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.5, 3.6, 3.7, 3.8, 3.9] - django: ['2.2', '3.0', '3.1', '3.2', 'master'] - 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', '3.7', '3.8', '3.9'] + django: ['2.2', '3.1', '3.2', 'main'] steps: - uses: actions/checkout@v2 diff --git a/tox.ini b/tox.ini index 35e711f..bb3b0da 100644 --- a/tox.ini +++ b/tox.ini @@ -1,18 +1,17 @@ [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,main}, + py37-django{22,31,32,main}, + py38-django{22,31,32,main}, + py39-django{22,31,32,main}, + pypy36-django{22,31,32,main}, [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 + django22: Django>=2.2,<3.0 + django31: Django>=3.1,<3.2 + django32: Django>=3.2,<3.3 + djangomain: https://github.com/django/django/archive/main.tar.gz python3-memcached>=1.51 django-redis==4.10.0 flake8 From 3c5e2acd582345d03add56847d4cbb08ca01cfc0 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 14:29:33 -0400 Subject: [PATCH 03/17] CI rename master to main --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0128c2d..dd8b44c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,8 +20,8 @@ jobs: - 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 + 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/master.tar.gz; fi pip install flake8 django-redis python3-memcached - name: Lint with flake8 run: | From 6087d6b9fc6c7821903c8fe11febc20b72e93bae Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 14:30:32 -0400 Subject: [PATCH 04/17] Renamed master to main in GH link --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dd8b44c..bfb9131 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: run: | python -m pip install --upgrade pip 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/master.tar.gz; fi + if [[ ${{ matrix.django }} == main ]]; then pip install https://github.com/django/django/archive/main.tar.gz; fi pip install flake8 django-redis python3-memcached - name: Lint with flake8 run: | From 345c081715d95f66ea143ecf642b811d7d9b4711 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 14:32:57 -0400 Subject: [PATCH 05/17] Drop Py 36 and 37 for Django main --- .github/workflows/test.yml | 5 +++++ tox.ini | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bfb9131..e4ea799 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,11 @@ jobs: matrix: python-version: ['3.6', '3.7', '3.8', '3.9'] django: ['2.2', '3.1', '3.2', 'main'] + exclude: + - python-version: '3.6' + django: 'main' + - python-version: '3.7' + django: 'main' steps: - uses: actions/checkout@v2 diff --git a/tox.ini b/tox.ini index bb3b0da..475b0c7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,7 @@ [tox] envlist = - py36-django{22,31,32,main}, - py37-django{22,31,32,main}, + py36-django{22,31,32}, + py37-django{22,31,32}, py38-django{22,31,32,main}, py39-django{22,31,32,main}, pypy36-django{22,31,32,main}, From d212d271f8ffcf6b5a55206274e49cc6f5f89fbd Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 14:33:55 -0400 Subject: [PATCH 06/17] Fix GitHub Action syntax --- .github/workflows/test.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e4ea799..ecc85b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,11 +10,11 @@ jobs: matrix: python-version: ['3.6', '3.7', '3.8', '3.9'] django: ['2.2', '3.1', '3.2', 'main'] - exclude: - - python-version: '3.6' - django: 'main' - - python-version: '3.7' - django: 'main' + exclude: + - python-version: '3.6' + django: 'main' + - python-version: '3.7' + django: 'main' steps: - uses: actions/checkout@v2 From 111d097c4ab5e4552dbd832d69a47712cfb0f5cc Mon Sep 17 00:00:00 2001 From: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com> Date: Tue, 24 Aug 2021 16:29:57 -0400 Subject: [PATCH 07/17] Do not pin django-redis --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 475b0c7..fe02aff 100644 --- a/tox.ini +++ b/tox.ini @@ -13,7 +13,7 @@ deps = django32: Django>=3.2,<3.3 djangomain: https://github.com/django/django/archive/main.tar.gz python3-memcached>=1.51 - django-redis==4.10.0 + django-redis flake8 commands = From 1cf4360e7e60cff035f629f9d9b3cc8a6427bc58 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 19:14:48 -0400 Subject: [PATCH 08/17] Add all 3 Django memcache backends --- .github/workflows/test.yml | 13 +++++++++++++ test_settings.py | 13 ++++++++++++- tox.ini | 14 ++++++++------ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ecc85b3..9cf7e35 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,11 +10,20 @@ jobs: matrix: python-version: ['3.6', '3.7', '3.8', '3.9'] django: ['2.2', '3.1', '3.2', 'main'] + memcache: ['pylibmc', 'pymemcache', 'memcache'] exclude: - python-version: '3.6' django: 'main' - python-version: '3.7' django: 'main' + - memcache: 'memcache' + django: '3.2' + - memcache: 'memcache' + django: 'main' + - memcache: 'pymemcache' + django: '2.2' + - memcache: 'pymemcache' + django: '3.1' steps: - uses: actions/checkout@v2 @@ -22,6 +31,10 @@ jobs: 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 diff --git a/test_settings.py b/test_settings.py index d84fa9c..14cec4c 100644 --- a/test_settings.py +++ b/test_settings.py @@ -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 = ( @@ -12,7 +23,7 @@ 'LOCATION': 'ratelimit-tests', }, 'connection-errors': { - 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache', + 'BACKEND': f'django.core.cache.backends.memcached.{memcache_backend}', 'LOCATION': 'test-connection-errors', }, 'connection-errors-redis': { diff --git a/tox.ini b/tox.ini index fe02aff..c8a4a38 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = - py36-django{22,31,32}, - py37-django{22,31,32}, - py38-django{22,31,32,main}, - py39-django{22,31,32,main}, - pypy36-django{22,31,32,main}, + py36-django-{22,31,32}-{pylibmc,memcache,pymemcache}, + py37-django-{22,31,32}-{pylibmc,memcache,pymemcache}, + py38-django{22,31,32,main}-{pylibmc,memcache,pymemcache}, + py39-django{22,31,32,main}-{pylibmc,memcache,pymemcache}, + pypy36-django{22,31,32,main}-{pylibmc,memcache,pymemcache}, [testenv] deps = @@ -12,7 +12,9 @@ deps = django31: Django>=3.1,<3.2 django32: Django>=3.2,<3.3 djangomain: https://github.com/django/django/archive/main.tar.gz - python3-memcached>=1.51 + memcache: python-memcached + pylibmc + pymemcache django-redis flake8 From 24462dd6ad8a65a890fa1efcf4f7005ede24a14f Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 19:21:28 -0400 Subject: [PATCH 09/17] Rewrite python-memcache since tox not used --- .github/workflows/test.yml | 10 +++++----- tox.ini | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9cf7e35..b7df3a6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,15 +10,15 @@ jobs: matrix: python-version: ['3.6', '3.7', '3.8', '3.9'] django: ['2.2', '3.1', '3.2', 'main'] - memcache: ['pylibmc', 'pymemcache', 'memcache'] + memcache: ['pylibmc', 'pymemcache', 'python-memcached'] exclude: - python-version: '3.6' django: 'main' - python-version: '3.7' django: 'main' - - memcache: 'memcache' + - memcache: 'memcached' django: '3.2' - - memcache: 'memcache' + - memcache: 'memcached' django: 'main' - memcache: 'pymemcache' django: '2.2' @@ -32,7 +32,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install PyLibMC Dependencies - if: ${{ matrix.memcache }} == 'pylibmc' + if: ${{ matrix.memcache == 'pylibmc' }} run: | sudo apt-get install -y libmemcached-dev zlib1g-dev - name: Install dependencies @@ -40,7 +40,7 @@ jobs: python -m pip install --upgrade pip 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 python3-memcached + pip install flake8 django-redis ${{ matrix.memcache }} - name: Lint with flake8 run: | ./run.sh flake8 diff --git a/tox.ini b/tox.ini index c8a4a38..eeb4b0a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] envlist = - py36-django-{22,31,32}-{pylibmc,memcache,pymemcache}, - py37-django-{22,31,32}-{pylibmc,memcache,pymemcache}, - py38-django{22,31,32,main}-{pylibmc,memcache,pymemcache}, - py39-django{22,31,32,main}-{pylibmc,memcache,pymemcache}, - pypy36-django{22,31,32,main}-{pylibmc,memcache,pymemcache}, + 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 = @@ -12,7 +12,7 @@ deps = django31: Django>=3.1,<3.2 django32: Django>=3.2,<3.3 djangomain: https://github.com/django/django/archive/main.tar.gz - memcache: python-memcached + python-memcached pylibmc pymemcache django-redis From 0fd4e26875cf29aa55e203051699d7b3133b1d96 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 19:31:51 -0400 Subject: [PATCH 10/17] Refactor CI exclude --- .github/workflows/test.yml | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b7df3a6..fecce36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,16 +14,47 @@ jobs: exclude: - 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: 'memcached' - django: '3.2' - - memcache: 'memcached' + 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 From acb2bef5166c845dbda6ed24d4339b75cae01c8b Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 19:48:51 -0400 Subject: [PATCH 11/17] Use memcached docker service in CI --- .github/workflows/test.yml | 5 +++++ test_settings.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fecce36..9b7b6c4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,6 +6,11 @@ jobs: build: runs-on: ubuntu-latest + services: + memcached: + image: memcached + ports: + - 11211:11211 strategy: matrix: python-version: ['3.6', '3.7', '3.8', '3.9'] diff --git a/test_settings.py b/test_settings.py index 14cec4c..7f01ab1 100644 --- a/test_settings.py +++ b/test_settings.py @@ -24,7 +24,7 @@ }, 'connection-errors': { 'BACKEND': f'django.core.cache.backends.memcached.{memcache_backend}', - 'LOCATION': 'test-connection-errors', + 'LOCATION': '127.0.0.1:11211', }, 'connection-errors-redis': { 'BACKEND': 'django_redis.cache.RedisCache', From 9a48fca4260d55fb3094a5f83320436d68ea33ea Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 19:50:56 -0400 Subject: [PATCH 12/17] Don't fail fast --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b7b6c4..9c8b17c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,6 +12,7 @@ jobs: ports: - 11211:11211 strategy: + fail-fast: false matrix: python-version: ['3.6', '3.7', '3.8', '3.9'] django: ['2.2', '3.1', '3.2', 'main'] From eccb7d2b10ee4fe5873a3674f5a15f5f1359ddc1 Mon Sep 17 00:00:00 2001 From: Andrew-Chen-Wang Date: Tue, 24 Aug 2021 19:57:43 -0400 Subject: [PATCH 13/17] Revert real memcached uri --- test_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_settings.py b/test_settings.py index 7f01ab1..b1b1cf7 100644 --- a/test_settings.py +++ b/test_settings.py @@ -24,7 +24,7 @@ }, 'connection-errors': { 'BACKEND': f'django.core.cache.backends.memcached.{memcache_backend}', - 'LOCATION': '127.0.0.1:11211', + 'LOCATION': 'connection-errors', }, 'connection-errors-redis': { 'BACKEND': 'django_redis.cache.RedisCache', From 31d47073b1c6b04c79cee304f529b6bbf9291678 Mon Sep 17 00:00:00 2001 From: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com> Date: Wed, 25 Aug 2021 18:13:54 -0400 Subject: [PATCH 14/17] Set memcached packages to use random port --- test_settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_settings.py b/test_settings.py index b1b1cf7..c1815b2 100644 --- a/test_settings.py +++ b/test_settings.py @@ -24,7 +24,7 @@ }, 'connection-errors': { 'BACKEND': f'django.core.cache.backends.memcached.{memcache_backend}', - 'LOCATION': 'connection-errors', + 'LOCATION': '127.0.0.1:57823', }, 'connection-errors-redis': { 'BACKEND': 'django_redis.cache.RedisCache', From f9665e6471a14df293a8a5fd321947beeadd44e2 Mon Sep 17 00:00:00 2001 From: Mahyar Damavand Date: Thu, 26 Aug 2021 11:40:18 +0430 Subject: [PATCH 15/17] Fix djangomain URL-Not-Found error --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index eeb4b0a..266aa8f 100644 --- a/tox.ini +++ b/tox.ini @@ -11,7 +11,7 @@ deps = django22: Django>=2.2,<3.0 django31: Django>=3.1,<3.2 django32: Django>=3.2,<3.3 - djangomain: https://github.com/django/django/archive/main.tar.gz + djangomain: -e git+https://github.com/django/django.git#egg=django python-memcached pylibmc pymemcache From 0ce25c47718c1be9dfd1f5a4480055f6bb248d45 Mon Sep 17 00:00:00 2001 From: Mahyar Damavand Date: Thu, 26 Aug 2021 17:56:29 +0430 Subject: [PATCH 16/17] update memcached publishing port --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c8b17c..2d610ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: memcached: image: memcached ports: - - 11211:11211 + - 57823:11211 strategy: fail-fast: false matrix: From 6bed6abe87cb2c098018b6d88db3e9b55780a87a Mon Sep 17 00:00:00 2001 From: Mahyar Damavand Date: Fri, 27 Aug 2021 10:31:23 +0430 Subject: [PATCH 17/17] Revert "update memcached publishing port" This reverts commit 0ce25c47718c1be9dfd1f5a4480055f6bb248d45. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2d610ee..9c8b17c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: memcached: image: memcached ports: - - 57823:11211 + - 11211:11211 strategy: fail-fast: false matrix: