forked from 51Degrees/device-detection-cxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-and-test.yml
464 lines (393 loc) · 14 KB
/
build-and-test.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
name: Build and Test Device Detection C++
pr:
- master
- develop
trigger: none
stages:
- stage: Data
jobs:
- job: Get_Enterprise_DataFile
pool:
name: Hosted Ubuntu 1604
steps:
- script: |
curl "https://distributor.51degrees.com/api/v2/download?LicenseKeys=$(licensekey)&Type=HashV41&Download=True&Product=V4Enterprise" --output Enterprise-HashV41.hash.gz
displayName: 'Download Latest Data File'
- task: ExtractFiles@1
displayName: 'Extract Data File'
inputs:
archiveFilePatterns: 'Enterprise-HashV41.hash.gz'
cleanDestinationFolder: false
- script: |
mv $(Build.SourcesDirectory)/Enterprise-HashV41.hash $(Build.ArtifactStagingDirectory)/51Degrees-EnterpriseV4.1.hash
displayName: 'Move Data File'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'enterpriseFile'
publishLocation: 'Container'
- stage: Windows
dependsOn: [Data]
pool:
name: Hosted VS2017
demands:
- msbuild
- vstest
jobs:
- job: Build_VisualStudio
strategy:
maxParallel: 1
matrix:
debug x86 multi threads:
BuildConfiguration: Debug
BuildPlatform: x86
BuildDirectory: Win32/Debug
release x86 multi threads:
BuildConfiguration: Release
BuildPlatform: x86
BuildDirectory: Win32/Release
debug x64 multi threads:
BuildConfiguration: Debug
BuildPlatform: x64
BuildDirectory: x64/Debug
release x64 multi threads:
BuildConfiguration: Release
BuildPlatform: x64
BuildDirectory: x64/Release
ebug x86 single thread:
BuildConfiguration: Debug-Single
BuildPlatform: x86
BuildDirectory: Win32/Debug
release x86 single thread:
BuildConfiguration: Release-Single
BuildPlatform: x86
BuildDirectory: Win32/Release
debug x64 single thread:
BuildConfiguration: Debug-Single
BuildPlatform: x64
BuildDirectory: x64/Debug
release x64 single thread:
BuildConfiguration: Release-Single
BuildPlatform: x64
BuildDirectory: x64/Release
timeoutInMinutes: 240
steps:
- checkout: self
submodules: recursive
lfs: true
persistCredentials: true
- powershell: |
git lfs install
ls
git -c http.https://51degrees.visualstudio.com.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" lfs fetch
git -c http.https://51degrees.visualstudio.com.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" lfs checkout
ls
workingDirectory: 'device-detection-data'
displayName: 'Fetch LFS Data Files'
- task: DownloadBuildArtifacts@0
displayName: 'Download Enterprise Data File'
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'enterpriseFile'
downloadPath: '$(System.ArtifactsDirectory)'
- script: |
mv $(System.ArtifactsDirectory)\enterpriseFile\51Degrees-EnterpriseV4.1.hash $(Build.SourcesDirectory)\device-detection-data\51Degrees-EnterpriseV4.1.hash
displayName: 'Move Data File'
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: 'VisualStudio/DeviceDetection.sln'
feedsToUse: 'select'
vstsFeed: 'd2431f86-c1e6-4d8b-8d27-311cf3614847'
- task: MSBuild@1
displayName: 'Build Visual Studio Solution'
inputs:
solution: 'VisualStudio/DeviceDetection.sln'
msbuildArchitecture: x64
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
clean: true
- bash: './FiftyOne.DeviceDetection.Hash.Tests.exe --gtest_filter="-*TestOfflineProcessing*" --gtest_catch_exceptions=1 --gtest_break_on_failure=0 --gtest_output=xml:testoutput.xml'
workingDirectory: VisualStudio/FiftyOne.DeviceDetection.Hash.Tests/$(BuildDirectory)
failOnStderr: true
displayName: 'Run Hash Tests'
- task: PublishTestResults@2
condition: true
inputs:
testResultsFormat: 'JUnit'
testRunTitle: 'Visual Studio $(BuildPlatform) $(BuildConfiguration)'
testResultsFiles: 'VisualStudio\FiftyOne.DeviceDetection.Hash.Tests\$(BuildDirectory)\testoutput.xml'
- job: Build_And_Test_CMake
timeoutInMinutes: 240
strategy:
maxParallel: 1
matrix:
debug x86 multi threads:
BuildConfiguration: Debug
BuildPlatform: Win32
BuildArguments: -DNoThreading=OFF
release x86 multi threads:
BuildConfiguration: Release
BuildPlatform: Win32
BuildArguments: -DNoThreading=OFF
debug x64 multi threads:
BuildConfiguration: Debug
BuildPlatform: x64
BuildArguments: -DNoThreading=OFF
release x64 multi threads:
BuildConfiguration: Release
BuildPlatform: x64
BuildArguments: -DNoThreading=OFF
debug x86 single thread:
BuildConfiguration: Debug
BuildPlatform: Win32
BuildArguments: -DNoThreading=ON
release x86 single thread:
BuildConfiguration: Release
BuildPlatform: Win32
BuildArguments: -DNoThreading=ON
debug x64 single thread:
BuildConfiguration: Debug
BuildPlatform: x64
BuildArguments: -DNoThreading=ON
release x64 single thread:
BuildConfiguration: Release
BuildPlatform: x64
BuildArguments: -DNoThreading=ON
steps:
- checkout: self
submodules: recursive
lfs: true
persistCredentials: true
- powershell: |
git lfs install
ls
git -c http.https://51degrees.visualstudio.com.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" lfs fetch
git -c http.https://51degrees.visualstudio.com.extraheader="AUTHORIZATION: bearer $(System.AccessToken)" lfs checkout
ls
workingDirectory: 'device-detection-data'
displayName: 'Fetch LFS Data Files'
- task: Bash@3
displayName: 'Create Build Directory'
inputs:
targetType: 'inline'
script: 'mkdir build'
- task: DownloadBuildArtifacts@0
displayName: 'Download Enterprise Data File'
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'enterpriseFile'
downloadPath: '$(System.ArtifactsDirectory)'
- script: |
mv $(System.ArtifactsDirectory)\enterpriseFile\51Degrees-EnterpriseV4.1.hash $(Build.SourcesDirectory)\device-detection-data\51Degrees-EnterpriseV4.1.hash
displayName: 'Move Data File'
- task: CMake@1
displayName: 'CMake Configure'
inputs:
workingDirectory: build
cmakeArgs: '.. -A $(BuildPlatform) $(BuildArguments)'
- task: CMake@1
displayName: 'CMake Build'
inputs:
workingDirectory: build
cmakeArgs: '--build . --config $(BuildConfiguration)'
- bash: 'ctest -R ".*Hash.*" -E ".*TestOfflineProcessing.*" -T test --no-compress-output'
workingDirectory: build
failOnStderr: true
displayName: 'Run Tests'
- task: PublishTestResults@2
condition: true
inputs:
testResultsFormat: 'CTest'
testRunTitle: 'Windows CTest $(BuildPlatform) $(BuildConfiguration) $(BuildArguments)'
testResultsFiles: '**/Test.xml'
- stage: Linux
dependsOn: [Data]
jobs:
- job: Build_And_Test
timeoutInMinutes: 240
pool:
name: Hosted Ubuntu 1604
strategy:
matrix:
debug x86 multi threads:
BuildConfiguration: Debug
BuildPlatform: x86
BuildArguments: -D32bit=ON -DNoThreading=OFF
release x86 multi threads:
BuildConfiguration: Release
BuildPlatform: x86
BuildArguments: -D32bit=ON -DNoThreading=OFF
debug x64 multi threads:
BuildConfiguration: Debug
BuildPlatform: x64
BuildArguments: -DNoThreading=OFF
release x64 multi threads:
BuildConfiguration: Release
BuildPlatform: x64
BuildArguments: -DNoThreading=OFF
debug x86 single thread:
BuildConfiguration: Debug
BuildPlatform: x86
BuildArguments: -D32bit=ON -DNoThreading=ON
release x86 single thread:
BuildConfiguration: Release
BuildPlatform: x86
BuildArguments: -D32bit=ON -DNoThreading=ON
debug x64 single thread:
BuildConfiguration: Debug
BuildPlatform: x64
BuildArguments: -DNoThreading=ON
release x64 single thread:
BuildConfiguration: Release
BuildPlatform: x64
BuildArguments: -DNoThreading=ON
steps:
- checkout: self
submodules: recursive
lfs: true
- script: |
ulimit -c unlimited
echo "cat /proc/sys/kernel/core_pattern"
cat /proc/sys/kernel/core_pattern
echo "cat /proc/sys/kernel/core_uses_pid"
cat /proc/sys/kernel/core_uses_pid
echo "sudo systemctl enable apport.service"
sudo systemctl enable apport.service
echo "sysctl -w kernel.core_pattern=core.%p"
sudo sysctl -w kernel.core_pattern="core.%p"
cat /proc/sys/kernel/core_pattern
sudo apt-get -y install \
gcc-multilib \
g++-multilib
displayName: 'Install Required Packages'
- script: |
wget http://ftp.br.debian.org/debian/pool/main/d/dmalloc/libdmalloc-dev_5.5.2-6_i386.deb
sudo dpkg --add-architecture i386
sudo apt-get -y update
sudo dpkg -i libdmalloc-dev_5.5.2-6_i386.deb
sudo sudo apt-get -y install -f
displayName: 'Install Required 32bit Packages'
condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86'))
- script: |
sudo apt-get -y install libdmalloc-dev
displayName: 'Install Required 64bit Packages'
condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64'))
- task: DownloadBuildArtifacts@0
displayName: 'Download Enterprise Data File'
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'enterpriseFile'
downloadPath: '$(System.ArtifactsDirectory)'
- script: |
mv $(System.ArtifactsDirectory)/enterpriseFile/51Degrees-EnterpriseV4.1.hash $(Build.SourcesDirectory)/device-detection-data/51Degrees-EnterpriseV4.1.hash
displayName: 'Move Data File'
- task: Bash@3
displayName: 'Create Build Directory'
inputs:
targetType: 'inline'
script: 'mkdir build'
- task: CMake@1
displayName: 'CMake Configure'
inputs:
workingDirectory: build
cmakeArgs: '.. -DCMAKE_BUILD_TYPE=$(BuildConfiguration) $(BuildArguments)'
- task: CMake@1
displayName: 'CMake Build'
inputs:
workingDirectory: build
cmakeArgs: '--build .'
- bash: 'ctest -E ".*TestOfflineProcessing.*" -T test --no-compress-output'
workingDirectory: build
failOnStderr: true
displayName: 'Run Tests'
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(build.sourcesdirectory)'
Contents: '**'
TargetFolder: '$(build.artifactstagingdirectory)'
CleanTargetFolder: true
condition: failed()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'drop'
condition: failed()
- task: PublishTestResults@2
condition: true
inputs:
testResultsFormat: 'CTest'
testRunTitle: 'Linux CTest $(BuildConfiguration) $(BuildArguments)'
testResultsFiles: '**/Test.xml'
- stage: MacOS
dependsOn: [Data]
jobs:
- job: Build_And_Test
timeoutInMinutes: 240
pool:
vmImage: macOS-10.14
strategy:
matrix:
debug x64 multi threads:
BuildConfiguration: Debug
BuildPlatform: x64
BuildArguments: -DNoThreading=OFF
release x64 multi threads:
BuildConfiguration: Release
BuildPlatform: x64
BuildArguments: -DNoThreading=OFF
debug x64 single thread:
BuildConfiguration: Debug
BuildPlatform: x64
BuildArguments: -DNoThreading=ON
release x64 single thread:
BuildConfiguration: Release
BuildPlatform: x64
BuildArguments: -DNoThreading=ON
steps:
- checkout: self
submodules: recursive
lfs: true
- script: |
brew search dmalloc
brew install dmalloc
displayName: 'Install Required Packages'
- task: DownloadBuildArtifacts@0
displayName: 'Download Enterprise Data File'
inputs:
buildType: 'current'
downloadType: 'single'
artifactName: 'enterpriseFile'
downloadPath: '$(System.ArtifactsDirectory)'
- script: |
mv $(System.ArtifactsDirectory)/enterpriseFile/51Degrees-EnterpriseV4.1.hash $(Build.SourcesDirectory)/device-detection-data/51Degrees-EnterpriseV4.1.hash
displayName: 'Move Data File'
- task: Bash@3
displayName: 'Create Build Directory'
inputs:
targetType: 'inline'
script: 'mkdir build'
- task: CMake@1
displayName: 'CMake Configure'
inputs:
workingDirectory: build
cmakeArgs: '.. -DCMAKE_BUILD_TYPE=$(BuildConfiguration) $(BuildArguments)'
- task: CMake@1
displayName: 'CMake Build'
inputs:
workingDirectory: build
cmakeArgs: '--build .'
- bash: 'ctest -E ".*TestOfflineProcessing.*" -T test --no-compress-output'
workingDirectory: build
failOnStderr: true
displayName: 'Run Tests'
- task: PublishTestResults@2
condition: true
inputs:
testResultsFormat: 'CTest'
testRunTitle: 'Linux CTest $(BuildConfiguration) $(BuildArguments)'
testResultsFiles: '**/Test.xml'