11name : CI
22on :
3+ # Triggers the workflow on push or pull request events but only for the develop branch
34 push :
4- branches : [master]
5+ branches :
6+ - develop
7+ - main
58 pull_request :
6- schedule :
7- # * is a special character in YAML so you have to quote this string
8- - cron : ' 0 8 * * *'
9- env :
10- python_version : ' 3.11'
9+ branches :
10+ - develop
11+ - main
12+ # schedule:
13+ # # * is a special character in YAML so you have to quote this string
14+ # - cron: '0 8 * * *'
15+ # Allows you to run this workflow manually from the Actions tab
16+ workflow_dispatch :
17+
18+ # env:
19+ # python_version: '3.11'
20+
1121jobs :
22+ pep8-black :
23+ name : Pep8 Compliance - Black
24+ runs-on : ubuntu-latest
25+ continue-on-error : true
26+ steps :
27+ - name : Check out code
28+ uses : actions/checkout@v6
29+
30+ - name : Run black against code
31+ uses : psf/black@stable
32+ with :
33+ options : " --check --diff --color -l 159"
34+
1235 build :
13- name : Build collection
36+ name : Build Collection
1437 runs-on : ubuntu-latest
15- strategy :
38+ strategy : &ansible_strategy
1639 fail-fast : false
40+ # https://docs.ansible.com/projects/ansible/latest/reference_appendices/release_and_maintenance.html#ansible-core-support-matrix
41+ # https://access.redhat.com/support/policy/updates/ansible-automation-platform#coreversion
1742 matrix :
18- ansible : [stable-2.16, stable-2.17, stable-2.18, stable-2.19]
43+ include :
44+ # Ansible 2.19: supports Python 3.11 - 3.13
45+ - ansible_version : " stable-2.19"
46+ python_version : " 3.13"
47+ - ansible_version : " stable-2.19"
48+ python_version : " 3.12"
49+ - ansible_version : " stable-2.19"
50+ python_version : " 3.11"
51+
52+ # Ansible 2.18: supports Python 3.11 - 3.13
53+ - ansible_version : " stable-2.18"
54+ python_version : " 3.13"
55+ - ansible_version : " stable-2.18"
56+ python_version : " 3.12"
57+ - ansible_version : " stable-2.18"
58+ python_version : " 3.11"
59+
60+ # Ansible 2.17: supports Python 3.10 - 3.12
61+ - ansible_version : " stable-2.17"
62+ python_version : " 3.12"
63+ - ansible_version : " stable-2.17"
64+ python_version : " 3.11"
65+ - ansible_version : " stable-2.17"
66+ python_version : " 3.10"
67+
68+ # Ansible 2.16: supports Python 3.10 - 3.12
69+ - ansible_version : " stable-2.16"
70+ python_version : " 3.12"
71+ - ansible_version : " stable-2.16"
72+ python_version : " 3.11"
73+ - ansible_version : " stable-2.16"
74+ python_version : " 3.10"
75+
1976 steps :
2077 - name : Check out code
21- uses : actions/checkout@v4
78+ uses : actions/checkout@v6
2279
23- - name : Set up Python ${{ env .python_version }}
24- uses : actions/setup-python@v5
80+ - name : Set up Python ${{ matrix .python_version }}
81+ uses : actions/setup-python@v6
2582 with :
26- python-version : ${{ env .python_version }}
83+ python-version : ${{ matrix .python_version }}
2784
28- - name : Install ansible-base (${{ matrix.ansible }})
29- run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
85+ - name : Install ansible-base (${{ matrix.ansible_version }})
86+ run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
3087
3188 - name : Build a collection tarball
3289 run : ansible-galaxy collection build --output-path "${GITHUB_WORKSPACE}/.cache/collection-tarballs"
3390
3491 - name : Store migrated collection artifacts
35- uses : actions/upload-artifact@v4
92+ uses : actions/upload-artifact@v7
3693 with :
37- name : collection-${{ matrix.ansible }}
94+ name : collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
3895 path : .cache/collection-tarballs
3996
40- black-formating :
41- name : Using Black to check formating
42- runs-on : ubuntu-latest
43- continue-on-error : true
44- steps :
45- - name : Check out code
46- uses : actions/checkout@v4
47-
48- - name : Run black against code
49- uses : psf/black@stable
50- with :
51- options : " --check --diff --color -l 159"
52-
53- importer :
54- name : Galaxy-importer check
97+ ansible-galaxy-importer :
98+ name : Ansible Galaxy-Importer Check
5599 needs :
100+ - pep8-black
56101 - build
57- - black-formating
58102 runs-on : ubuntu-latest
59- strategy :
60- matrix :
61- ansible : [stable-2.18]
103+ strategy : *ansible_strategy
104+
62105 steps :
63- - name : Set up Python ${{ env .python_version }}
64- uses : actions/setup-python@v5
106+ - name : Set up Python ${{ matrix .python_version }}
107+ uses : actions/setup-python@v6
65108 with :
66- python-version : ${{ env .python_version }}
109+ python-version : ${{ matrix .python_version }}
67110
68- - name : Install ansible-base (${{ matrix.ansible }})
69- run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
111+ - name : Install ansible-core (${{ matrix.ansible_version }})
112+ run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
70113
71114 - name : Download migrated collection artifacts
72- uses : actions/download-artifact@v4
115+ uses : actions/download-artifact@v8
73116 with :
74- name : collection-${{ matrix.ansible }}
117+ name : collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
75118 path : .cache/collection-tarballs
76119
77120 - name : Install the collection tarball
@@ -86,49 +129,57 @@ jobs:
86129 - name : Create galaxy-importer.cfg
87130 run : |
88131 sudo cp \
89- /home/runner/.ansible/collections/ansible_collections/cisco/aci/.github/workflows/galaxy-importer.cfg \
90- /etc/galaxy-importer/galaxy-importer.cfg
132+ /home/runner/.ansible/collections/ansible_collections/cisco/aci/.github/workflows/galaxy-importer.cfg \
133+ /etc/galaxy-importer/galaxy-importer.cfg
91134
92135 - name : Run galaxy-importer check
93136 run : |
94137 python -m galaxy_importer.main .cache/collection-tarballs/cisco-*.tar.gz \
95- | tee .cache/collection-tarballs/log.txt \
96- && sudo cp ./importer_result.json .cache/collection-tarballs/importer_result.json
138+ | tee .cache/collection-tarballs/log.txt \
139+ && sudo cp ./importer_result.json .cache/collection-tarballs/importer_result.json
97140
98141 - name : Check warnings and errors
99- run : if grep -E 'WARNING|ERROR' .cache/collection-tarballs/log.txt; then exit 1; else exit 0; fi
142+ shell : python
143+ run : |
144+ # Check warnings and errors
145+ err = 0
146+ with open('.cache/collection-tarballs/log.txt', 'r', encoding='utf-8') as f:
147+ for line in f:
148+ if line.startswith('ERROR:') or line.startswith('WARNING:'):
149+ print(line)
150+ if 'Ignore files skip ansible-test sanity tests, found ignore' not in line:
151+ err = 1
152+ exit(err)
100153
101154 - name : Store galaxy_importer check log file
102- uses : actions/upload-artifact@v4
155+ uses : actions/upload-artifact@v7
103156 with :
104- name : galaxy-importer-log
157+ name : galaxy-importer-log-${{ matrix.python_version }}-${{ matrix.ansible_version }}
105158 path : .cache/collection-tarballs/importer_result.json
106159
107- sanity :
108- name : Sanity in ubuntu-latest
160+ ansible-test :
161+ name : Ansible-Test Sanity
109162 needs :
110- - importer
163+ - ansible-galaxy- importer
111164 runs-on : ubuntu-latest
112- strategy :
113- fail-fast : false
114- matrix :
115- ansible : [stable-2.16, stable-2.17, stable-2.18, stable-2.19]
165+ strategy : *ansible_strategy
166+
116167 steps :
117- - name : Set up Python ${{ env .python_version }}
118- uses : actions/setup-python@v5
168+ - name : Set up Python ${{ matrix .python_version }}
169+ uses : actions/setup-python@v6
119170 with :
120- python-version : ${{ env .python_version }}
171+ python-version : ${{ matrix .python_version }}
121172
122- - name : Install ansible-base (${{ matrix.ansible }})
123- run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
173+ - name : Install ansible-base (${{ matrix.ansible_version }})
174+ run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
124175
125176 - name : Install coverage (v4.5.4)
126177 run : pip install coverage==4.5.4
127178
128179 - name : Download migrated collection artifacts
129- uses : actions/download-artifact@v4
180+ uses : actions/download-artifact@v8
130181 with :
131- name : collection-${{ matrix.ansible }}
182+ name : collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
132183 path : .cache/collection-tarballs
133184
134185 - name : Install the collection tarball
@@ -147,74 +198,72 @@ jobs:
147198 working-directory : /home/runner/.ansible/collections/ansible_collections/cisco/aci
148199
149200 units :
150- name : Units in ubuntu-latest
201+ name : Unit Tests
151202 needs :
152- - importer
203+ - ansible-galaxy- importer
153204 runs-on : ubuntu-latest
154- strategy :
155- fail-fast : false
156- matrix :
157- ansible : [stable-2.16, stable-2.17, stable-2.18, stable-2.19]
205+ strategy : *ansible_strategy
206+
158207 steps :
159- - name : Set up Python ${{ env .python_version }}
160- uses : actions/setup-python@v5
208+ - name : Set up Python ${{ matrix .python_version }}
209+ uses : actions/setup-python@v6
161210 with :
162- python-version : ${{ env .python_version }}
211+ python-version : ${{ matrix .python_version }}
163212
164- - name : Install ansible-base (${{ matrix.ansible }})
165- run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
213+ - name : Install ansible-base (${{ matrix.ansible_version }})
214+ run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
166215
167216 - name : Install coverage (v4.5.4)
168217 run : pip install coverage==4.5.4
169218
170219 - name : Download migrated collection artifacts
171- uses : actions/download-artifact@v4
220+ uses : actions/download-artifact@v8
172221 with :
173- name : collection-${{ matrix.ansible }}
222+ name : collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
174223 path : .cache/collection-tarballs
175224
176225 - name : Install the collection tarball
177226 run : ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz
178227
179228 - name : Run unit tests
180- run : ansible-test units --docker -v --color --truncate 0 --python ${{ env .python_version }} --coverage
229+ run : ansible-test units --docker -v --color --truncate 0 --python ${{ matrix .python_version }} --coverage
181230 working-directory : /home/runner/.ansible/collections/ansible_collections/cisco/aci
182231
183- - name : Generate coverage report.
232+ - name : Generate coverage report
184233 run : ansible-test coverage xml -v --requirements --group-by command --group-by version
185234 working-directory : /home/runner/.ansible/collections/ansible_collections/cisco/aci
186235
187- - name : Push coverate report to codecov.io
236+ - name : Push coverage report to codecov.io
188237 run : bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F unit
189238 working-directory : /home/runner/.ansible/collections/ansible_collections/cisco/aci
190239
191240 integration :
192- name : Integration in ubuntu-latest
241+ name : Integration Tests
242+ if : false # No integration tests for now
193243 needs :
194244 - units
195- - sanity
245+ - ansible-test
196246 runs-on : ubuntu-latest
197- strategy :
198- matrix :
199- ansible : [stable-2.19]
247+ strategy : *ansible_strategy
248+
200249 env :
201250 MUTEX_URL : https://8v7s765ibh.execute-api.us-west-1.amazonaws.com
202251 steps :
203- - name : Set up Python ${{ env .python_version }}
204- uses : actions/setup-python@v5
252+ - name : Set up Python ${{ matrix .python_version }}
253+ uses : actions/setup-python@v6
205254 with :
206- python-version : ${{ env .python_version }}
255+ python-version : ${{ matrix .python_version }}
207256
208- - name : Install ansible-base (${{ matrix.ansible }})
209- run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check
257+ - name : Install ansible-base (${{ matrix.ansible_version }})
258+ run : pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible_version }}.tar.gz --disable-pip-version-check
210259
211260 - name : Install coverage (v4.5.4)
212261 run : pip install coverage==4.5.4
213262
214263 - name : Download migrated collection artifacts
215- uses : actions/download-artifact@v4
264+ uses : actions/download-artifact@v8
216265 with :
217- name : collection-${{ matrix.ansible }}
266+ name : collection-${{ matrix.python_version }}-${{ matrix.ansible_version }}
218267 path : .cache/collection-tarballs
219268
220269 - name : Install the collection tarball
@@ -228,10 +277,10 @@ jobs:
228277 timeout : 2000000
229278 interval : 5000
230279
231- - name : Run integration tests on Python ${{ env .python_version }}
280+ - name : Run integration tests on Python ${{ matrix .python_version }}
232281 run : |
233- ansible-test network-integration --docker -v --color --retry-on-error --python ${{ env .python_version }} \
234- --truncate 0 --continue-on-error --coverage
282+ ansible-test network-integration --docker -v --color --retry-on-error --python ${{ matrix .python_version }} \
283+ --truncate 0 --continue-on-error --coverage
235284 working-directory : /home/runner/.ansible/collections/ansible_collections/cisco/aci
236285
237286 - name : Releasing integration mutex
@@ -246,7 +295,7 @@ jobs:
246295 run : ansible-test coverage xml -v --requirements --group-by command --group-by version
247296 working-directory : /home/runner/.ansible/collections/ansible_collections/cisco/aci
248297
249- - name : Push coverate report to codecov.io
298+ - name : Push coverage report to codecov.io
250299 if : always()
251300 run : bash <(curl -s https://codecov.io/bash) -s 'tests/output/reports/' -F integration
252- working-directory : /home/runner/.ansible/collections/ansible_collections/cisco/aci
301+ working-directory : /home/runner/.ansible/collections/ansible_collections/cisco/aci
0 commit comments