kayobe/tox.ini
Mark Goddard 7ed7b27bc4 Add retries to ansible galaxy install for all envs
Galaxy install often fails in CI, scuppering an otherwise good run.

Change-Id: I3d02afe33cdf32b1d285bd4bdc4a8074883113ca
2019-07-04 13:02:04 +00:00

142 lines
4.3 KiB
INI

[tox]
minversion = 2.0
envlist = py3,py27,pep8
skipsdist = True
[testenv]
usedevelop = True
install_command = pip install {opts} {packages}
passenv =
HOME
whitelist_externals =
bash
rm
setenv =
VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning
OS_STDOUT_CAPTURE=1
OS_STDERR_CAPTURE=1
OS_TEST_TIMEOUT=60
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
commands = stestr run {posargs}
[testenv:pep8]
basepython = python3
commands =
{toxinidir}/tools/run-bashate.sh
flake8 {posargs} kayobe
# Check the *.rst files
# We use a thin wrapper around doc8 currently, which has support for sphinx
# directives.
{toxinidir}/tools/sphinx8 README.rst CONTRIBUTING.rst doc/source --ignore D001
yamllint etc/kayobe
[testenv:venv]
basepython = python3
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = {posargs}
[testenv:ansible]
# Kolla currently fails during password generation under python3. Revisit in Rocky.
basepython = python2
usedevelop = True
# Create the virtualenv with access to system site packages, as this is
# required to use the python and apt modules, which are not available via PyPI.
sitepackages = True
commands =
# Install ansible role dependencies from Galaxy.
{toxinidir}/tools/ansible-galaxy-retried.sh install \
-r {toxinidir}/requirements.yml \
-p {toxinidir}/ansible/roles
{toxinidir}/tools/test-ansible.sh {posargs}
[testenv:molecule]
# Molecule only supports python 2.7 and 3.6.
basepython = python2
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt}
-r{toxinidir}/test-requirements.txt
-r{toxinidir}/doc/requirements.txt
whitelist_externals =
bash
commands =
# Install ansible role dependencies from Galaxy.
{toxinidir}/tools/ansible-galaxy-retried.sh install \
-r {toxinidir}/requirements.yml \
-p {toxinidir}/ansible/roles
bash -c "source {envdir}/bin/activate && {toxinidir}/tools/test-molecule.sh {posargs}"
[testenv:alint]
basepython = python3
commands = ansible-lint ansible/*.yaml
[testenv:ansible-syntax]
basepython = python3
commands =
# Install ansible role dependencies from Galaxy.
{toxinidir}/tools/ansible-galaxy-retried.sh install \
-r {toxinidir}/requirements.yml \
-p {toxinidir}/ansible/roles
# Perform an Ansible syntax check. Skip some playbooks which require extra
# variables to be defined.
bash -c \
"ansible-playbook \
--connection=local \
--syntax-check \
--list-tasks \
$(find {toxinidir}/ansible \
-maxdepth 1 \
-name '*.yml' \
-not -name idrac-bootstrap-one.yml \
-not -name idrac-bootstrap.yml) \
{posargs}"
[testenv:cover]
basepython = python3
setenv =
VIRTUAL_ENV={envdir}
PYTHON=coverage run --source kayobe --parallel-mode
commands =
coverage erase
stestr run {posargs}
coverage combine
coverage report
coverage html -d cover
coverage xml -o cover/coverage.xml
[testenv:docs]
basepython = python3
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W -b html doc/source doc/build/html
[testenv:debug]
basepython = python3
commands = oslo_debug_helper {posargs}
[testenv:releasenotes]
basepython = python3
deps =
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt}
-r{toxinidir}/requirements.txt
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf releasenotes/build
sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build