Skip to content

Commit c64e4eb

Browse files
authored
ci: used tox instead gofrolist/molecule-action (#25)
1 parent 4a18fe3 commit c64e4eb

File tree

4 files changed

+37
-24
lines changed

4 files changed

+37
-24
lines changed

.github/workflows/molecule.yml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ jobs:
1616
- name: 'Set up Python 3'
1717
uses: 'actions/setup-python@v5'
1818
with:
19-
python-version: '3.x'
20-
21-
- name: 'Install linters'
22-
run: pip3 install ansible-core==2.16.7 ansible-lint==24.5.0 yamllint==1.35.1
19+
python-version: '3.12'
2320

2421
- name: 'Run linters'
2522
run: |
26-
yamllint .
27-
ansible-lint
23+
pip3 install --no-cache-dir tox
24+
tox -e lint
2825
2926
molecule:
3027
name: 'Molecule'
@@ -52,12 +49,14 @@ jobs:
5249
- name: 'Checkout the codebase'
5350
uses: 'actions/checkout@v4'
5451

55-
- name: 'Testing an Ansible role with Molecule'
56-
uses: 'gofrolist/molecule-action@v2'
52+
- name: 'Set up Python 3'
53+
uses: 'actions/setup-python@v5'
5754
with:
58-
molecule_command: 'test'
59-
molecule_args: --scenario-name ${{ matrix.scenario }}
55+
python-version: '3.12'
56+
57+
- name: 'Testing an Ansible role with Molecule'
58+
run: |
59+
pip3 install --no-cache-dir tox
60+
tox -- test -s ${{ matrix.scenario }}
6061
env:
61-
PY_COLORS: '1'
62-
ANSIBLE_FORCE_COLOR: '1'
6362
TAG: ${{ matrix.distro }}

molecule/tls-and-basic-auth/prepare.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@
1616
- name: 'Install the dependencies for basic authentication and certificate generation'
1717
ansible.builtin.pip:
1818
name:
19+
- 'bcrypt==4.0.1'
1920
- 'cryptography'
20-
- 'passlib[bcrypt]'
21+
- 'passlib'
2122

2223
- name: 'Create a private key (RSA, 4096 bits)'
2324
community.crypto.openssl_privatekey:

tox-requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
ansible-lint == 6.*
2-
molecule == 5.*
1+
molecule == 24.*
32
molecule-plugins[docker] == 23.*

tox.ini

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
11
[tox]
22
min_version = 4.0
3-
env_list = ansible{7,8}
3+
env_list = ansible-core2.16
44

55
[testenv]
6+
basepython = python3.12
7+
8+
[testenv:lint]
69
deps =
7-
-rtox-requirements.txt
8-
ansible7: ansible == 7.*
9-
ansible8: ansible == 8.*
10+
ansible-core == 2.16.*
11+
ansible-lint == 24.*
12+
yamllint
1013

11-
commands = molecule test
14+
commands =
15+
yamllint .
16+
ansible-lint
1217

13-
setenv =
14-
PY_COLORS=1
15-
ANSIBLE_FORCE_COLOR=1
16-
TOX_ENVNAME=-{envname}
18+
[testenv:ansible-core{2.15,2.16,2.17}]
19+
deps =
20+
-rtox-requirements.txt
21+
ansible-core2.15: ansible-core==2.15.*
22+
ansible-core2.16: ansible-core==2.16.*
23+
ansible-core2.17: ansible-core==2.17.*
24+
25+
commands = molecule {posargs: test}
1726

1827
passenv =
1928
NAMESPACE
2029
IMAGE
2130
TAG
31+
32+
setenv =
33+
PY_COLORS=1
34+
ANSIBLE_FORCE_COLOR=1
35+
TOX_ENVNAME=-{envname}

0 commit comments

Comments
 (0)