From c1b0b3b045891212d8fa2831d231fcb05da07a7d Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Sun, 8 Nov 2020 21:03:17 +0000 Subject: [PATCH] Split CI workflow into 3 as requested --- .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..c63526e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: [push, pull_request] + +jobs: + build: + 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