Add checks as a separate workflow

Run test suite only for PRs and master
This commit is contained in:
Peter Bittner 2020-12-03 23:53:57 +01:00
parent 5daa0c5329
commit 41b8c243d4
3 changed files with 52 additions and 9 deletions

35
.github/workflows/check.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Check
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env:
- isort
- flake8
- bandit
- readme
- docs
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install prerequisites
run: python -m pip install --upgrade setuptools pip wheel tox
- name: Run ${{ matrix.env }}
run: tox -e ${{ matrix.env }}

View file

@ -1,8 +1,12 @@
name: Test
on:
- push
- pull_request
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build:
@ -48,7 +52,7 @@ jobs:
python -m pip install --upgrade pip
python -m pip install --upgrade tox tox-gh-actions
- name: "Unit tests for py${{ matrix.python-version }}-django${{ matrix.django-version }}"
- name: Unit tests for py${{ matrix.python-version }}-django${{ matrix.django-version }}
run: tox
env:
DJANGO: ${{ matrix.django-version }}

16
tox.ini
View file

@ -1,10 +1,14 @@
[tox]
envlist =
isort
flake8
bandit
# Python/Django combinations that are officially supported
py{36,37,38,39}-django{22}
py{36,37,38,39,310}-django{32}
py{38,39,310}-django{40}
py37-{flake8,bandit,readme,docs,isort}
readme
docs
[testenv]
description = Unit tests
@ -33,30 +37,30 @@ DJANGO =
3.2: django32
4.0: django40
[testenv:py37-bandit]
[testenv:bandit]
description = PyCQA security linter
deps = bandit<1.6
commands = - bandit -r --ini tox.ini
ignore_errors = true
[testenv:py37-docs]
[testenv: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:py37-flake8]
[testenv:flake8]
description = Static code analysis and code style
deps = flake8
commands = flake8
[testenv:py37-isort]
[testenv:isort]
description = Ensure imports are ordered
skip_install = True
deps = isort
commands = isort tests setup.py analytical --check --diff
[testenv:py37-readme]
[testenv:readme]
description = Ensure README renders on PyPI
deps = twine
commands =