diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..d773cf2 --- /dev/null +++ b/.github/workflows/check.yml @@ -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 }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b946a5..94491a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 }} diff --git a/tox.ini b/tox.ini index 260e4ab..d8c12f8 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =