
This commit will enable the checking of ansible and other linters in this repo. This is more ground work for adding additional zuul jobs that will be used by other repos. Add bashate for checking shell scripts, this is added since we will be adding shell scripts to the zuul-jobs repo as a common location for CI related checks Adding the setup* for tox-docs checking. Change-Id: Ie14b95d9931fdef430d9088fc7a5e80e7266e93a Signed-off-by: Saul Wold <sgw@linux.intel.com>
90 lines
2.7 KiB
INI
90 lines
2.7 KiB
INI
[tox]
|
|
minversion = 1.6
|
|
skipsdist = True
|
|
envlist = linters
|
|
|
|
[testenv]
|
|
basepython = python3
|
|
install_command = pip install {opts} {packages}
|
|
deps = -r{toxinidir}/test-requirements.txt
|
|
|
|
[testenv:bindep]
|
|
# Do not install any requirements. We want this to be fast and work even if
|
|
# system dependencies are missing, since it's used to tell you what system
|
|
# dependencies are missing! This also means that bindep must be installed
|
|
# separately, outside of the requirements files.
|
|
deps = bindep
|
|
commands = bindep test
|
|
|
|
[testenv:docs]
|
|
whitelist_externals = bash
|
|
commands =
|
|
bash -c 'if [ -d doc ]; then \
|
|
python setup.py build_sphinx; \
|
|
fi'
|
|
|
|
[testenv:linters]
|
|
whitelist_externals = bash
|
|
passenv =
|
|
# NOTE(pabelanger): if you'd like to run tox -elinters locally, you'll need
|
|
# to export ANSIBLE_ROLES_PATH pointing to the currect repos.
|
|
# see openstack-zuul-jobs-linters job for more information.
|
|
ANSIBLE_ROLES_PATH
|
|
setenv =
|
|
ANSIBLE_LIBRARY= {envsitepackagesdir}/zuul/ansible/base/library
|
|
ANSIBLE_ACTION_PLUGINS = {envsitepackagesdir}/zuul/ansible/base/actiongeneral
|
|
commands =
|
|
flake8 {posargs}
|
|
# Ansible lint
|
|
# [ANSIBLE0012] Commands should not change things if nothing needs doing
|
|
bash -c 'if [ -d playbooks ]; then \
|
|
find playbooks -type f -regex ".*\.ya?ml" -print0 | xargs -t -n1 -0 \
|
|
ansible-lint -xANSIBLE0012; \
|
|
fi'
|
|
bash -c 'if [ -d roles ]; then \
|
|
find roles -maxdepth 1 -mindepth 1 -type d -printf "%p/\n" | xargs -t -n1 \
|
|
ansible-lint -xANSIBLE0012; \
|
|
fi'
|
|
# Ansible Syntax Check
|
|
bash -c 'if [ -d playbooks ]; then \
|
|
find playbooks -type f -regex ".*\.ya?ml" -print0 | xargs -t -n1 -0 \
|
|
ansible-playbook --syntax-check -i {toxinidir}/tests/inventory; \
|
|
fi'
|
|
# Check Shell Scripts Syntax
|
|
bash -c 'if [ -d scripts ]; then \
|
|
find {toxinidir} \
|
|
-not \( -type d -name .?\* -prune \) \
|
|
-type f \
|
|
-not -name \*~ \
|
|
-not -name \*.md \
|
|
\( \
|
|
-name \*.sh \
|
|
-or -not -wholename \*/devstack/files/\* \
|
|
-wholename \*/devstack/\* \
|
|
\) \
|
|
-print0 | xargs -t -n1 -0 \
|
|
bashate -v -iE006; \
|
|
fi'
|
|
|
|
[testenv:venv]
|
|
commands = {posargs}
|
|
|
|
[flake8]
|
|
# These are ignored intentionally in openstack-infra projects;
|
|
# please don't submit patches that solely correct them or enable them.
|
|
ignore = E125,E129,H
|
|
show-source = True
|
|
exclude = .venv,.tox,dist,doc,build,*.egg
|
|
|
|
[testenv:pep8]
|
|
basepython = python3
|
|
usedevelop = False
|
|
skip_install = True
|
|
deps =
|
|
hacking
|
|
flake8-bugbear<=19.3.0
|
|
flake8<3.6.0
|
|
commands =
|
|
flake8
|
|
|