@@ -14,195 +14,224 @@ on:
1414 - debug
1515 pull_request :
1616 branches :
17- - ' feature/**'
18- - ' fix/**'
19- - ' !doc/**'
17+ - ' main'
2018 paths :
2119 - ' plugins/**'
22- - ' .github/workflows/test_plugins.yml'
23- - ' molecule/plugins/**'
24- - ' .config/pep8.yml'
2520 - ' tests/**'
21+ - ' molecule/plugins/**'
22+ - ' .github/workflows/test_plugins.yml'
2623
2724jobs :
28- pep8 :
25+ sanity_ansible_18_19 :
2926 runs-on : ubuntu-latest
27+ env :
28+ COLLECTION_NAMESPACE : netways
29+ COLLECTION_NAME : elasticstack
30+ strategy :
31+ fail-fast : false
32+ matrix :
33+ python_version :
34+ - " 3.11"
35+ - " 3.12"
36+ - " 3.13"
37+ ansible_version :
38+ - " ansible-core>=2.18,<2.19" # Correspond ansible>=11.0,<12.0
39+ - " ansible-core>=2.19,<2.20" # Correspond ansible>=12.0,<13.0
3040 steps :
31- - name : Check out the codebase.
41+ - name : Check out code
3242 uses : actions/checkout@v6
3343
34- - name : Set up Python 3.
44+ - name : Set up Python ${{ matrix.python_version }}
3545 uses : actions/setup-python@v6
3646 with :
37- python-version : ' 3.x '
47+ python-version : ${{ matrix.python_version }}
3848
39- - name : Install test dependencies.
49+ - name : Install Ansible
4050 run : |
4151 python3 -m pip install --upgrade pip
42- python3 -m pip install pep8
52+ python3 -m pip install "${{ matrix.ansible_version }}"
4353
44- - name : Lint code.
54+ - name : Install collection
4555 run : |
46- pep8 plugins/ --config=.config/pep8.cfg --statistics --count
56+ mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
57+ cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
4758
48- unit-test :
49- needs : pep8
50- runs-on : ubuntu-20.04
59+ - name : Run sanity tests
60+ run : |
61+ cd ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
62+ ansible-test sanity --python "${{ matrix.python_version }}" -v
63+ env :
64+ PY_COLORS : ' 1'
65+ ANSIBLE_FORCE_COLOR : ' 1'
5166
67+ sanity_ansible_20 :
68+ runs-on : ubuntu-latest
5269 env :
5370 COLLECTION_NAMESPACE : netways
5471 COLLECTION_NAME : elasticstack
55-
5672 strategy :
5773 fail-fast : false
58-
74+ matrix :
75+ python_version :
76+ - " 3.12"
77+ - " 3.13"
78+ - " 3.14"
79+ ansible_version :
80+ - " ansible-core>=2.20,<2.21" # Correspond ansible>=13.0,<14.0
5981 steps :
6082 - name : Check out code
6183 uses : actions/checkout@v6
6284
63- - name : Set up Python 3.9.14
85+ - name : Set up Python ${{ matrix.python_version }}
6486 uses : actions/setup-python@v6
6587 with :
66- python-version : 3.9.14
88+ python-version : ${{ matrix.python_version }}
6789
68- - name : Install dependencies
90+ - name : Install Ansible
6991 run : |
70- python -m pip install --upgrade pip
71- python -m pip install install ansible
92+ python3 -m pip install --upgrade pip
93+ python3 -m pip install "${{ matrix.ansible_version }}"
7294
7395 - name : Install collection
7496 run : |
7597 mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
7698 cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
7799
78- - name : Test `cert_info` module
100+ - name : Run sanity tests
79101 run : |
80- python tests/unit/plugins/modules/test_cert_info.py
102+ cd ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
103+ ansible-test sanity --python "${{ matrix.python_version }}" -v
81104 env :
82105 PY_COLORS : ' 1'
83106 ANSIBLE_FORCE_COLOR : ' 1'
84107
85- - name : Test `certs` module util
86- run : |
87- python tests/unit/plugins/module_utils/test_certs.py
88- env :
89- PY_COLORS : ' 1'
90- ANSIBLE_FORCE_COLOR : ' 1'
91-
92- python :
93- needs : unit-test
94- runs-on : ubuntu-20.04
95-
108+ unit-test :
109+ needs :
110+ - sanity_ansible_18_19
111+ - sanity_ansible_20
112+ runs-on : ubuntu-latest
96113 env :
97114 COLLECTION_NAMESPACE : netways
98115 COLLECTION_NAME : elasticstack
99-
100116 strategy :
101117 fail-fast : false
102- matrix :
103- python_version : [ 3.5.10, 3.6.15, 3.7.13, 3.8.16, 3.10.10 ]
104-
105118 steps :
106119 - name : Check out code
107120 uses : actions/checkout@v6
108121
109- - name : Set up Python ${{ matrix.python_version }}
122+ - name : Set up Python 3.11
110123 uses : actions/setup-python@v6
111124 with :
112- python-version : ${{ matrix.python_version }}
125+ python-version : 3.11
113126
114127 - name : Install dependencies
115128 run : |
116- python -m pip install --upgrade pip
117- python -m pip install install ansible
129+ python3 -m pip install --upgrade pip
130+ python3 -m pip install " ansible-core>=2.19,<2.20"
118131
119132 - name : Install collection
120133 run : |
121134 mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
122135 cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
123136
124- - name : Test with ansible-playbook
137+ - name : Test `cert_info` module
125138 run : |
126- ansible-playbook molecule/ plugins/converge.yml
139+ PYTHONPATH=$HOME/. ansible/collections python3 tests/unit/ plugins/modules/test_cert_info.py
127140 env :
128141 PY_COLORS : ' 1'
129142 ANSIBLE_FORCE_COLOR : ' 1'
130143
131- ansible-core :
132- needs : python
133- runs-on : ubuntu-20.04
144+ - name : Test `certs` module util
145+ run : |
146+ PYTHONPATH=$HOME/.ansible/collections python3 tests/unit/plugins/module_utils/test_certs.py
147+ env :
148+ PY_COLORS : ' 1'
149+ ANSIBLE_FORCE_COLOR : ' 1'
134150
151+ molecule_plugins :
152+ needs : unit-test
153+ runs-on : ubuntu-latest
135154 env :
136155 COLLECTION_NAMESPACE : netways
137156 COLLECTION_NAME : elasticstack
138-
139157 strategy :
140158 fail-fast : false
141159 matrix :
142- ansible_core_version : [ 2.11.12, 2.12.10, 2.13.8, 2.14.4 ]
143-
160+ distro :
161+ - ubuntu2204
162+ scenario :
163+ - plugins
164+ release :
165+ - 8
166+ # - 9 # add when elasticsearch>=9 is supported by this collection
144167 steps :
145168 - name : Check out code
146169 uses : actions/checkout@v6
147170
148- - name : Set up Python 3.9.14
171+ - name : Set up Python 3.11
149172 uses : actions/setup-python@v6
150173 with :
151- python-version : 3.9.14
174+ python-version : " 3.11 "
152175
153176 - name : Install dependencies
154177 run : |
155- python -m pip install --upgrade pip
156- python -m pip install install ansible-core==${{ matrix.ansible_core_version }}
178+ python3 -m pip install --upgrade pip
179+ python3 -m pip install "ansible-core>=2.19,<2.20"
180+ python3 -m pip install -r requirements-test.txt
157181
158182 - name : Install collection
159183 run : |
160184 mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
161185 cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
162186
163- - name : Test with ansible-playbook
187+ - name : Test with molecule
164188 run : |
165- ansible-playbook molecule/plugins/converge.yml
189+ ansible --version
190+ molecule --version
191+ molecule test -s ${{ matrix.scenario }}
166192 env :
193+ MOLECULE_DISTRO : ${{ matrix.distro }}
167194 PY_COLORS : ' 1'
168195 ANSIBLE_FORCE_COLOR : ' 1'
196+ ELASTIC_RELEASE : ${{ matrix.release }}
169197
170198 python-cryptography :
171- needs : ansible-core
172- runs-on : ubuntu-20.04
173-
199+ needs : unit-test
200+ runs-on : ubuntu-latest
174201 env :
175202 COLLECTION_NAMESPACE : netways
176203 COLLECTION_NAME : elasticstack
177-
178204 strategy :
179205 fail-fast : false
180206 matrix :
181- python_cryptography_version : [ 2.5, 3.0, 3.1, 3.2, 3.3, 3.4, 35.0.0, 36.0.0, 38.0.0, 40.0.1]
182-
207+ python_cryptography_version :
208+ - " 3.4.8" # Test loading certificate with 3 parameter (old way).
209+ - " 41.0.7" # Last version before not_valid_after() and not_valid_before() deprecation.
210+ - " 42.0.0" # First release with deprecation https://cryptography.io/en/latest/changelog/
211+ - " 46.0.5" # Latest release
183212 steps :
184213 - name : Check out code
185214 uses : actions/checkout@v6
186215
187- - name : Set up Python 3.9.14
216+ - name : Set up Python 3.11
188217 uses : actions/setup-python@v6
189218 with :
190- python-version : 3.9.14
219+ python-version : 3.11
191220
192221 - name : Install dependencies
193222 run : |
194- python -m pip install --upgrade pip
195- python -m pip install install cryptography==${{ matrix.python_cryptography_version }}
196- python -m pip install install ansible
223+ python3 -m pip install --upgrade pip
224+ python3 -m pip install "ansible-core>=2.19,<2.20"
225+ python3 -m pip install "cryptography==${{ matrix.python_cryptography_version }}"
197226
198227 - name : Install collection
199228 run : |
200229 mkdir -p ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE
201230 cp -a ../ansible-collection-$COLLECTION_NAME ~/.ansible/collections/ansible_collections/$COLLECTION_NAMESPACE/$COLLECTION_NAME
202231
203- - name : Test with ansible-playbook
232+ - name : Test cert_info with cryptography ${{ matrix.python_cryptography_version }}
204233 run : |
205- ansible-playbook molecule/ plugins/converge.yml
234+ PYTHONPATH=$HOME/. ansible/collections python3 tests/unit/ plugins/modules/test_cert_info.py
206235 env :
207236 PY_COLORS : ' 1'
208237 ANSIBLE_FORCE_COLOR : ' 1'
0 commit comments