4074db1bd0
Change-Id: I4cae065e961a06d44792bef2e6479c30fe242911
103 lines
3.5 KiB
INI
103 lines
3.5 KiB
INI
[tox]
|
|
minversion = 3.18.0
|
|
envlist = linters_latest,ansible_latest
|
|
skipsdist = True
|
|
ignore_basepython_conflict = True
|
|
|
|
[testenv]
|
|
skip_install = True
|
|
install_command = python3 -m pip install {opts} {packages}
|
|
basepython = python3
|
|
passenv =
|
|
OS_*
|
|
setenv =
|
|
VIRTUAL_ENV={envdir}
|
|
LANG=en_US.UTF-8
|
|
LANGUAGE=en_US:en
|
|
LC_ALL=en_US.utf-8
|
|
OS_LOG_CAPTURE={env:OS_LOG_CAPTURE:true}
|
|
OS_STDOUT_CAPTURE={env:OS_STDOUT_CAPTURE:true}
|
|
OS_STDERR_CAPTURE={env:OS_STDERR_CAPTURE:true}
|
|
commands = stestr run {posargs}
|
|
stestr slowest
|
|
|
|
[testenv:pep8]
|
|
# for Zuul CI job tox-pep8
|
|
commands =
|
|
flake8
|
|
deps =
|
|
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
|
|
-r{toxinidir}/tests/requirements.txt
|
|
|
|
[testenv:build]
|
|
allowlist_externals = bash
|
|
deps =
|
|
ansible-core
|
|
galaxy-importer
|
|
pbr
|
|
ruamel.yaml
|
|
setuptools
|
|
commands =
|
|
python {toxinidir}/tools/build.py
|
|
ansible --version
|
|
ansible-galaxy collection build --force {toxinidir} --output-path {toxinidir}/build_artifact
|
|
bash {toxinidir}/tools/check-import.sh {toxinidir}
|
|
|
|
[testenv:linters_{2_9,2_11,2_12,2_16,2_18,latest}]
|
|
allowlist_externals = bash
|
|
commands =
|
|
{[testenv:build]commands}
|
|
flake8
|
|
ansible --version
|
|
bash {toxinidir}/tools/run-ansible-sanity.sh {toxinidir}
|
|
deps =
|
|
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
|
|
{[testenv:build]deps}
|
|
linters_latest: -r{toxinidir}/tests/requirements.txt
|
|
linters_2_9: -r{toxinidir}/tests/requirements-ansible-2.9.txt
|
|
linters_2_11: -r{toxinidir}/tests/requirements-ansible-2.11.txt
|
|
linters_2_12: -r{toxinidir}/tests/requirements-ansible-2.12.txt
|
|
linters_2_16: -r{toxinidir}/tests/requirements-ansible-2.16.txt
|
|
linters_2_16: -r{toxinidir}/tests/requirements-ansible-2.18.txt
|
|
passenv = *
|
|
|
|
[flake8]
|
|
# W503 Is supposed to be off by default but in the latest pycodestyle isn't.
|
|
# Also, both openstacksdk and Donald Knuth disagree with the rule. Line
|
|
# breaks should occur before the binary operator for readability.
|
|
# H4 are rules for docstrings. Maybe we should clean them?
|
|
# E501,E402,H301 are ignored so we can import the existing
|
|
# modules unchanged and then clean them in subsequent patches.
|
|
ignore = W503,H4,E501,E402,H301
|
|
show-source = True
|
|
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible_collections
|
|
|
|
[testenv:ansible_{2_9,2_11,2_12,2_16,2_18,latest}]
|
|
allowlist_externals = bash
|
|
commands =
|
|
bash {toxinidir}/ci/run-ansible-tests-collection.sh -e {envdir} {posargs}
|
|
deps =
|
|
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
|
|
ansible_latest: -r{toxinidir}/tests/requirements.txt
|
|
ansible_2_9: -r{toxinidir}/tests/requirements-ansible-2.9.txt
|
|
ansible_2_11: -r{toxinidir}/tests/requirements-ansible-2.11.txt
|
|
ansible_2_12: -r{toxinidir}/tests/requirements-ansible-2.12.txt
|
|
ansible_2_16: -r{toxinidir}/tests/requirements-ansible-2.16.txt
|
|
ansible_2_18: -r{toxinidir}/tests/requirements-ansible-2.18.txt
|
|
# Need to pass some env vars for the Ansible playbooks
|
|
passenv =
|
|
HOME
|
|
USER
|
|
ANSIBLE_*
|
|
|
|
[testenv:galaxy_release]
|
|
allowlist_externals = mkdir rm sed
|
|
commands =
|
|
rm -rf /tmp/collection_built/
|
|
mkdir -p /tmp/collection_built/
|
|
sed -i "s/version:.*/version: {env:VERSION_TAG}/" {toxinidir}/galaxy.yml
|
|
ansible-galaxy collection build {toxinidir} --output-path /tmp/collection_built/ --force
|
|
ansible-galaxy collection publish /tmp/collection_built/openstack-cloud-{env:VERSION_TAG}.tar.gz --token {env:API_GALAXY_TOKEN}
|
|
deps =
|
|
ansible-core
|