zuul-jobs/tox.ini
Hugo Brito 2e5c8c05c8 Fix constraints file in tox.ini
The constraints file used for tox.ini was removed. We need to
update the file to use the StarlingX Debian constraints file.

Test Plan:
PASS - Run tox command

Closes-bug: 2055734

Change-Id: I8fb79937a04c62096f8b638581000c08e18f39a7
Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
2024-03-01 19:22:41 -03:00

109 lines
3.4 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]
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/starlingx/root/raw/branch/master/build-tools/requirements/debian/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'