Skip to content

Commit

Permalink
Tox reintroduced.
Browse files Browse the repository at this point in the history
  • Loading branch information
robert-de-bock committed Jul 20, 2024
1 parent d9fa8aa commit 66bab3e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 44 deletions.
8 changes: 3 additions & 5 deletions files/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
ansible-compat == 24.*
molecule == 24.*
molecule-plugins[docker] == 23.*
ansible-lint == 24.*
paramiko == 3.*
molecule
molecule-plugins[docker]
paramiko
28 changes: 13 additions & 15 deletions generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,19 @@
mode: "0644"
when:
- generate_ansible_lint
# Since May 2024, tox stopped working, throwing this error:
# CRITICAL Unable to contact the Docker daemon. Please refer to https://docs.docker.com/config/daemon/ for managing the daemon
# It's disabled for now.
# - name: Render file tox.ini
# ansible.builtin.template:
# src: "{{ playbook_dir }}/templates/tox.ini.j2"
# dest: "{{ role_path }}/tox.ini"
# mode: "0644"
# when:
# - generate_tox

- name: Remove tox.ini
ansible.builtin.file:
path: "{{ role_path }}/tox.ini"
state: absent

- name: Render file tox.ini
ansible.builtin.template:
src: "{{ playbook_dir }}/templates/tox.ini.j2"
dest: "{{ role_path }}/tox.ini"
mode: "0644"
when:
- generate_tox

# - name: Remove tox.ini
# ansible.builtin.file:
# path: "{{ role_path }}/tox.ini"
# state: absent

- name: Render file .github/settings.yml
ansible.builtin.template:
Expand Down
69 changes: 45 additions & 24 deletions templates/tox.ini.j2
Original file line number Diff line number Diff line change
@@ -1,35 +1,56 @@
{{ ansible_managed | comment }}
[tox]
minversion = 4.2.4
{% if tox_ansible_versions is defined %}
envlist = py3-ansible{% raw %}{{% endraw %}{% for version in tox_ansible_versions %}{{ version }}{% if not loop.last %},{% endif %}{% endfor %}{% raw %}}{% endraw %}
{% else %}
envlist = py3-ansible{8,9,10}
{% endif %}

envlist = ansible-2.{12,13,14,15,16,17}
skipsdist = true

[testenv]
deps =
-rrequirements.txt
ansible8: ansible == 8.*
ansible9: ansible == 9.*
ansible10: ansible == 10.*

commands = molecule test

setenv =
TOX_ENVNAME={envname}
PY_COLORS=1
ANSIBLE_FORCE_COLOR=1
ANSIBLE_ROLES_PATH=../

passenv =
namespace
image
tag
DOCKER_HOST
{% if github_variables_mapping is defined %}
{% for item in github_variables_mapping %}
{{ item.variable }}
{% endfor %}
{% endif %}
passenv = namespace, image, tag, DOCKER_HOST

[testenv:ansible-2.12]
basepython = python3.8
deps =
-rrequirements.txt
ansible-core==2.12.*
ansible-lint==5.*

[testenv:ansible-2.13]
basepython = python3.8
deps =
-rrequirements.txt
ansible-core==2.13.*
ansible-lint==5.*

[testenv:ansible-2.14]
basepython = python3.9
deps =
-rrequirements.txt
ansible-core==2.14.*
ansible-lint==6.*

[testenv:ansible-2.15]
basepython = python3.9
deps =
-rrequirements.txt
ansible-core==2.15.*
ansible-lint==6.*

[testenv:ansible-2.16]
basepython = python3.10
deps =
-rrequirements.txt
ansible-core==2.16.*
ansible-lint==24.*

[testenv:ansible-2.17]
basepython = python3.10
deps =
-rrequirements.txt
ansible-core==2.17.*
ansible-lint==24.*

0 comments on commit 66bab3e

Please sign in to comment.