11---
2+ # cspell:ignore anthropics
23name : tox
34
45on :
56 merge_group :
7+ branches :
8+ - " main"
69 push :
710 branches :
811 - " main"
@@ -17,256 +20,20 @@ concurrency:
1720 group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
1821 cancel-in-progress : true
1922
20- env :
21- FORCE_COLOR : 1 # tox, pytest, ansible-lint
22- PY_COLORS : 1
23-
2423jobs :
25- prepare :
26- name : prepare
27- runs-on : ubuntu-24.04
28- outputs :
29- matrix : ${{ steps.generate_matrix.outputs.matrix }}
30- steps :
31- - name : Determine matrix
32- id : generate_matrix
33- uses : coactions/dynamic-matrix@v4
34- with :
35- min_python : " 3.10"
36- max_python : " 3.13"
37- default_python : " 3.13"
38- other_names : |
39- lint-pkg-schemas-eco:tox -e lint;tox -e pkg;tox -e schemas;tox -e eco
40- hook
41- docs
42- pre
43- py312-devel
44- py310-lower
45- py312-lower
46- py314-devel
47- platforms : linux,macos
48- test-action :
49- runs-on : ubuntu-24.04
50- env :
51- # This disables the github annotations in the output of ansible-lint action
52- # which might confuse users.
53- GITHUB_ACTIONS_TEST : " true"
54- steps :
55- - uses : actions/checkout@v5
56- - name : Self test 1 # Test without explicit ref - fallback to main
57- uses : ./
58- with :
59- # basically we only lint linter own configuration, which should be passing.
60- args : .ansible-lint
61- - name : Self test 2
62- uses : ./
63- with :
64- # basically we only lint linter own configuration, which should be passing.
65- args : .ansible-lint
66- working_directory : .
67- - name : Self test 3
68- uses : ./
69- with :
70- # basically we only lint linter own configuration, which should be passing.
71- args : .ansible-lint
72- working_directory : docs
73- expected_return_code : " 2" # expected to fail because the given argument does not exist in this folder
74- - name : Self test 4 # Test explicit ref override - expect warning message
75- uses : ./
76- with :
77- args : .ansible-lint
78- gh_action_ref : " v25.5.0"
79- - name : Self test 5 # Test explicit ref to be own ref
80- uses : ./
81- with :
82- args : .ansible-lint
83- gh_action_ref : ${{ github.ref }}
84-
85- build :
86- name : ${{ matrix.name }}
87- runs-on : ${{ matrix.os || 'ubuntu-24.04' }}
88- needs :
89- - prepare
90- defaults :
91- run :
92- shell : ${{ matrix.shell || 'bash'}}
93- strategy :
94- fail-fast : false
95- matrix : ${{ fromJson(needs.prepare.outputs.matrix) }}
96- # max-parallel: 5
97- # The matrix testing goal is to cover the *most likely* environments
98- # which are expected to be used by users in production. Avoid adding a
99- # combination unless there are good reasons to test it, like having
100- # proof that we failed to catch a bug by not running it. Using
101- # distribution should be preferred instead of custom builds.
102- steps :
103- - uses : actions/checkout@v5
104- with :
105- fetch-depth : 0 # needed by setuptools-scm
106- submodules : true
107-
108- - name : Set build cache(s)
109- uses : actions/cache@v4
110- with :
111- path : |
112- .cache/eco
113- .tox
114- examples/playbooks/collections/ansible_collections
115- ~/.ansible/collections
116- ~/.ansible/roles
117- ~/.cache/ansible-compat
118- ~/.cache/pre-commit
119- key : ${{ matrix.name }}-${{ matrix.os }}--${{ hashFiles('.pre-commit-config.yaml', 'tools/test-eco.sh', 'requirements.yml', 'examples/playbooks/collections/requirements.yml') }}
120-
121- - name : Set up Python ${{ matrix.python_version || '3.10' }}
122- if : " !contains(matrix.shell, 'wsl')"
123- uses : actions/setup-python@v6
124- with :
125- cache : pip
126- python-version : ${{ matrix.python_version || '3.10' }}
127-
128- - uses : actions/setup-node@v5
129- with :
130- node-version : 22
131- cache : " npm"
132- cache-dependency-path : test/schemas/package-lock.json
133-
134- - name : Run ./tools/test-setup.sh
135- run : ./tools/test-setup.sh
136-
137- - name : Install tox
138- run : |
139- python3 -m pip install --upgrade pip
140- python3 -m pip install --upgrade "tox>=4.0.0" "tox-uv>=1.25.0" "uv>=0.6.6"
141-
142- - name : Log installed dists
143- run : python3 -m pip freeze --all
144-
145- - run : ${{ matrix.command }}
146-
147- - run : ${{ matrix.command2 }}
148- if : ${{ matrix.command2 }}
149-
150- - run : ${{ matrix.command3 }}
151- if : ${{ matrix.command3 }}
152-
153- - run : ${{ matrix.command4 }}
154- if : ${{ matrix.command4 }}
155-
156- - run : ${{ matrix.command5 }}
157- if : ${{ matrix.command5 }}
158-
159- - name : Archive logs
160- uses : coactions/upload-artifact@v4
161- with :
162- name : logs-${{ matrix.name }}.zip
163- include-hidden-files : true
164- if-no-files-found : ignore
165- path : |
166- .tox/**/coverage.xml
167-
168- - name : Report failure if git reports dirty status
169- run : |
170- git checkout HEAD -- src/ansiblelint/schemas/__store__.json
171- if [[ -n $(git status -s) ]]; then
172- # shellcheck disable=SC2016
173- echo -n '::error file=git-status::'
174- printf '### Failed as git reported modified and/or untracked files\n```\n%s\n```\n' "$(git status -s)" | tee -a "$GITHUB_STEP_SUMMARY"
175- exit 99
176- fi
177- # https://github.com/actions/toolkit/issues/193
178- codeql :
179- name : codeql
180- runs-on : ubuntu-24.04
181- permissions :
182- actions : read
183- contents : read
184- security-events : write
185-
186- strategy :
187- fail-fast : false
188- matrix :
189- language : ["python"]
190-
191- steps :
192- - name : Checkout repository
193- uses : actions/checkout@v5
194-
195- # Initializes the CodeQL tools for scanning.
196- - name : Initialize CodeQL
197- uses : github/codeql-action/init@v3
198- with :
199- languages : ${{ matrix.language }}
200- # If you wish to specify custom queries, you can do so here or in a config file.
201- # By default, queries listed here will override any specified in a config file.
202- # Prefix the list here with "+" to use these queries and those in the config file.
203-
204- # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
205- # queries: security-extended,security-and-quality
206-
207- - name : Autobuild
208- uses : github/codeql-action/autobuild@v3
209-
210- - name : Perform CodeQL Analysis
211- uses : github/codeql-action/analyze@v3
212- with :
213- category : " /language:${{matrix.language}}"
214-
215- check :
216- if : always()
217- permissions :
218- id-token : write
219- checks : read
220-
221- needs :
222- - build
223- - test-action
224-
225- runs-on : ubuntu-24.04
226-
227- steps :
228- # checkout needed for codecov action which needs codecov.yml file
229- - uses : actions/checkout@v5
230-
231- - name : Set up Python # likely needed for coverage
232- uses : actions/setup-python@v6
233- with :
234- python-version : " 3.13"
235-
236- - run : pip3 install 'coverage>=7.5.1'
237-
238- - name : Merge logs into a single archive
239- uses : actions/upload-artifact/merge@v4
240- with :
241- name : logs.zip
242- include-hidden-files : true
243- pattern : logs-*.zip
244- # artifacts like py312.zip and py312-macos do have overlapping files
245- separate-directories : true
246-
247- - name : Download artifacts
248- uses : actions/download-artifact@v5
249- continue-on-error : true # to allow rerunning this job
250- with :
251- name : logs.zip
252- path : .
253-
254- - name : Upload coverage data
255- 256- with :
257- name : ${{ matrix.name }}
258- # verbose: true # optional (default = false)
259- fail_ci_if_error : true
260- use_oidc : ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }} # cspell:ignore oidc
261-
262- - name : Decide whether the needed jobs succeeded or failed
263- uses : re-actors/alls-green@release/v1
264- with :
265- jobs : ${{ toJSON(needs) }}
266-
267- - name : Delete Merged Artifacts
268- uses : actions/upload-artifact/merge@v4
269- with :
270- include-hidden-files : true
271- delete-merged : true
272- pattern : logs-*.zip
24+ tox :
25+ uses : ansible/team-devtools/.github/workflows/tox.yml@main
26+ secrets : inherit
27+ with :
28+ min_python : " 3.10"
29+ default_python : " 3.13"
30+ max_python : " 3.13"
31+ other_names : |
32+ lint-pkg-schemas-eco:tox -e lint;tox -e pkg;tox -e schemas;tox -e eco
33+ hook
34+ docs
35+ py312-devel
36+ py310-lower
37+ py312-lower
38+ py314-devel
39+ platforms : linux,macos
0 commit comments