From f6a7b65e7988dcfd610e75bbc8900ebc4ca29d17 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 4 Nov 2020 16:59:50 +0000 Subject: [PATCH 01/14] Add support for up to Django 3.1 & Python 3.9 --- .travis.yml | 33 ++++++++++++++++++++++++++++++++- django_redshift_backend/base.py | 29 ++++++++++++++++++++--------- setup.py | 5 +++++ tox.ini | 11 +++++++++++ 4 files changed, 68 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3bc2cc0..401f809 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,16 @@ python: - '3.5' - '3.6' - '3.7' +- '3.8' +- '3.9' cache: pip env: + - DJANGO="1.11" - DJANGO="2.0" - DJANGO="2.1" - - DJANGO="1.11" + - DJANGO="2.2" + - DJANGO="3.0" + - DJANGO="3.1" install: - travis_retry pip install tox-travis script: @@ -22,6 +27,32 @@ jobs: python: '2.7' - env: DJANGO="2.1" python: '2.7' + - env: DJANGO="2.2" + python: '2.7' + - env: DJANGO="3.0" + python: '2.7' + - env: DJANGO="3.1" + python: '2.7' + + - env: DJANGO="3.0" + python: '3.5' + - env: DJANGO="3.1" + python: '3.5' + + - env: DJANGO="1.11" + python: '3.8' + - env: DJANGO="2.0" + python: '3.8' + - env: DJANGO="2.1" + python: '3.8' + + - env: DJANGO="1.11" + python: '3.9' + - env: DJANGO="2.0" + python: '3.9' + - env: DJANGO="2.1" + python: '3.9' + include: - stage: deploy install: skip diff --git a/django_redshift_backend/base.py b/django_redshift_backend/base.py index 4a72fa5..f94a012 100644 --- a/django_redshift_backend/base.py +++ b/django_redshift_backend/base.py @@ -13,15 +13,26 @@ from django.conf import settings from django.core.exceptions import FieldDoesNotExist from django.db.backends.base.validation import BaseDatabaseValidation -from django.db.backends.postgresql_psycopg2.base import ( - DatabaseFeatures as BasePGDatabaseFeatures, - DatabaseWrapper as BasePGDatabaseWrapper, - DatabaseOperations as BasePGDatabaseOperations, - DatabaseSchemaEditor as BasePGDatabaseSchemaEditor, - DatabaseClient, - DatabaseCreation as BasePGDatabaseCreation, - DatabaseIntrospection, -) +try: + from django.db.backends.postgresql.base import ( + DatabaseFeatures as BasePGDatabaseFeatures, + DatabaseWrapper as BasePGDatabaseWrapper, + DatabaseOperations as BasePGDatabaseOperations, + DatabaseSchemaEditor as BasePGDatabaseSchemaEditor, + DatabaseClient, + DatabaseCreation as BasePGDatabaseCreation, + DatabaseIntrospection, + ) +except ImportError: + from django.db.backends.postgresql_psycopg2.base import ( + DatabaseFeatures as BasePGDatabaseFeatures, + DatabaseWrapper as BasePGDatabaseWrapper, + DatabaseOperations as BasePGDatabaseOperations, + DatabaseSchemaEditor as BasePGDatabaseSchemaEditor, + DatabaseClient, + DatabaseCreation as BasePGDatabaseCreation, + DatabaseIntrospection, + ) from django.db.utils import NotSupportedError from django_redshift_backend.distkey import DistKey diff --git a/setup.py b/setup.py index f836357..787c350 100644 --- a/setup.py +++ b/setup.py @@ -36,10 +36,15 @@ def read(filename): 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Framework :: Django', 'Framework :: Django :: 1.11', 'Framework :: Django :: 2.0', 'Framework :: Django :: 2.1', + 'Framework :: Django :: 2.2', + 'Framework :: Django :: 3.0', + 'Framework :: Django :: 3.1', 'Intended Audience :: Developers', 'Environment :: Plugins', 'Topic :: Software Development :: Libraries :: Python Modules', diff --git a/tox.ini b/tox.ini index af3127e..c174bbc 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,9 @@ envlist = py{27,35,36}-dj111, py{35,36,37}-dj20, py{35,36,37}-dj21, + py{35,36,37,38,39}-dj22, + py{36,37,38,39}-dj30, + py{36,37,38,39}-dj31, flake8, isort, readme @@ -14,18 +17,26 @@ python = 3.5: py35 3.6: py36,flake8,readme 3.7: py37 + 3.8: py38 + 3.9: py39 [travis:env] DJANGO = 1.11: dj111 2.0: dj20 2.1: dj21 + 2.2: dj22 + 3.0: dj30 + 3.1: dj31 [testenv] deps = dj111: Django>=1.11,<1.12 dj20: Django>=2.0,<2.1 dj21: Django>=2.1,<2.2 + dj22: Django>=2.2,<3.0 + dj30: Django>=3.0,<3.1 + dj31: Django>=3.1,<3.2 djmaster: https://github.com/django/django/archive/master.tar.gz -rtest-requires.txt setenv = From 0f94a020a4298af70fb2976e9e6f960f4d75f374 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Thu, 5 Nov 2020 11:33:22 +0000 Subject: [PATCH 02/14] Update documentation --- doc/index.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/index.rst b/doc/index.rst index 6d311c4..3f08c70 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -43,8 +43,8 @@ Support versions This product is tested with: -* Python-2.7, 3.5, 3.6 -* Django-1.11, 2.0 +* Python-2.7, 3.5, 3.6, 37, 38 and 3.9 +* Django-1.11, 2.0, 2.1, 2.2, 3.0, 3.1 License ======= From 06c969b038653b7166d5082d4f0cf65e3be52c10 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 6 Nov 2020 14:29:31 +0000 Subject: [PATCH 03/14] Move CI to Github Actions --- .github/workflows/ci.yml | 95 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 40 ----------------- README.rst | 6 +-- checklist.rst | 4 +- doc/dev.rst | 4 +- doc/index.rst | 6 +-- tox.ini | 19 ++------ 7 files changed, 108 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..375a3a6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,95 @@ +name: CI + +on: + push: +# branches: +# - master + pull_request: + +jobs: + tests: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + # https://docs.djangoproject.com/en/stable/faq/install/#what-python-version-can-i-use-with-django + versions: + # Django 1.11 + - django: 1.11 + python: 2.7 + - django: 1.11 + python: 3.5 + - django: 1.11 + python: 3.6 + + # Django 2.0 + - django: 2.0 + python: 3.5 + - django: 2.0 + python: 3.6 + - django: 2.0 + python: 3.7 + + # Django 2.1 + - django: 2.1 + python: 3.5 + - django: 2.1 + python: 3.6 + - django: 2.1 + python: 3.7 + + # TODO: test on mac OS & windows? + os: + - ubuntu-latest + + + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.versions.python }} + + - name: Get pip cache dir + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: + ${{ matrix.os }}-${{ matrix.versions.python }}-v1-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ matrix.os }}-${{ matrix.versions.python }}-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U tox + + - name: Tox tests + shell: bash + run: tox -e py${{ matrix.versions.python }}-dj${{ matrix.versions.django }} + + lint: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + linter: + - flake8 + - readme + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U tox + + - run: tox -e ${{ matrix.linter }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3bc2cc0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -dist: xenial -language: python -sudo: false -python: -- '2.7' -- '3.5' -- '3.6' -- '3.7' -cache: pip -env: - - DJANGO="2.0" - - DJANGO="2.1" - - DJANGO="1.11" -install: -- travis_retry pip install tox-travis -script: -- tox - -jobs: - exclude: - - env: DJANGO="2.0" - python: '2.7' - - env: DJANGO="2.1" - python: '2.7' - include: - - stage: deploy - install: skip - script: skip - python: 2.7 - env: skip - deploy: - provider: pypi - user: jazzband - server: https://jazzband.co/projects/django-redshift-backend/upload - distributions: sdist bdist_wheel - password: - secure: Ce8w7iTF3Cc/Tu8PPDUYtzFiSQIzjSjeFx+lPintaSJA7V/ndARWBvVLFSKghzayB5vPihDs934O0HbTsRAKHB4ChEzOiFH6u2utLkxPgqpKbmAbTRn12Xv46mwSNWV7XBnTOs8AzfqEI7y/fHDO6DT1j4FNGgyRqclH4GgsibU= - on: - tags: true - repo: jazzband/django-redshift-backend diff --git a/README.rst b/README.rst index d1fe61c..14b90d2 100644 --- a/README.rst +++ b/README.rst @@ -26,9 +26,9 @@ This is a `Amazon Redshift`_ database backend for Django_. :alt: License :target: https://github.com/jazzband/django-redshift-backend/blob/master/LICENSE -.. image:: https://img.shields.io/travis/jazzband/django-redshift-backend/master.svg - :alt: Travis (.org) branch - :target: https://travis-ci.org/jazzband/django-redshift-backend +.. image:: https://img.shields.io/github/workflow/status/jazzband/django-redshift-backend/CI/master + :alt: CI Status + :target: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI .. image:: https://img.shields.io/github/stars/jazzband/django-redshift-backend.svg?style=social&label=Stars :alt: GitHub stars diff --git a/checklist.rst b/checklist.rst index 6cc33b3..cb9a7e3 100644 --- a/checklist.rst +++ b/checklist.rst @@ -2,10 +2,10 @@ Procedure: -1. check travis-ci testing result: https://travis-ci.org/jazzband/django-redshift-backend +1. check CI status testing result: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI 2. update release version/date in ``CHANGES.rst`` 3. tagging with version name that MUST following semver. e.g.: ``git tag 1.0.1`` -4. ``git push --tags`` to invoke release process on travis-ci. +4. ``git push --tags`` to invoke release process in Github Actions. 5. approve release files. please check your email or https://jazzband.co/projects/django-redshift-backend 6. check PyPI page: https://pypi.org/p/django-redshift-backend 7. bump version in ``CHANGES.rst`` and commit/push them onto GitHub diff --git a/doc/dev.rst b/doc/dev.rst index f5b8f4d..08dc364 100644 --- a/doc/dev.rst +++ b/doc/dev.rst @@ -38,9 +38,9 @@ tox have several sections for testing. CI (Continuous Integration) ---------------------------- -All tests will be run on Travis CI service. +All tests will be run on Github Actions: -* https://travis-ci.org/jazzband/django-redshift-backend +* https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI Pull Request diff --git a/doc/index.rst b/doc/index.rst index 6d311c4..523a9f7 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -26,9 +26,9 @@ This is a `Amazon Redshift`_ database backend for Django_. :alt: License :target: https://github.com/jazzband/django-redshift-backend/blob/master/LICENSE -.. image:: https://img.shields.io/travis/jazzband/django-redshift-backend/master.svg - :alt: Travis (.org) branch - :target: https://travis-ci.org/jazzband/django-redshift-backend +.. image:: https://img.shields.io/github/workflow/status/jazzband/django-redshift-backend/CI/master + :alt: CI Status + :target: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI .. image:: https://img.shields.io/github/stars/jazzband/django-redshift-backend.svg?style=social&label=Stars :alt: GitHub stars diff --git a/tox.ini b/tox.ini index af3127e..464168c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,26 +1,13 @@ [tox] envlist = - py{27,35,36}-dj111, - py{35,36,37}-dj20, - py{35,36,37}-dj21, + py{2.7,3.5,3.6}-dj1.11, + py{3.5,3.6,3.7}-dj2.0, + py{3.5,3.6,3.7}-dj2.1, flake8, isort, readme skipsdist = True -[travis] -python = - 2.7: py27 - 3.5: py35 - 3.6: py36,flake8,readme - 3.7: py37 - -[travis:env] -DJANGO = - 1.11: dj111 - 2.0: dj20 - 2.1: dj21 - [testenv] deps = dj111: Django>=1.11,<1.12 From b6e543ee245e8857f5fdeebaa249358dd9939bd9 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 6 Nov 2020 14:37:51 +0000 Subject: [PATCH 04/14] Move CI to Github Actions - take 2 --- .github/workflows/ci.yml | 46 ++++++++++++++-------------------------- tox.ini | 6 +++--- 2 files changed, 19 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 375a3a6..c5b610b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,28 +15,34 @@ jobs: matrix: # https://docs.djangoproject.com/en/stable/faq/install/#what-python-version-can-i-use-with-django versions: + # Linting + - tox: flake8 + python: 3.6 + - tox: readme + python: 3.6 + # Django 1.11 - - django: 1.11 + - tox: py27-dj111 python: 2.7 - - django: 1.11 + - tox: py35-dj111 python: 3.5 - - django: 1.11 + - tox: py36-dj111 python: 3.6 # Django 2.0 - - django: 2.0 + - tox: py35-dj20 python: 3.5 - - django: 2.0 + - tox: py36-dj20 python: 3.6 - - django: 2.0 + - tox: py37-dj20 python: 3.7 # Django 2.1 - - django: 2.1 + - tox: py35-dj21 python: 3.5 - - django: 2.1 + - tox: py36-dj21 python: 3.6 - - django: 2.1 + - tox: py37-dj21 python: 3.7 # TODO: test on mac OS & windows? @@ -72,24 +78,4 @@ jobs: - name: Tox tests shell: bash - run: tox -e py${{ matrix.versions.python }}-dj${{ matrix.versions.django }} - - lint: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - linter: - - flake8 - - readme - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U tox - - - run: tox -e ${{ matrix.linter }} + run: tox -e ${{ matrix.versions.tox }} diff --git a/tox.ini b/tox.ini index 464168c..0d6b647 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] envlist = - py{2.7,3.5,3.6}-dj1.11, - py{3.5,3.6,3.7}-dj2.0, - py{3.5,3.6,3.7}-dj2.1, + py{27,35,36}-dj111, + py{35,36,37}-dj20, + py{35,36,37}-dj21, flake8, isort, readme From c899afcb9951707d06b570cf39abe44a3c771786 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 6 Nov 2020 14:39:44 +0000 Subject: [PATCH 05/14] Fix flake8 error --- django_redshift_backend/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django_redshift_backend/base.py b/django_redshift_backend/base.py index 4a72fa5..44a3f2a 100644 --- a/django_redshift_backend/base.py +++ b/django_redshift_backend/base.py @@ -92,8 +92,9 @@ def distinct_sql(self, fields, *args): if fields: # https://github.com/jazzband/django-redshift-backend/issues/14 # Redshift doesn't support DISTINCT ON - raise NotSupportedError('DISTINCT ON fields is not supported ' - 'by this database backend') + raise NotSupportedError( + 'DISTINCT ON fields is not supported by this database backend' + ) return super(DatabaseOperations, self).distinct_sql(fields, *args) From b786ee72029b1fc777b7d3a37099ee2482c1ac3e Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 6 Nov 2020 14:51:37 +0000 Subject: [PATCH 06/14] Add deployment step --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5b610b..ec77da6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,8 +49,6 @@ jobs: os: - ubuntu-latest - - steps: - uses: actions/checkout@v2 @@ -79,3 +77,27 @@ jobs: - name: Tox tests shell: bash run: tox -e ${{ matrix.versions.tox }} + + deploy: + runs-on: ubuntu-latest + needs: + - tests + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.6 + + - name: Install dependencies + run: python -m pip install -U pip wheel + + - name: Build packages + run: python setup.py sdist bdist_wheel + + - name: Publish packages + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@v1.4.1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} From 881bfafbd095d673ab6d0fcd61236cdabe739bbd Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 6 Nov 2020 14:53:54 +0000 Subject: [PATCH 07/14] Tidy up --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec77da6..9376bbe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,9 @@ name: CI on: push: -# branches: -# - master + branches: + # Avoid double building for pull requests + - master pull_request: jobs: From b4859a20ddba5089104e85403d1a34e059a7421c Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Fri, 6 Nov 2020 15:07:08 +0000 Subject: [PATCH 08/14] Update trigger for CI workflow --- .github/workflows/ci.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9376bbe..021108b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,9 @@ name: CI -on: - push: - branches: - # Avoid double building for pull requests - - master - pull_request: +on: [push, pull_request] + +env: + FORCE_COLOR: 1 jobs: tests: From 4522fdd86dca1fe1746d169a150864dfce8b47a2 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 8 Nov 2020 13:16:17 +0000 Subject: [PATCH 09/14] Simplify test matrix with tox-gh-actions --- .github/workflows/ci.yml | 45 ++++++++-------------------------------- tox.ini | 13 ++++++++++++ 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 021108b..9a3e46e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,37 +12,8 @@ jobs: strategy: fail-fast: false matrix: - # https://docs.djangoproject.com/en/stable/faq/install/#what-python-version-can-i-use-with-django - versions: - # Linting - - tox: flake8 - python: 3.6 - - tox: readme - python: 3.6 - - # Django 1.11 - - tox: py27-dj111 - python: 2.7 - - tox: py35-dj111 - python: 3.5 - - tox: py36-dj111 - python: 3.6 - - # Django 2.0 - - tox: py35-dj20 - python: 3.5 - - tox: py36-dj20 - python: 3.6 - - tox: py37-dj20 - python: 3.7 - - # Django 2.1 - - tox: py35-dj21 - python: 3.5 - - tox: py36-dj21 - python: 3.6 - - tox: py37-dj21 - python: 3.7 + python-version: ["2.7", "3.6", "3.7"] + django: ["1.11", "2.0", "2.1"] # TODO: test on mac OS & windows? os: @@ -53,7 +24,7 @@ jobs: - uses: actions/setup-python@v2 with: - python-version: ${{ matrix.versions.python }} + python-version: ${{ matrix.python-version }} - name: Get pip cache dir id: pip-cache @@ -64,18 +35,20 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: - ${{ matrix.os }}-${{ matrix.versions.python }}-v1-${{ hashFiles('**/setup.py') }} + ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.django }}-v1-${{ hashFiles('**/setup.py') }} restore-keys: | - ${{ matrix.os }}-${{ matrix.versions.python }}-v1- + ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.django }}-v1- - name: Install dependencies run: | python -m pip install -U pip - python -m pip install -U tox + python -m pip install -U tox tox-gh-actions - name: Tox tests shell: bash - run: tox -e ${{ matrix.versions.tox }} + run: tox + env: + DJANGO: ${{ matrix.django }} deploy: runs-on: ubuntu-latest diff --git a/tox.ini b/tox.ini index 0d6b647..4ba5257 100644 --- a/tox.ini +++ b/tox.ini @@ -8,6 +8,19 @@ envlist = readme skipsdist = True +[gh-actions] +python = + 2.7: py27 + 3.5: py35 + 3.6: py36,flake8,readme + 3.7: py37 + +[gh-actions:env] +DJANGO = + 1.11: dj111 + 2.0: dj20 + 2.1: dj21 + [testenv] deps = dj111: Django>=1.11,<1.12 From 8309124d0fc3739d998e78f631412242c367de9c Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 8 Nov 2020 13:30:12 +0000 Subject: [PATCH 10/14] Exclude unsuitable matrix combinations --- .github/workflows/ci.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9a3e46e..6c5e182 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,19 +12,22 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["2.7", "3.6", "3.7"] + python: ["2.7", "3.6", "3.7"] django: ["1.11", "2.0", "2.1"] - # TODO: test on mac OS & windows? - os: - - ubuntu-latest + os: [ubuntu-latest] + exclude: + - django: "2.0" + python: "2.7" + - django: "2.1" + python: "2.7" steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python }} - name: Get pip cache dir id: pip-cache @@ -35,9 +38,9 @@ jobs: with: path: ${{ steps.pip-cache.outputs.dir }} key: - ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.django }}-v1-${{ hashFiles('**/setup.py') }} + ${{ matrix.os }}-${{ matrix.python }}-${{ matrix.django }}-v1-${{ hashFiles('**/setup.py') }} restore-keys: | - ${{ matrix.os }}-${{ matrix.python-version }}-${{ matrix.django }}-v1- + ${{ matrix.os }}-${{ matrix.python }}-${{ matrix.django }}-v1- - name: Install dependencies run: | From a2876bf4d1719d7748fb3e0a4e056743df01d4f4 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 8 Nov 2020 13:34:29 +0000 Subject: [PATCH 11/14] Add Python 3.5 back --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c5e182..6d6092e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: strategy: fail-fast: false matrix: - python: ["2.7", "3.6", "3.7"] + python: ["2.7", "3.5", "3.6", "3.7"] django: ["1.11", "2.0", "2.1"] # TODO: test on mac OS & windows? os: [ubuntu-latest] From 1ef2bfe28fd7ae2c1fd039599ed2519999b19cee Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 8 Nov 2020 13:37:20 +0000 Subject: [PATCH 12/14] Update deployment steps to use Jazzband index --- .github/workflows/ci.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d6092e..d2316a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,14 +65,20 @@ jobs: python-version: 3.6 - name: Install dependencies - run: python -m pip install -U pip wheel + run: | + python -m pip install -U pip + python -m pip install -U setuptools twine wheel - name: Build packages - run: python setup.py sdist bdist_wheel + run: | + python setup.py --version + python setup.py sdist --format=gztar bdist_wheel + twine check dist/* - - name: Publish packages + - name: Publish packages to Jazzband if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: pypa/gh-action-pypi-publish@v1.4.1 + uses: pypa/gh-action-pypi-publish@master with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} + user: jazzband + password: ${{ secrets.JAZZBAND_RELEASE_KEY }} + repository_url: https://jazzband.co/projects/prettytable/upload From 6e908727dd4a1883ba0101ca34af31fce5d104fb Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 8 Nov 2020 21:03:17 +0000 Subject: [PATCH 13/14] Split CI workflow into test, lint and deploy --- .github/workflows/deploy.yml | 51 ++++++++++++++++++++++++++ .github/workflows/lint.yml | 25 +++++++++++++ .github/workflows/{ci.yml => test.yml} | 32 +--------------- README.rst | 6 +-- checklist.rst | 4 +- doc/dev.rst | 2 +- doc/index.rst | 6 +-- 7 files changed, 86 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/lint.yml rename .github/workflows/{ci.yml => test.yml} (59%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..2b1ff24 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +name: Deploy + +on: + push: + branches: + - master + release: + types: + - published + +jobs: + deploy: + if: github.repository == 'jazzband/django-redshift-backend' + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Cache + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: deploy-${{ hashFiles('**/setup.py') }} + restore-keys: | + deploy- + - 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: Publish package to Jazzband + if: github.event.action == 'published' + uses: pypa/gh-action-pypi-publish@master + + with: + user: jazzband + password: ${{ secrets.JAZZBAND_RELEASE_KEY }} + repository_url: https://jazzband.co/projects/django-redshift-backend/upload diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..6554a2b --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + linter: + - flake8 + - readme + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.6 + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U tox + - run: tox -e ${{ matrix.linter }} diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 59% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index d2316a8..943b8be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: CI +name: Test on: [push, pull_request] @@ -52,33 +52,3 @@ jobs: run: tox env: DJANGO: ${{ matrix.django }} - - deploy: - runs-on: ubuntu-latest - needs: - - tests - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: 3.6 - - - name: Install dependencies - run: | - python -m pip install -U pip - python -m pip install -U setuptools twine wheel - - - name: Build packages - run: | - python setup.py --version - python setup.py sdist --format=gztar bdist_wheel - twine check dist/* - - - name: Publish 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/prettytable/upload diff --git a/README.rst b/README.rst index 14b90d2..6a396fd 100644 --- a/README.rst +++ b/README.rst @@ -26,9 +26,9 @@ This is a `Amazon Redshift`_ database backend for Django_. :alt: License :target: https://github.com/jazzband/django-redshift-backend/blob/master/LICENSE -.. image:: https://img.shields.io/github/workflow/status/jazzband/django-redshift-backend/CI/master - :alt: CI Status - :target: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI +.. image:: https://img.shields.io/github/workflow/status/jazzband/django-redshift-backend/Test/master + :alt: Tests + :target: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ATest .. image:: https://img.shields.io/github/stars/jazzband/django-redshift-backend.svg?style=social&label=Stars :alt: GitHub stars diff --git a/checklist.rst b/checklist.rst index cb9a7e3..31abc31 100644 --- a/checklist.rst +++ b/checklist.rst @@ -4,8 +4,8 @@ Procedure: 1. check CI status testing result: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI 2. update release version/date in ``CHANGES.rst`` -3. tagging with version name that MUST following semver. e.g.: ``git tag 1.0.1`` -4. ``git push --tags`` to invoke release process in Github Actions. +3. create Github release, tagging with version name that MUST following semver. e.g.: ``git tag 1.0.1`` +4. publish Github release to invoke release process in Github Actions. 5. approve release files. please check your email or https://jazzband.co/projects/django-redshift-backend 6. check PyPI page: https://pypi.org/p/django-redshift-backend 7. bump version in ``CHANGES.rst`` and commit/push them onto GitHub diff --git a/doc/dev.rst b/doc/dev.rst index 08dc364..aba8166 100644 --- a/doc/dev.rst +++ b/doc/dev.rst @@ -40,7 +40,7 @@ CI (Continuous Integration) All tests will be run on Github Actions: -* https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI +* https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ATest Pull Request diff --git a/doc/index.rst b/doc/index.rst index 523a9f7..aebcd36 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -26,9 +26,9 @@ This is a `Amazon Redshift`_ database backend for Django_. :alt: License :target: https://github.com/jazzband/django-redshift-backend/blob/master/LICENSE -.. image:: https://img.shields.io/github/workflow/status/jazzband/django-redshift-backend/CI/master - :alt: CI Status - :target: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ACI +.. image:: https://img.shields.io/github/workflow/status/jazzband/django-redshift-backend/Test/master + :alt: Tests + :target: https://github.com/jazzband/django-redshift-backend/actions?query=workflow%3ATest .. image:: https://img.shields.io/github/stars/jazzband/django-redshift-backend.svg?style=social&label=Stars :alt: GitHub stars From 0ae3dcc6a472ee8dce631f30890254c27dd8dd75 Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 8 Nov 2020 22:52:43 +0000 Subject: [PATCH 14/14] Update Github actions matrix --- .github/workflows/test.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 943b8be..0ae029a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,8 +12,8 @@ jobs: strategy: fail-fast: false matrix: - python: ["2.7", "3.5", "3.6", "3.7"] - django: ["1.11", "2.0", "2.1"] + python: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9"] + django: ["1.11", "2.0", "2.1", "2.2", "3.0", "3.1"] # TODO: test on mac OS & windows? os: [ubuntu-latest] exclude: @@ -21,6 +21,31 @@ jobs: python: "2.7" - django: "2.1" python: "2.7" + - django: "2.2" + python: "2.7" + - django: "3.0" + python: "2.7" + - django: "3.1" + python: "2.7" + + - django: "3.0" + python: "3.5" + - django: "3.1" + python: "3.5" + + - django: "1.11" + python: "3.8" + - django: "2.0" + python: "3.8" + - django: "2.1" + python: "3.8" + + - django: "1.11" + python: "3.9" + - django: "2.0" + python: "3.9" + - django: "2.1" + python: "3.9" steps: - uses: actions/checkout@v2