-
Notifications
You must be signed in to change notification settings - Fork 673
/
Copy pathtox.ini
224 lines (212 loc) · 5.9 KB
/
tox.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
[tox]
requires =
setuptools>=65.3
tox>=4.6.3
tox-extra>=2.1
tox-uv>=1.20.2
env_list =
py
py-devel
lint
pkg
hook
docs
schemas
lower
pre
eco
skip_missing_interpreters = true
[testenv]
description =
Run the tests under {base_python}
devel: and ansible devel branch
pre: and enable --pre when installing dependencies, testing prereleases
package = editable
deps =
devel: ansible-compat @ git+https://github.com/ansible/ansible-compat.git # GPLv3+
devel: ansible-core @ git+https://github.com/ansible/ansible.git # GPLv3+
extras =
test
pass_env =
CI
CURL_CA_BUNDLE
FORCE_COLOR
HOME
LANG
LC_*
NO_COLOR
PYTEST_*
PYTEST_REQPASS
PYTHON*
PYTHONBREAKPOINT
PYTHONIOENCODING
PYTHONPYCACHEPREFIX
PY_COLORS
REQUESTS_CA_BUNDLE
RTD_TOKEN
SETUPTOOLS_SCM_DEBUG
SSH_AUTH_SOCK
SSL_CERT_FILE
UV_*
set_env =
COVERAGE_FILE = {env:COVERAGE_FILE:{env_dir}/.coverage.{env_name}}
COVERAGE_PROCESS_START = {tox_root}/pyproject.toml
FORCE_COLOR = 1
PIP_CONSTRAINT = {tox_root}/.config/constraints.txt
PIP_DISABLE_PIP_VERSION_CHECK = 1
PRE_COMMIT_COLOR = always
PYTEST_REQPASS = 906
UV_CONSTRAINT = {tox_root}/.config/constraints.txt
deps, devel, hook, lint, pkg, pre, py310, schemas: PIP_CONSTRAINT = /dev/null
deps, devel, hook, lint, pkg, pre, py310, schemas: UV_CONSTRAINT = /dev/null
devel: ANSIBLE_DEVEL_WARNING = false
lower: PIP_CONSTRAINT = {tox_root}/.github/lower-constraints.txt
lower: UV_CONSTRAINT = {tox_root}/.github/lower-constraints.txt
pre: PIP_PRE = 1
commands_pre =
sh -c "rm -f {env_dir}/.coverage.* 2>/dev/null || true"
{env_python} -m pip check
bash ./tools/install-reqs.sh
ansible --version
commands =
sh -c "{env_python} -m pip freeze > {env_dir}/log/requirements.txt"
coverage run -m pytest {posargs: \
-n auto \
-ra \
--showlocals \
--doctest-modules \
--durations=10 \
}
{py,py310,py311,py312,py313}: sh -c "coverage combine -a -q --data-file={env_dir}/.coverage {work_dir}/*/.coverage.* && coverage xml --data-file={env_dir}/.coverage -o {env_dir}/coverage.xml --fail-under=0"
allowlist_externals =
./tools/test-hook.sh
bash
find
git
pwd
rm
sh
tox
{work_dir}/.pipx/bin/ansible-lint
[testenv:lint]
description = Run all linters
skip_install = true
deps =
pre-commit>=4.0.1
pre-commit-uv>=4.1.4
pytest>=7.2.2 # to updated schemas
setuptools>=51.1.1
pass_env =
{[testenv]pass_env}
PRE_COMMIT_HOME
commands_pre =
commands =
{env_python} -m pre_commit run --all-files --show-diff-on-failure {posargs:}
[testenv:pkg]
description =
Build package, verify metadata, install package and assert behavior when ansible is missing.
skip_install = true
deps =
build>=0.9
pip
pipx
twine>=4.0.1
commands_pre =
commands =
bash -c "PIPX_BIN_DIR={work_dir}/.pipx/bin PIPX_HOME={work_dir}/.pipx pipx install --force -e ."
bash -c "if stderr=$({work_dir}/.pipx/bin/ansible-lint --version >/dev/null) && test -z \"$stderr\"; then echo "ok"; fi"
{env_python} -c 'import os.path, shutil, sys; \
dist_dir = os.path.join("{tox_root}", "dist"); \
os.path.isdir(dist_dir) or sys.exit(0); \
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
shutil.rmtree(dist_dir)'
{env_python} -m build --outdir {tox_root}/dist/ {tox_root}
python3 -m twine check --strict {tox_root}/dist/*
sh -c 'python3 -m pip install "ansible-lint @ file://$(echo {tox_root}/dist/*.whl)"'
python3 -m pip uninstall -y ansible-lint
[testenv:hook]
description = Validate pre-commit hook definition
deps =
pre-commit
commands =
./tools/test-hook.sh
[testenv:docs]
description = Builds docs
package = editable
skip_install = false
extras =
docs
set_env =
DYLD_FALLBACK_LIBRARY_PATH = /opt/homebrew/lib:{env:LD_LIBRARY_PATH}
NO_COLOR = 1
TERM = dump
commands_pre =
ansible-lint --version
commands =
mkdocs {posargs:build --strict --site-dir=_readthedocs/html/}
[testenv:schemas]
description = Rebuild and test JSON Schemas
skip_install = true
deps =
check-jsonschema>=0.26.3
change_dir = test/schemas
commands_pre =
npm install
commands =
npm test
allowlist_externals =
npm
[testenv:lower]
description = Install using lower-constraints.txt file for testing oldest versions.
[testenv:eco]
description = Perform ecosystem impact (downstream testing) https://github.com/ansible/ansible-lint/discussions/1403
deps =
{[testenv]deps}
extras =
test
set_env =
PYTEST_REQPASS = 7
commands =
sh -c tools/test-eco.sh
allowlist_externals =
{[testenv]allowlist_externals}
[testenv:deps]
description = Bump all test dependencies
skip_install = true
deps =
{[testenv:lint]deps}
commands_pre =
commands =
-pre-commit run --all-files --show-diff-on-failure --hook-stage manual lock
-pre-commit run --all-files --show-diff-on-failure --hook-stage manual deps
-pre-commit autoupdate
-sh -c "cd test/schemas && npm run deps"
git diff --exit-code
env_dir = {work_dir}/lint
[testenv:redirects]
description = Update documentation redirections for readthedocs
deps =
readthedocs-cli
commands =
rtd projects ansible-lint redirects sync -f docs/redirects.yml --wet-run
[testenv:clean]
description = Remove temporary files
skip_install = true
deps =
commands_pre =
commands =
find . -type d \( -name __pycache__ -o -name .mypy_cache \) -delete
find . -type f \( -name '*.py[co]' -o -name ".coverage*" -o -name coverage.xml \) -delete
commands_post =
[testenv:coverage]
description = Combines and displays coverage results
skip_install = true
deps =
coverage[toml]>=7.0.5
set_env =
COVERAGE_PROCESS_START = {tox_root}/pyproject.toml
commands_pre =
commands =
python3 -m coverage --version
python3 -m coverage xml --fail-under=0
python3 -m coverage report