-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtox.ini
112 lines (105 loc) · 3.82 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
[tox]
envlist =
lint
docs
unit
sanity
coverage
skipsdist = true # this repo is not a python package
isolated_build = true
requires =
tox >= 4.6.3
tox-extra >= 2.0.1 # bindep check
setuptools >= 65.3.0 # editable installs
ignore_basepython_conflict = false
[testenv]
description =
Run unit tests
py{310,311,312,313}: with {basepython}
deps = -r test_requirements.txt
commands_pre =
bash -c 'test "$(basename $(cd ../.. && pwd))" == ansible_collections || { echo "Repository must be cloned inside a directory structure like ansible_collections/flightctl/core in order allow ansible-test to run."; exit 3;}'
commands =
echo "Implicit tox environment should not be called directly (safety measure to avoid running wrong tests due to typos)"
false
; tox -e sanity,unit,integration {posargs}
allowlist_externals =
bash
sh
isolated_build = true
; # See https://stackoverflow.com/a/76884052/99834
; py310: true
setenv =
; COVERAGE_FILE = {env:COVERAGE_FILE:{envdir}/.coverage.{envname}}
; COVERAGE_PROCESS_START={toxinidir}/pyproject.toml
PIP_NO_BUILD_ISOLATION = 1
PYTHONUNBUFFERED = 1
passenv =
ANSIBLE_FORCE_COLOR
CURL_CA_BUNDLE # https proxies, https://github.com/tox-dev/tox/issues/1437
FORCE_COLOR
HOME
NO_COLOR
PYTEST_* # allows developer to define their own preferences
PYTEST_REQPASS # needed for CI
PYTHON* # PYTHONPYCACHEPREFIX, PYTHONIOENCODING, PYTHONBREAKPOINT,...
PY_COLORS
RTD_TOKEN
READTHEDOCS*
REQUESTS_CA_BUNDLE # https proxies
SETUPTOOLS_SCM_DEBUG
SSL_CERT_FILE # https proxies
SSH_AUTH_SOCK # may be needed by git
LANG
LC_*
# https://tox.wiki/en/latest/upgrading.html#editable-mode
package = editable
[testenv:py{310,311,312,313}]
description =
Run all test types: sanity, unit, integration
py{39,310,311,312,313}: with {basepython}
[testenv:lint]
deps = pre-commit
description = Run linters
commands = pre-commit run -a
[testenv:unit,py{310,311,312,313}-unit]
description =
Run unit tests
py{310,311,312,313}: with {basepython}
commands =
# fail-fast if psycopg in not properly installed.
python3 -c "import psycopg"
sh -c "ansible-test units --color --requirements --target-python default -v --num-workers 1 --coverage --truncate 0 {posargs}"
ansible-test coverage report --requirements --omit '.tox/*,tests/*' --color --all --show-missing -v --truncate 0
ansible-test coverage combine --export={envdir}
[testenv:sanity,py{310,311,312,313}-sanity,py{310,311}-sanity-ansible2.15,py{310,311,312}-sanity-ansible{2.16,2.17,2.18}]
deps =
py{310,311}-sanity-ansible2.15: ansible-core>=2.15,<2.16
py{310,311,312}-sanity-ansible2.16: ansible-core>=2.16,<2.17
py{310,311,312}-sanity-ansible2.17: ansible-core>=2.17,<2.18
py{310,311,312}-sanity-ansible2.18: ansible-core>=2.18,<2.19
-r test_requirements.txt
description =
Run ansible-test sanity (via docker)
py{310,311,312,313}: with {basepython}
commands =
ansible --version
ansible-test sanity -v --docker --color --requirements --coverage --truncate 0 --junit {posargs}
[testenv:docs]
description = Generate plugins documentation under /docs directory using antsibull-docs
# When run under RTD it will reuse their pre-created environment and save time.
env_dir = {env:READTHEDOCS_VIRTUALENV_PATH:{work_dir}/docs}
deps =
ansible-core
-r .config/requirements-docs.txt
commands_pre =
# --force must remain here or we risk on building docs for older version
ansible-galaxy collection install --force .
bash -c "command -v rsync || { 'Building docs with antsibull-docs require rsync, please install it.'; exit 1;}"
commands =
antsibull-docs sphinx-init --project="Flight Control Collection" --title="Flight Control Collection" --html-short-title="flightctl.core" --fail-on-error --use-current --squash-hierarchy --dest-dir=docs flightctl.core
bash ./docs/build.sh
allowlist_externals =
mkdir
bash
git