-
Notifications
You must be signed in to change notification settings - Fork 7
/
azure-pipelines.yml
313 lines (256 loc) · 8.12 KB
/
azure-pipelines.yml
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
trigger:
- master
- refs/tags/*
pr:
- master
variables:
pytest_ver: 7.2.0
mypy_ver: 0.991
isort_ver: 5.10.1
flake8_ver: 5.0.4
black_ver: 22.10.0
cibuildwheel_ver: 2.11.2
setuptools_rust_ver: 1.5.2
pytest_asyncio_ver: 0.20.2
uvloop_ver: 0.17.0
pytest_cov_ver: 4.0.0
codecov_ver: 2.1.12
windows_image: 'windows-2022'
linux_image: 'ubuntu-22.04'
macos_image: 'macOS-12'
resources:
containers:
- container: snmp
image: koshh/aiosnmp:latest
ports:
- 161:161/udp
jobs:
- job: check
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
architecture: 'x64'
- script: pip install mypy==$(mypy_ver) isort==$(isort_ver) flake8==$(flake8_ver) black==$(black_ver)
displayName: 'Install Dependencies'
- script: flake8 aiosnmp/ tests/ examples/ setup.py
displayName: 'Run flake8'
- script: isort -q --check --diff aiosnmp/ tests/ examples/ setup.py
displayName: 'Run isort'
- script: black -q --check --diff aiosnmp/ tests/ examples/ setup.py
displayName: 'Run black'
- script: mypy aiosnmp/
displayName: 'Run mypy'
- script: cargo fmt -- --check
displayName: 'Run rustfmt'
# -A clippy::borrow_deref_ref should be removed https://github.com/rust-lang/rust-clippy/issues/8971
- script: cargo clippy --all-targets --all-features -- -D warnings -A clippy::borrow_deref_ref
displayName: 'Run clippy'
- job: macos
dependsOn:
- check
pool:
vmImage: $(macos_image)
variables:
CIBW_BUILD: cp3{7,8,9,10,11}-*
CIBW_TEST_REQUIRES: pytest==$(pytest_ver)
CIBW_TEST_COMMAND: pytest $(Build.SourcesDirectory)/tests/test_asn1.py
steps:
- task: UsePythonVersion@0
- script: |
set -o errexit
python3 -m pip install --upgrade pip
python3 -m pip install cibuildwheel==$(cibuildwheel_ver)
displayName: Install dependencies
- script: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
- task: PublishPipelineArtifact@1
inputs:
targetPath: wheelhouse
artifactName: macos_wheels
parallel: true
- job: linux
dependsOn:
- check
pool:
vmImage: $(linux_image)
variables:
CIBW_BUILD: cp3{7,8,9,10,11}-*
CIBW_SKIP: "*_i686"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL: curl https://sh.rustup.rs -sSf | sh -s -- -y
CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"'
CIBW_TEST_REQUIRES: pytest==$(pytest_ver)
CIBW_TEST_COMMAND: pytest /project/tests/test_asn1.py
steps:
- task: UsePythonVersion@0
- script: |
set -o errexit
python3 -m pip install --upgrade pip
pip3 install cibuildwheel==$(cibuildwheel_ver)
displayName: Install dependencies
- script: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
- task: PublishPipelineArtifact@1
inputs:
targetPath: wheelhouse
artifactName: linux_wheels
parallel: true
- job: windows
dependsOn:
- check
pool:
vmImage: $(windows_image)
variables:
CIBW_BUILD: cp3{7,8,9,10,11}-*
CIBW_SKIP: "*-win32"
CIBW_TEST_REQUIRES: pytest==$(pytest_ver)
CIBW_TEST_COMMAND: pytest $(Build.SourcesDirectory)\\tests\\test_asn1.py
steps:
- task: UsePythonVersion@0
- script: |
set -o errexit
python -m pip install --upgrade pip
pip install cibuildwheel==$(cibuildwheel_ver)
displayName: Install dependencies
- script: cibuildwheel --output-dir wheelhouse .
displayName: Build wheels
- task: PublishPipelineArtifact@1
inputs:
targetPath: wheelhouse
artifactName: windows_wheels
parallel: true
- job: sdist
dependsOn:
- check
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
- script: |
set -o errexit
python -m pip install --upgrade pip
pip install setuptools-rust==$(setuptools_rust_ver)
displayName: Install dependencies
- script: python setup.py sdist
displayName: Build tar.gz
- task: PublishPipelineArtifact@1
inputs:
targetPath: dist
artifactName: sdist
- job: tests
dependsOn:
- linux
pool:
vmImage: 'ubuntu-latest'
strategy:
matrix:
Python37-asyncio:
python.version: '3.7'
loop: 'asyncio'
Python37-uvloop:
python.version: '3.7'
loop: 'uvloop'
Python38-asyncio:
python.version: '3.8'
loop: 'asyncio'
Python38-uvloop:
python.version: '3.8'
loop: 'uvloop'
Python39-asyncio:
python.version: '3.9'
loop: 'asyncio'
Python39-uvloop:
python.version: '3.9'
loop: 'uvloop'
Python310-asyncio:
python.version: '3.10'
loop: 'asyncio'
Python310-uvloop:
python.version: '3.10'
loop: 'uvloop'
Python311-asyncio:
python.version: '3.11'
loop: 'asyncio'
Python311-uvloop:
python.version: '3.11'
loop: 'uvloop'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
displayName: 'Use Python $(python.version)'
- task: DownloadPipelineArtifact@2
inputs:
artifact: linux_wheels
path: $(System.DefaultWorkingDirectory)/wheels
- script: pip install --no-index --find-links $(System.DefaultWorkingDirectory)/wheels aiosnmp
displayName: 'Install aiosnmp'
- script: pip install pytest==$(pytest_ver) pytest-asyncio==$(pytest_asyncio_ver) uvloop==$(uvloop_ver)
displayName: 'Install Dependencies'
- script: pytest --durations=5 --event-loop=$(loop) tests/
displayName: 'Run Tests'
services:
snmp: snmp
- job: coverage
dependsOn:
- linux
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
- script: pip install setuptools-rust==$(setuptools_rust_ver)
displayName: 'Install Build Dependencies'
- script: python setup.py develop
displayName: 'Compile Rust Module'
- script: pip install pytest==$(pytest_ver) pytest-asyncio==$(pytest_asyncio_ver) pytest-cov==$(pytest_cov_ver) uvloop==$(uvloop_ver) codecov==$(codecov_ver)
displayName: 'Install Test Dependencies'
- script: python -m pytest --cov=aiosnmp --cov-report=term-missing tests/
displayName: 'Run Tests'
- script: bash <(curl -s https://codecov.io/bash)
displayName: 'Upload to codecov.io'
services:
snmp: snmp
- job: twine
pool:
vmImage: 'ubuntu-latest'
dependsOn:
- check
- linux
- macos
- windows
- sdist
- tests
condition: and(succeeded(), startsWith(variables['build.sourceBranch'], 'refs/tags/'))
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
architecture: 'x64'
- task: DownloadPipelineArtifact@2
inputs:
artifact: macos_wheels
path: $(System.DefaultWorkingDirectory)/wheels
- task: DownloadPipelineArtifact@2
inputs:
artifact: linux_wheels
path: $(System.DefaultWorkingDirectory)/wheels
- task: DownloadPipelineArtifact@2
inputs:
artifact: windows_wheels
path: $(System.DefaultWorkingDirectory)/wheels
- task: DownloadPipelineArtifact@2
inputs:
artifact: sdist
path: $(System.DefaultWorkingDirectory)/wheels
- script: pip install twine
displayName: 'Install Dependencies'
- task: TwineAuthenticate@1
displayName: 'Twine Authenticate'
inputs:
pythonUploadServiceConnection: uploadToPypi
- script: python -m twine upload -r uploadToPypi --config-file $(PYPIRC_PATH) wheels/*
displayName: 'Upload'