-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
133 lines (112 loc) · 3.76 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
[tox]
skipsdist = True
skip_missing_interpreters = True
envlist =
; Add the `ci` factor to any env that should be running during CI.
py3{7,8,9,10,11}-ci-test-{cloudtrace,cloudmonitoring,propagator,resourcedetector}
{lint,mypy}-ci-{cloudtrace,cloudmonitoring,propagator,resourcedetector}
docs-ci
; These are development commands and share the same virtualenv within each
; package root directory
{fix}-{cloudtrace,cloudmonitoring,propagator,resourcedetector}
; Installs dev depenedencies and all packages in this repo with editable
; install into a single env. Useful for editor autocompletion
dev
; this section contains constants that can be referenced elsewhere
[constants]
base_deps =
-c {toxinidir}/dev-constraints.txt
-e {toxinidir}/test-common
; the inter-monorepo dependencies
monorepo_deps =
cloudmonitoring: -e {toxinidir}/opentelemetry-resourcedetector-gcp/
cloudtrace: -e {toxinidir}/opentelemetry-resourcedetector-gcp/
dev_basepython = python3.10
dev_deps =
{[constants]base_deps}
black
flake8
isort
mypy
pylint
pytest
syrupy
types-protobuf
types-requests
types-setuptools
# 3rd party package until https://github.com/googleapis/python-api-common-protos/issues/135
# is fixed
googleapis-common-protos-stubs
; CircleCI won't show results if I put them in .test-results directly
test_results_dir = {toxinidir}/.test-results/test-results
[testenv]
download = true
setenv =
; for package specific commands, use these envvars to cd into the directory
cloudtrace: PACKAGE_NAME = opentelemetry-exporter-gcp-trace
cloudmonitoring: PACKAGE_NAME = opentelemetry-exporter-gcp-monitoring
propagator: PACKAGE_NAME = opentelemetry-propagator-gcp
resourcedetector: PACKAGE_NAME = opentelemetry-resourcedetector-gcp
[testenv:py3{7,8,9,10,11}-ci-test-{cloudtrace,cloudmonitoring,propagator,resourcedetector}]
deps =
test: {[constants]base_deps}
test: {[constants]monorepo_deps}
test: pytest
test: syrupy
passenv = SKIP_GET_MOCK_SERVER
changedir = {env:PACKAGE_NAME}
commands_pre =
pip install -c {toxinidir}/dev-constraints.txt .
{toxinidir}/get_mock_server.sh {envbindir}
commands = pytest --junitxml={[constants]test_results_dir}/{envname}/junit.xml {posargs}
allowlist_externals =
bash
{toxinidir}/get_mock_server.sh
[testenv:{lint,mypy}-ci-{cloudtrace,cloudmonitoring,propagator,resourcedetector}]
basepython = {[constants]dev_basepython}
deps =
{[constants]dev_deps}
{[constants]monorepo_deps}
changedir = {env:PACKAGE_NAME}
commands_pre =
pip install -c {toxinidir}/dev-constraints.txt .
commands =
lint: black . --diff --check
lint: isort . --diff --check-only
lint: flake8 --config {toxinidir}/.flake8 .
lint: pylint --rcfile {toxinidir}/.pylintrc src/ tests/
mypy: mypy src/ --pretty --show-error-codes --junit-xml \
mypy: {[constants]test_results_dir}/mypy-{env:PACKAGE_NAME}/junit.xml {posargs}
[testenv:docs-ci]
deps =
-r docs-requirements.txt
commands =
make -C docs/ clean html
allowlist_externals =
make
bash
[testenv:{fix}-{cloudtrace,cloudmonitoring,propagator,resourcedetector}]
basepython = {[constants]dev_basepython}
envdir =
cloudtrace: opentelemetry-exporter-gcp-trace/venv
cloudmonitoring: opentelemetry-exporter-gcp-monitoring/venv
propagator: opentelemetry-propagator-gcp/venv
resourcedetector: opentelemetry-resourcedetector-gcp/venv
deps =
{[constants]dev_deps}
{[constants]monorepo_deps}
-e {env:PACKAGE_NAME}
changedir = {env:PACKAGE_NAME}
commands =
; To run fixers (black, isort) `tox -f fix`.
fix: black .
fix: isort .
[testenv:dev]
basepython = {[constants]dev_basepython}
envdir = venv
deps =
{[constants]dev_deps}
-e opentelemetry-exporter-gcp-monitoring
-e opentelemetry-exporter-gcp-trace
-e opentelemetry-propagator-gcp
-e opentelemetry-resourcedetector-gcp