[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] allowlist_externals = bash commands = bash -c 'if [ -d doc ]; then \ python setup.py build_sphinx; \ fi' [testenv:linters] allowlist_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/action 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 [testenv:rpm-packaging-lint] basepython = python3 setenv = VIRTUAL_ENV={envdir} LC_ALL=en_US.utf-8 install_command = pip install -U \ -c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \ {opts} {packages} deps = -r{toxinidir}/test-requirements.txt allowlist_externals = bash commands = bash -c 'if [ -d {toxinidir}/../zuul-jobs ]; then jobsdir={toxinidir}/../zuul-jobs; \ else jobsdir={toxinidir}/../stx-zuul-jobs; \ fi; \ find . \ -not \( -type d -name .?\* -prune \) \ -not \( -type d -name centos -prune \) \ -type f -name \*.spec \ -print0 | xargs -t -0 $jobsdir/tools/spec-tools/speclint.sh'