ansible-collections-openstack/tox.ini
Jakob Meng a03dd05465 Refactored tox requirements for different Ansible releases
Sorted pip requirements file to improve readability.

Moved pip requirements for tests into tests subdirectory and dropped
'pip-' prefix to shorten filenames and conform with common naming
scheme for pip requirements files.

Added constrains on OpenStack SDK 1.*.* to job ansible-collections-\
openstack-functional-devstack-releases on master branch because only
stable/1.0.0 branch is compatible to the OpenStack SDK 0.*.* series.

Changed job ansible-collections-openstack-functional-devstack-releases
on master branch to non-voting because OpenStack SDK 1.*.* has not
been released to PyPI yet, so tests on master branch are expected to
fail once we introduce breaking changes from stable/1.0.0 branch.

Change-Id: I6b6bb8c6900f7c8341bbf3f9a24999fbf693ba4b
2022-03-31 10:35:16 +00:00

131 lines
3.9 KiB
INI

[tox]
minversion = 3.18.0
envlist = linters
skipsdist = True
ignore_basepython_conflict = True
[testenv]
skip_install = True
install_command = python -m pip install {opts} {packages}
basepython = python3
passenv =
OS_*
pip: PIP_INSTALL
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}
pip: PIP_INSTALL={env:PIP_INSTALL:true}
deps =
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements.txt
pip: {toxinidir}
commands = stestr run {posargs}
stestr slowest
[testenv:pep8]
commands =
flake8
[testenv:build]
deps =
ansible-core
galaxy-importer
pbr
ruamel.yaml
commands =
python {toxinidir}/tools/build.py
ansible --version
ansible-galaxy collection build --force {toxinidir} --output-path {toxinidir}/build_artifact
/bin/bash {toxinidir}/tools/check-import.sh {toxinidir}
[testenv:linters]
passenv = *
deps =
{[testenv]deps}
commands =
{[testenv:build]commands}
{[testenv:pep8]commands}
ansible --version
/bin/bash {toxinidir}/tools/run-ansible-sanity.sh {toxinidir}
[testenv:linters-2.9]
passenv = {[testenv:linters]passenv}
commands = {[testenv:linters]commands}
deps =
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.9.txt
[testenv:linters-2.11]
passenv = {[testenv:linters]passenv}
commands = {[testenv:linters]commands}
deps =
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.11.txt
[testenv:linters-2.12]
passenv = {[testenv:linters]passenv}
commands = {[testenv:linters]commands}
deps =
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.12.txt
[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]
# Need to pass some env vars for the Ansible playbooks
passenv =
HOME
USER
ANSIBLE_*
deps =
{[testenv]deps}
commands =
/bin/bash {toxinidir}/ci/run-ansible-tests-collection.sh -e {envdir} {posargs}
[testenv:ansible-2.9]
deps =
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.9.txt
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}
[testenv:ansible-2.11]
deps =
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.11.txt
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}
[testenv:ansible-2.12]
deps =
-c{env:TOX_CONSTRAINTS_FILE:{toxinidir}/tests/constraints-none.txt}
-r{toxinidir}/tests/requirements-ansible-2.12.txt
passenv = {[testenv:ansible]passenv}
commands = {[testenv:ansible]commands}
[testenv:galaxy-release]
deps =
ansible-core
commands =
/usr/bin/mkdir -p /tmp/collection_built
/usr/bin/bash -ec 'rm -rf /tmp/collection_built/*'
/usr/bin/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}