forked from interpretml/interpret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
518 lines (505 loc) · 19.2 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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
# We use the "Secure Development Tools" which needs to be installed in any DevOps organization that use
# this YAML file. The free public Azure Pipelines for OSS includes these tools by default already.
# TODO: add ESLint once it's added to the "Secure Development Tools". TSLint is depricated.
variables:
- name: ubuntu_image
value: ubuntu-20.04
- name: mac_image
value: macOS-13
- name: windows_image
value: windows-2022
jobs:
- job: 'bld_native'
strategy:
matrix:
Linux:
image.name: '${{ variables.ubuntu_image }}'
Mac:
image.name: '${{ variables.mac_image }}'
Windows:
image.name: '${{ variables.windows_image }}'
maxParallel: 3
pool:
vmImage: '$(image.name)'
variables:
runCodesignValidationInjection: false
steps:
- task: PythonScript@0
condition: startsWith(variables['image.name'], 'windows')
inputs:
scriptSource: 'inline'
script: from urllib.request import urlretrieve; urlretrieve('https://developer.download.nvidia.com/compute/cuda/11.2.2/network_installers/cuda_11.2.2_win10_network.exe', 'cuda_11.2.2_win10_network.exe')
displayName: 'CUDA download installer'
- script: |
REM CUDA installation https://docs.nvidia.com/cuda/pdf/CUDA_Installation_Guide_Windows.pdf
SET PATH=%PATH%;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\
SET CudaToolkitDir=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2
REM the list of NVIDIA CUDA install options is at: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html
cuda_11.2.2_win10_network.exe -s nvcc_11.2 visual_studio_integration_11.2 cudart_11.2
IF ERRORLEVEL 1 (
ECHO cuda_11.2.2_win10_network.exe FAILED
EXIT /B 201
)
.\build.bat
condition: startsWith(variables['image.name'], 'windows')
displayName: 'win bld_native'
- script: |
# sudo apt -y install nvidia-cuda-toolkit
# if [ $? -ne 0 ]; then
# exit 201
# fi
# nvcc --version
/bin/sh ./build.sh -asm
condition: startsWith(variables['image.name'], 'ubuntu')
displayName: 'linux bld_native'
- script: |
/bin/sh ./build.sh -asm
condition: startsWith(variables['image.name'], 'macOS')
displayName: 'mac bld_native'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: staging
artifactName: libebm-$(image.name)
displayName: 'Publish native shared library'
- task: PublishBuildArtifacts@1
condition: or(startsWith(variables['image.name'], 'ubuntu'), startsWith(variables['image.name'], 'macOS'))
continueOnError: true
inputs:
pathtoPublish: tmp/staging_asm_release_64
artifactName: asm-x64-$(image.name)
displayName: 'Publish assembly x64'
- task: PublishBuildArtifacts@1
condition: startsWith(variables['image.name'], 'macOS')
continueOnError: true
inputs:
pathtoPublish: tmp/staging_asm_release_arm
artifactName: asm-arm-$(image.name)
displayName: 'Publish assembly arm'
- job: 'bld_vis'
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- script: npm install && npm run build-prod
workingDirectory: 'shared/vis'
displayName: 'bld_vis'
- task: CopyFiles@2
inputs:
sourceFolder: 'shared/vis/dist'
contents: 'interpret-inline.js'
targetFolder: '$(Build.ArtifactStagingDirectory)/vis'
displayName: 'Copy interpret-inline.js library'
- task: CopyFiles@2
inputs:
sourceFolder: 'shared/vis/dist'
contents: 'interpret-inline.js.LICENSE.txt'
targetFolder: '$(Build.ArtifactStagingDirectory)/vis'
displayName: 'Copy interpret-inline.js.LICENSE.txt'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)/vis
artifactName: interpret-inline-bundle
displayName: 'Publish interpret-inline.js library'
- job: 'bld_npm_package'
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- script: npm install && npm run build-prod && npm pack
workingDirectory: 'shared/vis'
displayName: 'bld_npm_package'
- task: CopyFiles@2
inputs:
sourceFolder: 'shared/vis'
contents: '*.tgz'
targetFolder: '$(Build.ArtifactStagingDirectory)/npm'
displayName: 'Copy npm package'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/npm'
artifactName: 'npm'
displayName: 'Publish npm package'
- job: 'bld_R_package'
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- script: |
sudo apt-get update
if [ $? -ne 0 ]; then
exit 201
fi
sudo apt install --yes texlive-latex-base texlive-fonts-extra
if [ $? -ne 0 ]; then
exit 201
fi
Rscript build.R
workingDirectory: 'R'
displayName: 'Rscript build.R'
- script: cat tmp/R/interpret.Rcheck/00install.out
condition: failed()
displayName: 'Display errors'
- task: CopyFiles@2
inputs:
sourceFolder: staging
contents: 'interpret_*.tar.gz'
targetFolder: '$(Build.ArtifactStagingDirectory)/R'
displayName: 'Copy R package'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/R'
artifactName: 'R'
displayName: 'Publish R package'
- job: 'bld_sdist_package'
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
architecture: 'x64'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install tools'
- script: python setup.py sdist -d ../../staging
workingDirectory: 'python/interpret-core'
displayName: 'interpret-core bld_sdist_package'
- script: python setup.py sdist -d ../../staging
workingDirectory: 'python/interpret'
displayName: 'interpret bld_sdist_package'
- task: CopyFiles@2
inputs:
sourceFolder: staging
contents: '*.tar.gz'
targetFolder: '$(Build.ArtifactStagingDirectory)/sdist'
displayName: 'Copy sdist python package'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/sdist'
artifactName: 'sdist'
displayName: 'Publish sdist python package'
- job: 'docs'
dependsOn: 'bld_sdist_package'
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: 'sdist'
itemPattern: 'sdist/interpret-core-*.tar.gz'
targetPath: '$(System.ArtifactsDirectory)/sdist'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
- script: |
cd $(System.ArtifactsDirectory)/sdist
tarball_path=$(echo interpret-core-*.tar.gz)
python -m pip install --upgrade pip setuptools wheel
python -m pip install "$tarball_path"[required,debug,notebook,plotly,lime,sensitivity,shap,ebm,linear,decisiontree,treeinterpreter,dash,skoperules,testing]
cd $(Build.SourcesDirectory)/docs/
pip install -r requirements.txt
/bin/sh ./build.sh
displayName: 'Build docs'
- task: PublishPipelineArtifact@1
inputs:
targetPath: 'docs/interpret_docs/_build/html/'
artifactName: 'docs'
displayName: 'Publish docs'
- job: 'bld_bdist_package'
dependsOn: ['bld_native', 'bld_vis']
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'specific'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
architecture: 'x64'
- script: python -m pip install --upgrade pip setuptools wheel
displayName: 'Install tools'
- task: CopyFiles@2
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/libebm_*_x64*'
targetFolder: 'python/interpret-core/interpret/lib'
flattenFolders: true
displayName: 'Copy x64 native library to python lib directory'
- task: CopyFiles@2
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/libebm_*_arm*'
targetFolder: 'python/interpret-core/interpret/lib'
flattenFolders: true
displayName: 'Copy arm native library to python lib directory'
- task: CopyFiles@2
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/interpret-inline.js'
targetFolder: 'python/interpret-core/interpret/lib'
flattenFolders: true
displayName: 'Copy interpret-inline.js to python lib directory'
- task: CopyFiles@2
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/interpret-inline.js.LICENSE.txt'
targetFolder: 'python/interpret-core/interpret/lib'
flattenFolders: true
displayName: 'Copy interpret-inline.js.LICENSE.txt to python lib directory'
- script: python setup.py bdist_wheel -d ../../staging
workingDirectory: 'python/interpret-core'
displayName: 'interpret-core bld_bdist_package'
# TODO: python setup.py bdist_wheel -d ../../staging is rebuilding the native code and the javascript, which is slowing the build
- script: python setup.py bdist_wheel -d ../../staging
workingDirectory: 'python/interpret'
displayName: 'interpret bld_bdist_package'
- task: CopyFiles@2
inputs:
sourceFolder: staging
contents: '*.whl'
targetFolder: '$(Build.ArtifactStagingDirectory)/bdist'
displayName: 'Copy bdist python package'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/bdist'
artifactName: 'bdist'
displayName: 'Publish bdist python package'
- job: 'test_native'
dependsOn: 'bld_native'
strategy:
matrix:
Linux:
image.name: '${{ variables.ubuntu_image }}'
Mac:
image.name: '${{ variables.mac_image }}'
Windows:
image.name: '${{ variables.windows_image }}'
maxParallel: 3
pool:
vmImage: '$(image.name)'
variables:
runCodesignValidationInjection: false
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'specific'
- task: CopyFiles@2
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/libebm_*'
targetFolder: 'staging'
flattenFolders: true
displayName: 'Copy native library to staging directory'
- task: PythonScript@0
condition: startsWith(variables['image.name'], 'windows')
inputs:
scriptSource: 'inline'
script: from urllib.request import urlretrieve; urlretrieve('https://developer.download.nvidia.com/compute/cuda/11.2.2/network_installers/cuda_11.2.2_win10_network.exe', 'cuda_11.2.2_win10_network.exe')
displayName: 'Download CUDA installer'
- script: |
/bin/sh ./shared/libebm/tests/libebm_test.sh -existing_debug_64 -existing_release_64
condition: startsWith(variables['image.name'], 'macOS')
displayName: 'mac test_native'
- script: |
/bin/sh ./shared/libebm/tests/libebm_test.sh -debug_32 -release_32 -existing_debug_64 -existing_release_64 -no_valgrind
condition: and(startsWith(variables['image.name'], 'ubuntu'), ne(variables['Build.Reason'], 'Schedule'))
displayName: 'linux test_native (CI)'
- script: |
/bin/sh ./shared/libebm/tests/libebm_test.sh -debug_32 -release_32 -existing_debug_64 -existing_release_64
condition: and(startsWith(variables['image.name'], 'ubuntu'), eq(variables['Build.Reason'], 'Schedule'))
displayName: 'linux test_native (Schedule)'
- script: |
REM CUDA installation https://docs.nvidia.com/cuda/pdf/CUDA_Installation_Guide_Windows.pdf
SET PATH=%PATH%;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\
SET CudaToolkitDir=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2
REM the list of NVIDIA CUDA install options is at: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html
cuda_11.2.2_win10_network.exe -s nvcc_11.2 visual_studio_integration_11.2 cudart_11.2
IF ERRORLEVEL 1 (
ECHO cuda_11.2.2_win10_network.exe FAILED
EXIT /B 201
)
.\shared\libebm\tests\libebm_test.bat -pipeline
condition: and(startsWith(variables['image.name'], 'windows'), ne(variables['Build.Reason'], 'Schedule'))
displayName: 'win test_native (CI)'
- script: |
REM CUDA installation https://docs.nvidia.com/cuda/pdf/CUDA_Installation_Guide_Windows.pdf
SET PATH=%PATH%;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\
SET CudaToolkitDir=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2
REM the list of NVIDIA CUDA install options is at: https://docs.nvidia.com/cuda/cuda-installation-guide-microsoft-windows/index.html
cuda_11.2.2_win10_network.exe -s nvcc_11.2 visual_studio_integration_11.2 cudart_11.2
IF ERRORLEVEL 1 (
ECHO cuda_11.2.2_win10_network.exe FAILED
EXIT /B 201
)
.\shared\libebm\tests\libebm_test.bat -pipeline -analysis
condition: and(startsWith(variables['image.name'], 'windows'), eq(variables['Build.Reason'], 'Schedule'))
displayName: 'win test_native (Schedule)'
- task: ComponentGovernanceComponentDetection@0
displayName: 'Scan dependencies for incompatible licenses and security issues'
- task: CredScan@2
inputs:
toolMajorVersion: 'V2'
displayName: 'Scan codebase for leaked secrets'
condition: startsWith(variables['image.name'], 'windows')
# - task: BinSkim@3
# displayName: 'Scan DLLs for compiler/linker security improvements'
# condition: startsWith(variables['image.name'], 'windows')
# inputs:
# InputType: Basic
# AnalyzeTarget: 'staging\*.dll'
# AnalyzeSymPath: 'staging'
# AnalyzeVerbose: true
# - task: AntiMalware@3
# displayName: 'AntiMalware scan'
- task: SdtReport@1
condition: startsWith(variables['image.name'], 'windows')
inputs:
TsvFile: false
AllTools: false
BinSkim: false
CredScan: true
MSRD: false
RoslynAnalyzers: false
TSLint: false
ToolLogsNotFoundAction: 'Standard'
displayName: 'Generate security report'
- task: PublishSecurityAnalysisLogs@2
condition: startsWith(variables['image.name'], 'windows')
inputs:
ArtifactName: 'CodeAnalysisLogs'
ArtifactType: 'Container'
AllTools: true
ToolLogsNotFoundAction: 'Standard'
displayName: 'Publish security report'
- task: PostAnalysis@1
condition: startsWith(variables['image.name'], 'windows')
inputs:
AllTools: false
BinSkim: false
CredScan: true
RoslynAnalyzers: false
TSLint: false
ToolLogsNotFoundAction: 'Standard'
displayName: 'Stop on security errors'
- job: 'test' # just call this test since we have limited room in the UI to show the OS and python version
dependsOn: 'bld_bdist_package'
strategy:
matrix:
Linux38Python:
python.version: '3.8'
image.name: '${{ variables.ubuntu_image }}'
Linux39Python:
python.version: '3.9'
image.name: '${{ variables.ubuntu_image }}'
Linux310Python:
python.version: '3.10'
image.name: '${{ variables.ubuntu_image }}'
Win38Python:
python.version: '3.8'
image.name: '${{ variables.windows_image }}'
Win39Python:
python.version: '3.9'
image.name: '${{ variables.windows_image }}'
Win310Python:
python.version: '3.10'
image.name: '${{ variables.windows_image }}'
Mac38Python:
python.version: '3.8'
image.name: '${{ variables.mac_image }}'
Mac39Python:
python.version: '3.9'
image.name: '${{ variables.mac_image }}'
Mac310Python:
python.version: '3.10'
image.name: '${{ variables.mac_image }}'
maxParallel: 9
pool:
vmImage: '$(image.name)'
variables:
runCodesignValidationInjection: false
steps:
- task: DownloadPipelineArtifact@2
inputs:
artifactName: 'bdist'
itemPattern: 'bdist/interpret_core-*.whl'
targetPath: '$(System.ArtifactsDirectory)/bdist'
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
# we copy the tests to a new location to test the installed package rather than the source files
- script: |
python -m pip install --upgrade pip setuptools wheel
FOR %%A IN ($(System.ArtifactsDirectory)\bdist\interpret_core-*.whl) DO SET "install_file=%%A"
python -m pip install "%install_file%"[required,debug,notebook,plotly,lime,sensitivity,shap,ebm,linear,decisiontree,treeinterpreter,dash,skoperules,testing]
set PATH=%PATH%;%GeckoWebDriver%
mkdir "$(Agent.TempDirectory)\zqmr"
mkdir "$(Agent.TempDirectory)\zqmr\t"
xcopy /E "$(Build.SourcesDirectory)\python\interpret-core\tests\*" "$(Agent.TempDirectory)\zqmr\t\"
cd /D "$(Agent.TempDirectory)\zqmr\t"
python -m pytest -vv -n auto --junitxml=junit/test-results.xml --cov=interpret --cov-report=xml --cov-report=html
condition: startsWith(variables['image.name'], 'windows')
displayName: 'pytest (win)'
# we copy the tests to a new location to test the installed package rather than the source files
- script: |
python -m pip install --upgrade pip setuptools wheel
cd $(System.ArtifactsDirectory)/bdist
install_file=$(echo interpret_core-*.whl)
python -m pip install "$install_file"[required,debug,notebook,plotly,lime,sensitivity,shap,ebm,linear,decisiontree,treeinterpreter,dash,skoperules,testing]
mkdir -p "$(Agent.TempDirectory)/zqmr/t"
cp -r "$(Build.SourcesDirectory)/python/interpret-core/tests/" "$(Agent.TempDirectory)/zqmr/t/"
cd "$(Agent.TempDirectory)/zqmr/t"
python -m pytest -vv -n auto --junitxml=junit/test-results.xml --cov=interpret --cov-report=xml --cov-report=html
condition: not(startsWith(variables['image.name'], 'windows'))
displayName: 'pytest (non-win)'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '$(Agent.TempDirectory)/zqmr/t/junit/test-results.xml'
testRunTitle: 'Publish test results for Python $(python.version) at $(image.name)'
displayName: 'Publish test results'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(Agent.TempDirectory)/zqmr/t/coverage.xml'
# reportDirectory: '$(Agent.TempDirectory)/zqmr/t/**/htmlcov'
condition: startsWith(variables['image.name'], 'windows')
displayName: 'Publish test coverage results'
- job: 'publish_source_code'
dependsOn: ['test_native', 'test']
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.8'
architecture: 'x64'
- script: |
python -m pip install --upgrade black
black --check .
workingDirectory: 'python/interpret-core'
displayName: 'black formatting check'
- task: PublishPipelineArtifact@0
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
artifactName: 'source_code'
schedules:
- cron: "0 12 * * *"
displayName: Daily midnight build
branches:
include:
- develop
always: true