Skip to content

Commit

Permalink
Merge pull request #169 from jazzband/gha
Browse files Browse the repository at this point in the history
Add initial GitHub Actions workflow.
  • Loading branch information
jezdez committed Nov 25, 2020
2 parents e517bce + 161983f commit 98e7e24
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 92 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
tags:
- '*'

jobs:
build:
if: github.repository == 'jazzband/django-analytical'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: release-${{ hashFiles('**/setup.py') }}
restore-keys: |
release-
- 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: Upload 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/django-analytical/upload
47 changes: 47 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache
uses: actions/cache@v2
with:
path: ${{ steps.pip-cache.outputs.dir }}
key:
-${{ matrix.python-version }}-v1-${{ hashFiles('**/setup.py') }}
restore-keys: |
-${{ matrix.python-version }}-v1-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: Tox tests
run: |
tox -v
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
name: Python ${{ matrix.python-version }}
55 changes: 0 additions & 55 deletions .travis.yml

This file was deleted.

10 changes: 5 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ an asynchronous version of the Javascript code if possible.
.. |latest-version| image:: https://img.shields.io/pypi/v/django-analytical.svg
:alt: Latest version on PyPI
:target: https://pypi.org/project/django-analytical/
.. |build-status| image:: https://img.shields.io/travis/jazzband/django-analytical/master.svg
:alt: Build status
:target: https://travis-ci.org/jazzband/django-analytical
.. |coverage| image:: https://img.shields.io/coveralls/github/jazzband/django-analytical/master.svg
.. |build-status| image:: https://github.com/jazzband/django-analytical/workflows/Test/badge.svg
:target: https://github.com/jazzband/django-analytical/actions
:alt: GitHub Actions
.. |coverage| image:: https://codecov.io/gh/jazzband/django-analytical/branch/master/graph/badge.svg
:alt: Test coverage
:target: https://coveralls.io/r/jazzband/django-analytical
:target: https://codecov.io/gh/jazzband/django-analytical
.. |python-support| image:: https://img.shields.io/pypi/pyversions/django-analytical.svg
:target: https://pypi.org/project/django-analytical/
:alt: Python versions
Expand Down
49 changes: 17 additions & 32 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,69 +1,54 @@
[tox]
envlist =
# Python/Django combinations that are officially supported
py{27,34,35,36,37}-django111
py{27,35,36,37}-django111
py{35,36,37,38}-django22
py{36,37,38}-django30
flake8
bandit
readme
docs
clean
py37-{flake8,bandit,readme,docs}

[testenv]
description = Unit tests
deps =
coverage
coveralls
django111: Django>=1.11,<2.0
django22: Django>=2.2,<3.0
django30: Django>=3.0,<3.1
commands =
coverage run setup.py test
sh -c 'coveralls | true'
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
whitelist_externals = sh
coverage xml

[testenv:bandit]
[gh-actions]
python =
2.7: py27
3.5: py35
3.6: py36
3.7: py37
3.8: py38

[testenv:py37-bandit]
description = PyCQA security linter
deps = bandit<1.6
commands = bandit -r --ini tox.ini
commands = - bandit -r --ini tox.ini
ignore_errors = true

[testenv:clean]
description = Clean up bytecode and build artifacts
deps =
commands =
rm -rf .tox/ django_analytical.egg-info/ build/ dist/ docs/_build/
find {toxinidir} -type f -name '*.pyc' -delete
find {toxinidir} -type d -name '__pycache__' -delete
whitelist_externals =
find
rm

[testenv:docs]
[testenv:py37-docs]
description = Build the HTML documentation
deps = sphinx
commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
whitelist_externals = make

[testenv:flake8]
[testenv:py37-flake8]
description = Static code analysis and code style
deps = flake8
commands = flake8

[testenv:readme]
[testenv:py37-readme]
description = Ensure README renders on PyPI
deps = twine
commands =
{envpython} setup.py -q sdist bdist_wheel
twine check dist/*

[travis:env]
DJANGO =
1.11: django111
2.2: django22
3.0: django30

[bandit]
exclude = .cache,.git,.tox,build,dist,docs,tests
targets = .
Expand Down

0 comments on commit 98e7e24

Please sign in to comment.