You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resolve Installation Ordering during dev build (Azure#21025)
* resolve installation failures during regression checks.
* clean up eng_sys_checks.md. removing a bunch of formatting issues, adding additional detail.
* during nightly alpha, force install from dev feed to ensure we're testing what we expect
Copy file name to clipboardExpand all lines: doc/eng_sys_checks.md
+73-62Lines changed: 73 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,9 +19,8 @@ Example PR build:
19
19
20
20

21
21
22
-
-`Analyze` tox envs run during the `Analyze job.
23
-
-`Test <platform>_<pyversion>` runs PR/Nightly tox envs, depending on context.
24
-
22
+
*`Analyze` tox envs run during the `Analyze job.
23
+
*`Test <platform>_<pyversion>` runs PR/Nightly tox envs, depending on context.
25
24
26
25
## Targeting a specific package at build time
27
26
@@ -47,48 +46,59 @@ This is an example setting of that narrows the default set from `whl, sdist, dep
47
46
48
47
Any combination of valid valid tox environments will work. Reference either this document or the file present at `eng/tox/tox.ini` to find what options are available.
49
48
49
+
## Environment variables important to CI
50
+
51
+
There are a few differences from a standard local invocation of `tox <env>`. Primarily, these differences adjust the checks to be friendly to parallel invocation. These adjustments are necessary to prevent random CI crashes.
52
+
53
+
| Environment Variable | Affect on Build |
54
+
|---|---|
55
+
|`TF_BUILD`| EngSys uses the presence of any value in this variable as the bit indicating "in CI" or not. The primary effect of this is that all relative dev dependencies will be prebuilt prior to running the tox environments. |
56
+
|`PREBUILT_WHEEL_DIR`| Setting this env variables means that instead of generating a fresh wheel or sdist to test, `tox` will look in this directory for the targeted package. |
57
+
|`PIP_INDEX_URL`| Standard `pip` environment variable. During nightly `alpha` builds, this environment variable is set to a public dev feed. |
58
+
59
+
The various tooling abstracted by the environments within `eng/tox/tox.ini` take the above variables into account automatically.
60
+
50
61
## Analyze Checks
62
+
51
63
Analyze job in both nightly CI and pull request validation pipeline runs a set of static analysis using external and internal tools. Following are the list of these static analysis.
52
64
53
-
#### MyPy
65
+
### MyPy
66
+
54
67
[`MyPy`](https://pypi.org/project/mypy/) is a static analysis tool that runs type checking of python package. MyPy is an opt-in check for packages. Following are the steps to run `MyPy` locally for a specific package:
55
68
56
69
1. Add the package name to the end of the [`mypy_hard_failure_packages.py`](https://github.com/Azure/azure-sdk-for-python/blob/main/eng/tox/mypy_hard_failure_packages.py) file:
57
-
```python
58
-
MYPY_HARD_FAILURE_OPTED= [
59
-
...,
60
-
"azure-my-package",
61
-
]
62
-
```
63
-
1. Go to root of the package
64
-
2. Execute following command:
65
-
```tox -e mypy -c ../../../eng/tox/tox.ini ```
70
+
```python
71
+
MYPY_HARD_FAILURE_OPTED= [
72
+
...,
73
+
"azure-my-package",
74
+
]
75
+
```
76
+
2. Go to root of the package
77
+
3. Execute following command: `tox -e mypy -c ../../../eng/tox/tox.ini`
66
78
79
+
### Pylint
67
80
68
-
#### Pylint
69
81
[`Pylint`](https://pypi.org/project/pylint/) is a static analysis tool to run lint checking, it is automatically run on all PRs. Following are the steps to run `pylint` locally for a specific package.
70
82
71
83
1. Go to root of the package.
72
-
2. Execute following command:
73
-
```tox -e pylint -c ../../../eng/tox/tox.ini```
84
+
2. Execute following command: `tox -e pylint -c ../../../eng/tox/tox.ini`
74
85
86
+
### Bandit
75
87
76
-
#### Bandit
77
88
`Bandit` is static security analysis tool. This check is triggered for all Azure SDK package as part of analyze job. Following are the steps to `Bandit` tool locally for a specific package.
`ApiStubGen` is an internal tool used to create API stub to help reviewing public APIs in our SDK package using [`APIViewTool`.](https://apiview.dev/) This tool also has some built in lint checks available and purpose of having this step in analyze job is to ensure any change in code is not impacting stubbing process and also to have more and more custom lint checks added in future.
86
96
87
-
####black
97
+
### black
88
98
89
99
[black](https://pypi.org/project/black) is an opinionated code formatter for Python source code.
90
100
91
-
#### Opt-in
101
+
#### Opt-in to formatting validation
92
102
93
103
Make the following change to your projects `ci.yml`:
94
104
@@ -102,19 +112,21 @@ extends:
102
112
```
103
113
104
114
#### Running locally
115
+
105
116
To run locally first install `black` from pip if you do not have it already (the pipeline uses version 21.6b0). Currently, we use the `-l 120` option to allow lines up to 120 characters (consistent with our `pylint` check).
117
+
106
118
```bash
107
119
python -m pip install black==21.6b0
108
120
python -m black -l 120 <path/to/service_directory>
109
121
```
110
122
111
-
####Change log verification
123
+
### Change log verification
112
124
113
125
Change log verification is added to ensure package has valid change log for current version. Guidelines to properly maintain the change log is documented [here](https://github.com/Azure/azure-sdk-for-python/blob/main/doc/)
114
126
115
127
## PR Validation Checks
116
-
Each pull request runs various tests using `pytest` in addition to all the tests mentioned above in analyze check. Pull request validation performs 3 different types of test: `whl, sdist and depends`. The following section explains the purpose of each of these tests and how to execute them locally. All pull requests are validated on multiple python versions across different platforms. Find the test matrix below.
117
128
129
+
Each pull request runs various tests using `pytest` in addition to all the tests mentioned above in analyze check. Pull request validation performs 3 different types of test: `whl, sdist and depends`. The following section explains the purpose of each of these tests and how to execute them locally. All pull requests are validated on multiple python versions across different platforms. Find the test matrix below.
118
130
119
131
|`Python Version`|`Platform`|
120
132
|--|--|
@@ -123,22 +135,27 @@ Each pull request runs various tests using `pytest` in addition to all the tests
123
135
|3.8|Linux|
124
136
125
137
### PR validation tox test environments
138
+
126
139
Tests are executed using tox environment and following are the tox test names that are part of pull request validation
140
+
127
141
#### whl
142
+
128
143
This test installs wheel of the package being tested and runs all tests cases in the package using `pytest`. Following is the command to run this test environment locally.
129
144
130
145
1. Go to package root folder on a command line
131
146
2. Run following command
132
147
``tox -e whl -c ../../../eng/tox/tox.ini``
133
148
134
149
#### sdist
150
+
135
151
This test installs sdist of the package being tested and runs all tests cases in the package using `pytest`. Following is the command to run this test environment locally.
136
152
137
153
1. Go to package root folder on a command line
138
154
2. Run following command
139
155
``tox -e sdist -c ../../../eng/tox/tox.ini``
140
156
141
157
#### depends
158
+
142
159
The `depends` check ensures all modules in a target package can be successfully imported. Actually installing and importing will verify that all package requirements are properly set in setup.py and that the `__all__` set for the package is properly defined. This test installs the package and its required packages, then executes `from <package-root-namespace> import *`. For example from `azure-core`, the following would be invoked: `from azure.core import *`.
143
160
144
161
Following is the command to run this test environment locally.
@@ -147,7 +164,6 @@ Following is the command to run this test environment locally.
147
164
2. Run following command
148
165
``tox -e sdist -c ../../../eng/tox/tox.ini``
149
166
150
-
151
167
## Nightly CI Checks
152
168
153
169
Nightly continuous integration checks run all tests mentioned above in Analyze and Pull request checks in addition to multiple other tests. Nightly CI checks run on all python versions that are supported by Azure SDK packages across multiple platforms.
@@ -167,8 +183,7 @@ As a developer of package `XYZ`, we need to ensure that our package works fine w
167
183
168
184
Another scenario where regression test( reverse dependency) is required. Let's take same example above and assume we are developers of package `ABC` which is taken as required package by another package `XYZ`
169
185
170
-
Package `ABC is required by package `XYZ`
171
-
186
+
Package `ABC` is required by package `XYZ`
172
187
173
188
As a developer of `ABC`, we need to ensure that any new change in `ABC` is not breaking the use of `XYZ` and hence ensures backward compatibility.
174
189
@@ -185,35 +200,34 @@ Following are the additional tests we run during nightly CI checks.
185
200
186
201
This test makes sure that a package being developed works absolutely fine using latest released version of required Azure SDK package as long as there is a released version which satisfies the requirement specification. Workflow of this test is as follows:
187
202
188
-
1.Identify if any azure SDK package is marked as required package in setup.py of current package being tested.
203
+
1. Identify if any azure SDK package is marked as required package in setup.py of current package being tested.
189
204
Note: Any dependency mentioned only in dev_requirements are not considered to identify dependency.
190
-
2.Identify latest released version of required azure sdk package on PyPI
191
-
3.Install latest released version of required package instead of dev dependency to package in code repo
192
-
4.Install current package that is being tested
193
-
5.Run pytest of all test cases in current package
205
+
2. Identify latest released version of required azure sdk package on PyPI
206
+
3. Install latest released version of required package instead of dev dependency to package in code repo
207
+
4. Install current package that is being tested
208
+
5. Run pytest of all test cases in current package
194
209
195
210
Tox name of this test is `latestdependency` and steps to manually run this test locally is as follows.
196
-
1. Go to package root. For e.g azure-storage-blob or azure-identity
197
-
2. Run following command
198
-
`Tox –e latestdependency –c ../../../tox/tox.ini`
199
211
212
+
1. Go to package root. For e.g azure-storage-blob or azure-identity
213
+
2. Run command `Tox –e latestdependency –c ../../../tox/tox.ini`
200
214
201
215
#### Minimum Dependency Test
202
216
203
217
This test makes sure that a package being developed works absolutely fine using oldest released version of required Azure SDK package as long as there is a released version which satisfies the requirement specification. Workflow of this test is as follows:
204
218
205
-
1.Identify if any azure SDK package is marked as required package in setup.py of current package being tested.
219
+
1. Identify if any azure SDK package is marked as required package in setup.py of current package being tested.
206
220
Note: Any dependency mentioned only in dev_requirements are not considered to identify dependency.
207
-
2.Identify oldest released version of required azure sdk package on PyPI
208
-
3.Install oldest released version of required package instead of dev dependency to package in code repo
209
-
4.Install current package that is being tested
210
-
5.Run pytest of all test cases in current package
221
+
2. Identify oldest released version of required azure sdk package on PyPI
222
+
3. Install oldest released version of required package instead of dev dependency to package in code repo
223
+
4. Install current package that is being tested
224
+
5. Run pytest of all test cases in current package
211
225
212
226
Tox name of this test is `mindependency` and steps to manually run this test locally is as follows.
213
-
1. Go to package root. For e.g azure-storage-blob or azure-identity
214
-
2. Run following command
215
-
`Tox –e mindependency –c ../../../tox/tox.ini`
216
227
228
+
1. Go to package root. For e.g azure-storage-blob or azure-identity
229
+
2. Run following command
230
+
`Tox –e mindependency –c ../../../tox/tox.ini`
217
231
218
232
#### Regression Test
219
233
@@ -233,37 +247,32 @@ One main difference between regression tests and forward dependency test( latest
233
247
Let's assume that we are testing regression for azure-core and this test is for regression against latest released dependent packages. Test will identify all packages that takes azure-core as required package and finds latest released version of those packages. Test framework install currently being developed azure-core and latest released dependent package and runs the test cases in dependent package, for e.g. azure-identity, that were part of repo at the time of releasing depending package.
234
248
235
249
Workflow of this test is as follows when running regression for an SDK package.
236
-
1. Identify any packages that takes currently being tested package as required package
237
-
2. Find latest and oldest released versions of dependent package from PyPI
238
-
3. Install currently being developed version of package we are testing regression for. E.g. azure-core
239
-
4. Checkout the release tag of dependent package from github
240
-
5. Install latest/oldest version of dependent package. For e.g. azure-identity
241
-
6. Run test cases within dependent package from checked out branch.
242
250
251
+
1. Identify any packages that takes currently being tested package as required package
252
+
2. Find latest and oldest released versions of dependent package from PyPI
253
+
3. Install currently being developed version of package we are testing regression for. E.g. azure-core
254
+
4. Checkout the release tag of dependent package from github
255
+
5. Install latest/oldest version of dependent package. For e.g. azure-identity
256
+
6. Run test cases within dependent package from checked out branch.
243
257
244
258
Steps to manually run regression test locally:
245
-
1. Run below command from your git code repo to generate the wheel of package being developed. Currently we have restricted to have prebuilt wheel.
259
+
260
+
1. Run below command from your git code repo to generate the wheel of package being developed. Currently we have restricted to have prebuilt wheel.
2.Run below command to start regression test locally
262
+
2. Run below command to start regression test locally
248
263
`./scripts/devops_tasks/test_regression.py azure-* --service=<service-name> --whl-dir=<out-folder given above in step 2>`
249
264
265
+
The following variables can be set at queueing time in order to run these additional tests. By default regression tests execute only on scheduled runs.
250
266
251
-
How to run these additional tests on azure pipelines manually
252
-
253
-
Following variables can be set at queueing time in order to run these additional tests which are by default run only for scheduled runs.
254
-
255
-
• Latest and oldest dependency test in addition to basic testing
256
-
Variable name: `Run.DependencyTest`
257
-
Value: true
258
-
259
-
• Regression test
267
+
Regression test
260
268
Variable name: `Run.Regression`
261
269
Value: true
262
270
263
271
#### Autorest Automation
272
+
264
273
This check will automatically create PRs with updated generated code whenever autorest has made an update that results in a change to the generated code for a package.
265
274
266
-
##### Opt-in
275
+
##### Opt-in to autorest automation
267
276
268
277
Make the following change to your projects `ci.yml`:
269
278
@@ -279,6 +288,7 @@ extends:
279
288
##### Running locally
280
289
281
290
To run autorest automation locally run the following command from the home of `azure-sdk-for-python`
0 commit comments