Initial Tox/Zuul setup

Signed-off-by: Scott Little <scott.little@windriver.com>
Change-Id: I0029816399c2b346c66a78ab9744c23784069506
This commit is contained in:
Scott Little 2023-02-15 13:44:42 -05:00
parent 11a071fac6
commit 0293c76b36
3 changed files with 70 additions and 0 deletions

7
.zuul.yaml Normal file
View File

@ -0,0 +1,7 @@
- project:
check:
jobs:
- openstack-tox-linters
gate:
jobs:
- openstack-tox-linters

3
test-requirements.txt Normal file
View File

@ -0,0 +1,3 @@
bashate >= 0.2
PyYAML >= 3.1.0
yamllint >= 0.5.2

60
tox.ini Normal file
View File

@ -0,0 +1,60 @@
[tox]
envlist = linters
minversion = 2.3
skipsdist = True
[testenv]
install_command = pip install -U {opts} {packages}
setenv = VIRTUAL_ENV={envdir}
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps = -r{toxinidir}/test-requirements.txt
[testenv:linters]
basepython = python3
allowlist_externals = bash
# Bashate warnings
# E001 Trailing Whitespace
# E002 Tab indents
# E003 Indent not multiple of 4
# E006 Line too long
# E010 The "do" should be on same line as for
# E011 Then keyword is not on same line as if or elif keyword
# E020 Function declaration not in format ^function name {$
# E042 local declaration hides errors
commands =
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*~ \
-not -name \*.md \
-name \*.sh \
-print0 | xargs --no-run-if-empty -0 bashate -v -e 'E*' -i E003,E006,E010"
bash -c "find {toxinidir} \
-not \( -type d -name .?\* -prune \) \
-type f \
-not -name \*~ \
-not -name \*.md \
\( -exec bash -c 'file \{\} | grep -q shell' \; \
-a ! -name '*.sh' \) \
-print0 | xargs --no-run-if-empty -0 bashate -v -e 'E*' -i E001,E002,E003,E006,E010,E011,E020,E042"
bash -c "find {toxinidir} \
\( -name stx -prune \) \
-o \( -name .tox -prune \) \
-o -type f -name '*.yaml' \
-print0 | xargs -0 yamllint"
[testenv:pep8]
basepython = python3
usedevelop = False
skip_install = True
deps =
pep8
commands =
pep8
[testenv:venv]
basepython = python3
commands = {posargs}