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

Migrate to Github Actions #71

Closed
wants to merge 11 commits into from
Closed
102 changes: 102 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: CI

on: [push, pull_request]

env:
FORCE_COLOR: 1

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:
# 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

# 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 ${{ matrix.versions.tox }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've seen the results of your execution. I think it's perfect 🎉
https://github.com/browniebroke/django-redshift-backend/runs/1364264120


deploy:
runs-on: ubuntu-latest
needs:
- tests

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the deploy step used to run on Python 2.7.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since django-redshift-backend doesn't create a binary wheel, so I don't think that's a problem.


- 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know about the Jazzband way of releasing, but I think pypa/gh-action-pypi-publish with the API provided by PyPI would be better in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jezdez please check this deploy section. After you agree on the deploy section, we can merge this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't using the Jazzband package index, so will need to update to use it. I'll get to do a proper review later tonight. Don't merge this before.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked at Jazzband's release process and I think I get it... Packages are not published to PyPI directly, they are first going to Jazzband package index which in turns publich to PyPI? I'll copy the publish part from prettytable, should be a good starting point.

with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
40 changes: 0 additions & 40 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions checklist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions django_redshift_backend/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Comment on lines +95 to +97
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return super(DatabaseOperations, self).distinct_sql(fields, *args)


Expand Down
4 changes: 2 additions & 2 deletions doc/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@ envlist =
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
Expand Down