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/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..943b8be --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,54 @@ +name: Test + +on: [push, pull_request] + +env: + FORCE_COLOR: 1 + +jobs: + tests: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + 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] + 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 }} + + - 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.python }}-${{ matrix.django }}-v1-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ matrix.os }}-${{ matrix.python }}-${{ matrix.django }}-v1- + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U tox tox-gh-actions + + - name: Tox tests + shell: bash + run: tox + env: + DJANGO: ${{ matrix.django }} 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..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/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/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 6cc33b3..31abc31 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. +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/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) diff --git a/doc/dev.rst b/doc/dev.rst index f5b8f4d..aba8166 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%3ATest Pull Request diff --git a/doc/index.rst b/doc/index.rst index 6d311c4..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/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/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/tox.ini b/tox.ini index af3127e..4ba5257 100644 --- a/tox.ini +++ b/tox.ini @@ -8,14 +8,14 @@ envlist = readme skipsdist = True -[travis] +[gh-actions] python = 2.7: py27 3.5: py35 3.6: py36,flake8,readme 3.7: py37 -[travis:env] +[gh-actions:env] DJANGO = 1.11: dj111 2.0: dj20