mirror of
https://github.com/jazzband/django-analytical.git
synced 2026-03-16 22:20:25 +00:00
Improve GHA test jobs, move tool config to pyproject.toml (#202)
* Move Tox tool config settings to pyproject.toml * Restore older Bandit version for predictive setup Bandit UX is seriously broken. Unfortunately, only <1.6 works predictably. * Exclude unsupported Python/Django combinations Use a more self-explanatory build job name for tests * Help pytest find the Django test project settings * Use clean range for Django 4.0 * Keep load on the GHA runners low, use newer Python for checks
This commit is contained in:
parent
051d46ceda
commit
a021e07e15
6 changed files with 49 additions and 29 deletions
1
.bandit
1
.bandit
|
|
@ -1 +0,0 @@
|
||||||
tox.ini
|
|
||||||
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
|
@ -18,7 +18,7 @@ jobs:
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: 3.8
|
python-version: '3.8'
|
||||||
|
|
||||||
- name: Get pip cache dir
|
- name: Get pip cache dir
|
||||||
id: pip-cache
|
id: pip-cache
|
||||||
|
|
|
||||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
|
|
@ -9,7 +9,7 @@ on:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
python-django:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 5
|
max-parallel: 5
|
||||||
|
|
@ -24,6 +24,10 @@ jobs:
|
||||||
- '2.2'
|
- '2.2'
|
||||||
- '3.2'
|
- '3.2'
|
||||||
- '4.0'
|
- '4.0'
|
||||||
|
exclude:
|
||||||
|
- { django-version: '2.2', python-version: '3.10' }
|
||||||
|
- { django-version: '4.0', python-version: '3.6' }
|
||||||
|
- { django-version: '4.0', python-version: '3.7' }
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -4,6 +4,7 @@
|
||||||
/.tox
|
/.tox
|
||||||
/.coverage
|
/.coverage
|
||||||
/coverage.xml
|
/coverage.xml
|
||||||
|
/tests/reports
|
||||||
|
|
||||||
/build
|
/build
|
||||||
/dist
|
/dist
|
||||||
|
|
|
||||||
19
pyproject.toml
Normal file
19
pyproject.toml
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
[tool.bandit]
|
||||||
|
# Exclude/ignore of files is currently broken in Bandit.
|
||||||
|
|
||||||
|
[tool.black]
|
||||||
|
color = true
|
||||||
|
|
||||||
|
[tool.coverage.xml]
|
||||||
|
output = "tests/reports/coverage.xml"
|
||||||
|
|
||||||
|
[tool.isort]
|
||||||
|
color_output = true
|
||||||
|
profile = "black"
|
||||||
|
|
||||||
|
[tool.pylint.master]
|
||||||
|
output-format = "colorized"
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
addopts = "--junitxml=tests/reports/unittests.xml --color=yes --verbose"
|
||||||
|
DJANGO_SETTINGS_MODULE = "tests.testproject.settings"
|
||||||
49
tox.ini
49
tox.ini
|
|
@ -17,48 +17,32 @@ deps =
|
||||||
pytest-django
|
pytest-django
|
||||||
django22: Django>=2.2,<3.0
|
django22: Django>=2.2,<3.0
|
||||||
django32: Django>=3.2,<4.0
|
django32: Django>=3.2,<4.0
|
||||||
django40: Django>=4.0a1,<4.1
|
django40: Django>=4.0,<4.1
|
||||||
|
|
||||||
commands =
|
commands =
|
||||||
coverage run -m pytest
|
coverage run -m pytest
|
||||||
coverage xml
|
coverage xml
|
||||||
|
|
||||||
[gh-actions]
|
|
||||||
python =
|
|
||||||
3.6: py36
|
|
||||||
3.7: py37
|
|
||||||
3.8: py38
|
|
||||||
3.9: py39
|
|
||||||
3.10: py310
|
|
||||||
|
|
||||||
[gh-actions:env]
|
|
||||||
DJANGO =
|
|
||||||
2.2: django22
|
|
||||||
3.2: django32
|
|
||||||
4.0: django40
|
|
||||||
|
|
||||||
[testenv:bandit]
|
[testenv:bandit]
|
||||||
description = PyCQA security linter
|
description = PyCQA security linter
|
||||||
deps = bandit<1.6
|
deps = bandit<1.6
|
||||||
commands = - bandit -r --ini tox.ini
|
commands = -bandit --ini tox.ini {posargs:-r .}
|
||||||
ignore_errors = true
|
|
||||||
|
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
description = Build the HTML documentation
|
description = Build the HTML documentation
|
||||||
deps = sphinx
|
deps = sphinx
|
||||||
commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
|
commands = sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
|
||||||
whitelist_externals = make
|
allowlist_externals = make
|
||||||
|
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
description = Static code analysis and code style
|
description = Static code analysis and code style
|
||||||
deps = flake8
|
deps = flake8
|
||||||
commands = flake8
|
commands = flake8 {posargs}
|
||||||
|
|
||||||
[testenv:isort]
|
[testenv:isort]
|
||||||
description = Ensure imports are ordered
|
description = Ensure imports are ordered consistently
|
||||||
|
deps = isort[colors]
|
||||||
|
commands = isort --check-only --diff {posargs:analytical setup.py tests}
|
||||||
skip_install = True
|
skip_install = True
|
||||||
deps = isort
|
|
||||||
commands = isort tests setup.py analytical --check --diff
|
|
||||||
|
|
||||||
[testenv:readme]
|
[testenv:readme]
|
||||||
description = Ensure README renders on PyPI
|
description = Ensure README renders on PyPI
|
||||||
|
|
@ -73,13 +57,26 @@ deps = pyclean
|
||||||
commands =
|
commands =
|
||||||
pyclean -v {toxinidir}
|
pyclean -v {toxinidir}
|
||||||
rm -rf .tox/ build/ dist/ django_analytical.egg-info/ .coverage coverage.xml
|
rm -rf .tox/ build/ dist/ django_analytical.egg-info/ .coverage coverage.xml
|
||||||
whitelist_externals =
|
allowlist_externals =
|
||||||
rm
|
rm
|
||||||
|
|
||||||
[bandit]
|
[bandit]
|
||||||
exclude = .cache,.git,.tox,build,dist,docs,tests
|
exclude = .git,.github,.tox,build,dist,docs,tests
|
||||||
targets = .
|
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
exclude = .cache,.git,.tox,build,dist
|
exclude = .cache,.git,.tox,build,dist
|
||||||
max-line-length = 100
|
max-line-length = 100
|
||||||
|
|
||||||
|
[gh-actions]
|
||||||
|
python =
|
||||||
|
3.6: py36
|
||||||
|
3.7: py37
|
||||||
|
3.8: py38
|
||||||
|
3.9: py39
|
||||||
|
3.10: py310
|
||||||
|
|
||||||
|
[gh-actions:env]
|
||||||
|
DJANGO =
|
||||||
|
2.2: django22
|
||||||
|
3.2: django32
|
||||||
|
4.0: django40
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue