forked from interpretml/interpret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
373 lines (364 loc) · 12.8 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
# 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-18.04
- name: mac_image
value: macOS-10.14
- name: windows_image
value: windows-2019
jobs:
- job: 'Build_ebm_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:
- script: |
/bin/sh ./build.sh -32bit
condition: startsWith(variables['image.name'], 'ubuntu')
displayName: 'Building ebm_native code (Linux)'
- script: |
/bin/sh ./build.sh
condition: startsWith(variables['image.name'], 'macOS')
displayName: 'Building ebm_native code (Mac)'
- script: |
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
.\build.bat -32bit
condition: startsWith(variables['image.name'], 'windows')
displayName: 'Building ebm_native code (Windows)'
- task: ComponentGovernanceComponentDetection@0
displayName: 'Scan dependencies for incompatible licenses and security issues'
- task: CredScan@2
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
displayName: 'Generate security report'
condition: startsWith(variables['image.name'], 'windows')
inputs:
TsvFile: false
AllTools: false
BinSkim: false
CredScan: true
MSRD: false
RoslynAnalyzers: false
TSLint: false
ToolLogsNotFoundAction: 'Standard'
- task: PublishSecurityAnalysisLogs@2
displayName: 'Publish security report'
condition: startsWith(variables['image.name'], 'windows')
inputs:
ArtifactName: 'CodeAnalysisLogs'
ArtifactType: 'Container'
AllTools: true
ToolLogsNotFoundAction: 'Standard'
- task: PostAnalysis@1
displayName: 'Stop on security errors'
condition: startsWith(variables['image.name'], 'windows')
inputs:
AllTools: false
BinSkim: false
CredScan: true
RoslynAnalyzers: false
TSLint: false
ToolLogsNotFoundAction: 'Standard'
- task: CopyFiles@2
condition: succeeded()
inputs:
sourceFolder: staging
contents: '*'
targetFolder: '$(Build.ArtifactStagingDirectory)'
displayName: 'Move binary to staging'
- task: PublishBuildArtifacts@1
condition: succeeded()
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: ebm_native-$(image.name)
displayName: 'Publish ebm_native library'
- job: 'Test_ebm_native'
dependsOn: 'Build_ebm_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'
displayName: 'Download build artifacts'
- task: CopyFiles@2
condition: succeeded()
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/lib_ebm_native_*'
targetFolder: 'staging'
flattenFolders: true
displayName: 'Move binary to staging directory'
- script: |
/bin/sh ./shared/ebm_native/ebm_native_test/ebm_native_test.sh -nobuildebmnative
condition: startsWith(variables['image.name'], 'ubuntu')
displayName: 'Testing ebm_native code (Linux)'
- script: |
/bin/sh ./shared/ebm_native/ebm_native_test/ebm_native_test.sh -nobuildebmnative
condition: startsWith(variables['image.name'], 'macOS')
displayName: 'Testing ebm_native code (Mac)'
- script: |
set PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
.\shared\ebm_native\ebm_native_test\ebm_native_test.bat -nobuildebmnative
condition: startsWith(variables['image.name'], 'windows')
displayName: 'Testing ebm_native code (Windows)'
- job: 'Build_JS_Inline'
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
architecture: 'x64'
- script: python build-js-bundles.py devops
workingDirectory: 'python/scripts'
displayName: 'Build JS bundle'
- task: CopyFiles@2
condition: succeeded()
inputs:
sourceFolder: 'python/interpret-core/interpret/lib'
contents: 'interpret-inline.js'
targetFolder: '$(Build.ArtifactStagingDirectory)'
displayName: 'Move assets to staging'
- task: PublishBuildArtifacts@1
condition: succeeded()
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: interpret-inline-bundle
displayName: 'Publish interpret-inline.js library'
- job: 'Build_Package'
dependsOn: ['Build_ebm_native', 'Build_JS_Inline']
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'specific'
displayName: 'Download build artifacts'
- task: UsePythonVersion@0
condition: succeeded()
inputs:
versionSpec: '3.6'
architecture: 'x64'
- script: python -m pip install --upgrade pip setuptools wheel
condition: succeeded()
displayName: 'Install tools'
- task: CopyFiles@2
condition: succeeded()
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/lib_ebm_native_*_x64*'
targetFolder: 'python/interpret-core/interpret/lib'
flattenFolders: true
displayName: 'Move binary to Python layer'
- task: CopyFiles@2
condition: succeeded()
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/interpret-inline.js'
targetFolder: 'python/interpret-core/interpret/lib'
flattenFolders: true
displayName: 'Move interpret-inline.js to Python layer'
- script: python setup.py bdist_wheel -d ../../staging
condition: succeeded()
workingDirectory: 'python/interpret-core'
displayName: 'Build wheel (interpret-core)'
- script: python setup.py bdist_wheel -d ../../staging
condition: succeeded()
workingDirectory: 'python/interpret'
displayName: 'Build wheel (interpret)'
- task: CopyFiles@2
condition: succeeded()
inputs:
sourceFolder: staging
contents: '*.whl'
targetFolder: '$(Build.ArtifactStagingDirectory)/wheel'
displayName: 'Move wheel for Build Artifact'
- task: PublishBuildArtifacts@1
condition: succeeded()
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)/wheel'
artifactName: 'wheel'
displayName: 'Publish wheel as Build Artifact'
- job: 'Test'
dependsOn: 'Build_Package'
# NOTE: Python 3.9 not supported yet in Azure DevOps.
strategy:
matrix:
LinuxPython36:
python.version: '3.6'
image.name: '${{ variables.ubuntu_image }}'
LinuxPython37:
python.version: '3.7'
image.name: '${{ variables.ubuntu_image }}'
LinuxPython38:
python.version: '3.8'
image.name: '${{ variables.ubuntu_image }}'
# LinuxPython39:
# python.version: '3.9'
# image.name: '${{ variables.ubuntu_image }}'
WindowsPython36:
python.version: '3.6'
image.name: '${{ variables.windows_image }}'
WindowsPython37:
python.version: '3.7'
image.name: '${{ variables.windows_image }}'
# NOTE: Temporary disable due to upstream dependencies.
# WindowsPython38:
# python.version: '3.8'
# image.name: '${{ variables.windows_image }}'
# WindowsPython39:
# python.version: '3.9'
# image.name: '${{ variables.windows_image }}'
MacPython36:
python.version: '3.6'
image.name: '${{ variables.mac_image }}'
MacPython37:
python.version: '3.7'
image.name: '${{ variables.mac_image }}'
MacPython38:
python.version: '3.8'
image.name: '${{ variables.mac_image }}'
# MacPython39:
# python.version: '3.9'
# image.name: '${{ variables.mac_image }}'
maxParallel: 9
pool:
vmImage: '$(image.name)'
variables:
runCodesignValidationInjection: false
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'specific'
displayName: 'Download build artifacts'
- task: CopyFiles@2
condition: succeeded()
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/lib_ebm_native_*'
targetFolder: 'python/interpret-core/interpret/lib'
flattenFolders: true
displayName: 'Move binary to Python layer'
- task: CopyFiles@2
condition: succeeded()
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
contents: '**/interpret-inline.js'
targetFolder: 'python/interpret-core/interpret/lib'
flattenFolders: true
displayName: 'Move Interpret inline to Python layer'
- task: UsePythonVersion@0
condition: succeeded()
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: python -m pip install --upgrade pip setuptools wheel
condition: succeeded()
displayName: 'Install tools'
- script: python -m pip install numpy scipy
condition: succeeded()
workingDirectory: python/interpret-core
displayName: 'Install numpy/scipy first for mis-specified pip packages.'
- script: |
mkdir -p ~/.matplotlib
echo "backend: TkAgg" >> ~/.matplotlib/matplotlibrc
condition: startsWith(variables['image.name'], 'macOS')
displayName: 'Matplotlib patch for mac.'
- script: python -m pip install -r dev-requirements.txt
condition: succeeded()
workingDirectory: python/interpret-core
displayName: 'Install requirements (Linux/Mac/Windows)'
- script: |
set PATH=%PATH%;%GeckoWebDriver%
python -m pytest -vv -n auto --runslow --runselenium --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
workingDirectory: python/interpret-core
condition: and(startsWith(variables['image.name'], 'windows'), or(eq(variables['Build.Reason'], 'Schedule'), in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/develop')))
displayName: 'Run pytest (Windows scheduled / master / develop)'
- script: |
python -m pytest -vv -n auto --runslow --doctest-modules --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html
workingDirectory: python/interpret-core
condition: not(and(startsWith(variables['image.name'], 'windows'), or(eq(variables['Build.Reason'], 'Schedule'), in(variables['Build.SourceBranch'], 'refs/heads/master', 'refs/heads/develop'))))
displayName: 'Run pytest (Rest)'
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results for Python $(python.version) at $(image.name)'
displayName: 'Publish test results'
- task: PublishCodeCoverageResults@1
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/coverage.xml'
reportDirectory: '$(System.DefaultWorkingDirectory)/**/htmlcov'
condition: startsWith(variables['image.name'], 'windows')
displayName: 'Publish test coverage results'
- job: 'Publish_Package'
dependsOn: ['Test_ebm_native', 'Test']
pool:
vmImage: '${{ variables.ubuntu_image }}'
variables:
runCodesignValidationInjection: false
steps:
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'wheel'
- task: DownloadBuildArtifacts@0
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'interpret-inline-bundle'
- task: PublishPipelineArtifact@0
inputs:
sourceFolder: '$(System.ArtifactsDirectory)'
artifactName: 'drop'
schedules:
- cron: "0 0 * * *"
displayName: Daily midnight build
branches:
include:
- develop
always: true