Improved compatibility with both tox>3,<4 and tox>=4
Tox>3,<4 does not support dots in generative envlists and tox>=4 changed
its behaviour when it detects hyphens in env names [1].
[1] 0580121601/src/tox/tox_env/python/api.py (L130)
Change-Id: I63ad716415755d2a140a6ade97d22bd18236a0df
This commit is contained in:
parent
85fa2bb2b6
commit
7945d7f01a
15
.zuul.yaml
15
.zuul.yaml
@ -39,7 +39,7 @@
|
||||
- .zuul.yaml
|
||||
vars:
|
||||
zuul_work_dir: src/opendev.org/openstack/ansible-collections-openstack
|
||||
tox_envlist: ansible
|
||||
tox_envlist: ansible_latest
|
||||
tox_install_siblings: true
|
||||
fetch_subunit: false
|
||||
devstack_plugins:
|
||||
@ -125,7 +125,7 @@
|
||||
- name: github.com/ansible/ansible
|
||||
override-checkout: stable-2.9
|
||||
vars:
|
||||
tox_envlist: ansible-2.9
|
||||
tox_envlist: ansible_2_9
|
||||
|
||||
- job:
|
||||
name: ansible-collections-openstack-functional-devstack-ansible-2.11
|
||||
@ -138,7 +138,7 @@
|
||||
- name: github.com/ansible/ansible
|
||||
override-checkout: stable-2.11
|
||||
vars:
|
||||
tox_envlist: ansible-2.11
|
||||
tox_envlist: ansible_2_11
|
||||
|
||||
- job:
|
||||
name: ansible-collections-openstack-functional-devstack-ansible-2.12
|
||||
@ -151,7 +151,7 @@
|
||||
- name: github.com/ansible/ansible
|
||||
override-checkout: stable-2.12
|
||||
vars:
|
||||
tox_envlist: ansible-2.12
|
||||
tox_envlist: ansible_2_12
|
||||
|
||||
- job:
|
||||
name: ansible-collections-openstack-functional-devstack-ansible-devel
|
||||
@ -171,7 +171,6 @@
|
||||
- job:
|
||||
name: openstack-tox-linters-ansible
|
||||
parent: openstack-tox-linters
|
||||
nodeset: ubuntu-focal
|
||||
description: |
|
||||
Run openstack collections linter tests using the devel branch of ansible
|
||||
required-projects:
|
||||
@ -180,7 +179,7 @@
|
||||
vars:
|
||||
# override tox_constraints_file from parent job
|
||||
tox_constraints_file: '{{ ansible_user_dir }}/{{ zuul.project.src_dir }}/tests/constraints-none.txt'
|
||||
tox_envlist: linters
|
||||
tox_envlist: linters_latest
|
||||
tox_install_siblings: true
|
||||
|
||||
- job:
|
||||
@ -198,13 +197,15 @@
|
||||
- job:
|
||||
name: openstack-tox-linters-ansible-2.12
|
||||
parent: openstack-tox-linters-ansible
|
||||
nodeset: ubuntu-focal
|
||||
description: |
|
||||
Run openstack collections linter tests using the 2.12 branch of ansible
|
||||
required-projects:
|
||||
- name: github.com/ansible/ansible
|
||||
override-checkout: stable-2.12
|
||||
vars:
|
||||
tox_envlist: linters-2.12
|
||||
ensure_tox_version: '<4'
|
||||
tox_envlist: linters_2_12
|
||||
python_version: 3.8
|
||||
bindep_profile: test py38
|
||||
|
||||
|
87
tox.ini
87
tox.ini
@ -1,16 +1,15 @@
|
||||
[tox]
|
||||
minversion = 3.18.0
|
||||
envlist = linters
|
||||
envlist = linters_latest,ansible_latest
|
||||
skipsdist = True
|
||||
ignore_basepython_conflict = True
|
||||
|
||||
[testenv]
|
||||
skip_install = True
|
||||
install_command = python -m pip install {opts} {packages}
|
||||
install_command = python3 -m pip install {opts} {packages}
|
||||
basepython = python3
|
||||
passenv =
|
||||
OS_*
|
||||
pip: PIP_INSTALL
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
LANG=en_US.UTF-8
|
||||
@ -19,17 +18,16 @@ setenv =
|
||||
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]
|
||||
# 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
|
||||
@ -44,37 +42,21 @@ commands =
|
||||
ansible-galaxy collection build --force {toxinidir} --output-path {toxinidir}/build_artifact
|
||||
bash {toxinidir}/tools/check-import.sh {toxinidir}
|
||||
|
||||
[testenv:linters]
|
||||
[testenv:linters_{2_9,2_11,2_12,latest}]
|
||||
allowlist_externals = bash
|
||||
passenv = *
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
commands =
|
||||
{[testenv:build]commands}
|
||||
{[testenv:pep8]commands}
|
||||
flake8
|
||||
ansible --version
|
||||
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
|
||||
{[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
|
||||
passenv = *
|
||||
|
||||
[flake8]
|
||||
# W503 Is supposed to be off by default but in the latest pycodestyle isn't.
|
||||
@ -87,46 +69,29 @@ ignore = W503,H4,E501,E402,H301
|
||||
show-source = True
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,ansible_collections
|
||||
|
||||
[testenv:ansible]
|
||||
[testenv:ansible_{2_9,2_11,2_12,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
|
||||
# Need to pass some env vars for the Ansible playbooks
|
||||
passenv =
|
||||
HOME
|
||||
USER
|
||||
ANSIBLE_*
|
||||
deps =
|
||||
{[testenv]deps}
|
||||
commands =
|
||||
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]
|
||||
[testenv:galaxy_release]
|
||||
allowlist_externals = mkdir rm sed
|
||||
deps =
|
||||
ansible-core
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user