forked from apache/lucenenet
-
Notifications
You must be signed in to change notification settings - Fork 9
/
azure-pipelines.yml
757 lines (679 loc) · 32.5 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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
name: 'vNext$(rev:.r)' # Format for build number (will be overridden)
# DevOps Setup: Define the following pipeline level variables in Azure DevOps build pipeline
# ArtifactFeedID: (Optional - set to your Azure DevOps Artifact (NuGet) feed. If not provided, publish job will be skipped.)
# BuildConfiguration: (Optional. Defaults to 'Release')
# BuildPlatform: (Optional. Defaults to 'Any CPU')
# GenerateDocs: (Optional. Only builds documentation website if set to 'true'.)
# GenerateWebsite: (Optional. Only builds lucene.net website if set to 'true'.)
# IsRelease: (Optional. By default the Release job is disabled, setting this to 'true' will enable it)
# GeneratePackages: (Optional. Defaults to 'true'. Setting to 'false' will cut about 1 minute from the build time by skipping packing the NuGet files and subsequent artiact upload. If ArtifactFeedID is provided or IsRelease is 'true', this setting has no effect.)
# Versioning Variables
# BuildCounterSeed: (Optional - Set in conjunction with VersionSuffix, will cause the build counter to begin at this value. Note that it is set once, to reset is an API call.)
# PackageVersion: (Optional - This can be used to explicitly set the whole version number to a specific version, i.e. 4.8.0-beta00005. It overrides all other version settings.)
# PreReleaseCounterPattern: (Optional. Set to '0000000000' in ci pipeline or '00000' in release pipeline. The default is '0000000000'. This setting has no effect if VersionSuffix is ''.)
# VersionSuffix: (Optional. Defaults to 'ci'. Set to 'beta' or 'rc' or '' in production pipeline.)
# Testing variables
# RunTests: 'true' (Optional - set to 'false' to disable test jobs - useful for debugging. If not provided, tests will be run.)
# AssertsEnabled: 'true' (Optional - set to 'false' to run tests without asserts, which is less thorough. This can speed up testing and verify the application will run without asserts.)
# IsNightly: 'false' (Optional - set to 'true' to run additional tests for the nightly build)
# IsWeekly: 'false' (Optional - set to 'true' to run additional tests for the weekly build)
# RunSlowTests: 'true' (Optional - set to 'false' to skip slow tests to make testing time shorter)
# RunAwaitsFixTests: 'true' (Optional - set to 'false' to disable running flakey tests)
# Codec: 'random' (Optional - set to a specific codec to test the same codec throughout all tests)
# DocValuesFormat: 'random' (Optional - set to a specific doc values format to test the same codec throughout all tests)
# PostingsFormat: 'random' (Optional - set to a specific postings format to test the same codec throughout all tests)
# Directory: 'random' (Optional - set to a specific directory implementation to test the same codec throughout all tests)
# Verbose: 'false' (Optional - set to true for verbose logging output)
# Multiplier: '1' (Optional - the number of iterations to multiply applicable tests by)
# RunX86Tests: 'false' (Optional - set to 'true' to enable x86 tests)
variables:
- name: BuildCounter
value: $[counter(variables['VersionSuffix'],coalesce(variables['BuildCounterSeed'], 1250))]
- name: DotNetSDKVersion
value: '8.0.204'
- name: DocumentationArtifactName
value: 'docs'
- name: DocumentationArtifactZipFileName
value: 'documentation.zip'
- name: WebsiteArtifactName
value: 'website'
- name: WebsiteArtifactZipFileName
value: 'website.zip'
- name: BinaryArtifactName
value: 'testbinaries'
- name: NuGetArtifactName
value: 'nuget'
- name: DebugArtifactName # For .pdb symbols
value: 'debug'
- name: ReleaseArtifactName
value: 'release'
- name: TestResultsArtifactName
value: 'testresults'
- name: VersionArtifactName
value: 'version'
- name: BuildNumberFileName
value: 'buildNumber.txt'
- name: PackageVersionFileName
value: 'packageVersion.txt'
- name: FileVersionFileName
value: 'fileVersion.txt'
- name: TestSettingsFileName
value: 'lucene.testsettings.json'
- name: BuildDirectory # Where the build scripts and configs are
value: '$(System.DefaultWorkingDirectory)/.build'
- name: PublishDirectory # Test binaries directory
value: '$(Build.ArtifactStagingDirectory)/$(BinaryArtifactName)'
- name: NuGetArtifactDirectory # NuGet binaries directory
value: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
stages:
- stage: Build_Stage
displayName: 'Build Stage:'
jobs:
- job: Build
pool:
vmImage: 'windows-2019'
steps:
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
fetchDepth: '1' # the depth of commits to ask Git to fetch
- pwsh: |
$configuration = if ($env:BUILDCONFIGURATION) { $env:BUILDCONFIGURATION } else { "Release" }
Write-Host "##vso[task.setvariable variable=BuildConfiguration;]$configuration"
$platform = if ($env:BUILDPLATFORM) { $env:BUILDPLATFORM } else { "Any CPU" }
Write-Host "##vso[task.setvariable variable=BuildPlatform;]$platform"
$isRelease = if ($env:ISRELEASE -eq 'true') { 'true' } else { 'false' }
Write-Host "##vso[task.setvariable variable=IsRelease;]$isRelease"
$isNightly = if ($env:ISNIGHTLY -eq 'true') { 'true' } else { 'false' }
Write-Host "##vso[task.setvariable variable=IsNightly;]$isNightly"
$isWeekly = if ($env:ISWEEKLY -eq 'true') { 'true' } else { 'false' }
Write-Host "##vso[task.setvariable variable=IsWeekly;]$isWeekly"
$runPack = if ($env:ISRELEASE -eq 'true' -or $env:ARTIFACTFEEDID -ne '' -or $env:GENERATEPACKAGES -ne 'false') { 'true' } else { 'false' }
Write-Host "##vso[task.setvariable variable=RunPack;]$runPack"
displayName: 'Setup Default Variable Values'
- template: '.build/azure-templates/install-dotnet-sdk.yml'
parameters:
sdkVersion: '$(DotNetSDKVersion)'
- pwsh: |
Import-Module "$(BuildDirectory)/psake/psake.psm1"
$primaryCommand = if ($env:RUNPACK -ne 'false') { 'Pack' } else { 'Compile' }
$parameters = @{}
$properties = @{
backupFiles='false';
nugetPackageDirectory='$(NuGetArtifactDirectory)'
}
[string[]]$tasks = @($primaryCommand)
Invoke-Psake $(BuildDirectory)/runbuild.ps1 -Task $tasks -properties $properties -parameters $parameters
exit !($psake.build_success)
displayName: 'PSake Build and Pack'
#- template: '.build/azure-templates/show-all-environment-variables.yml' # Uncomment for debugging
- pwsh: |
$dir = '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)'
if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path "$dir" -Force }
'$(PackageVersion)' | Out-File -FilePath "$dir/$(PackageVersionFileName)" -Force
'$(FileVersion)' | Out-File -FilePath "$dir/$(FileVersionFileName)" -Force
'$(Build.BuildNumber)' | Out-File -FilePath "$dir/$(BuildNumberFileName)" -Force
displayName: 'Persist Versions to Files'
- pwsh: |
# Generate a lucene.testsettings.json file for use with the test framework
$assert = if ($env:AssertsEnabled -ne 'false') { 'true' } else { 'false' }
$nightly = if ($env:IsNightly -eq 'true') { 'true' } else { 'false' }
$weekly = if ($env:IsWeekly -eq 'true') { 'true' } else { 'false' }
$slow = if ($env:RunSlowTests -ne 'false') { 'true' } else { 'false' }
$awaitsFix = if ($env:RunAwaitsFixTests -ne 'false') { 'true' } else { 'false' }
$codec = if ($env:Codec -eq $null) { 'random' } else { $env:Codec }
$docValuesFormat = if ($env:DocValuesFormat -eq $null) { 'random' } else { $env:DocValuesFormat }
$postingsFormat = if ($env:PostingsFormat -eq $null) { 'random' } else { $env:PostingsFormat }
$directory = if ($env:Directory -eq $null) { 'random' } else { $env:Directory }
$verbose = if ($env:Verbose -eq 'true') { 'true' } else { 'false' }
$multiplier = if ($env:Multiplier -eq $null) { '1' } else { $env:Multiplier }
$fileText = "{`n`t" +
"""assert"": ""$assert"",`n`t" +
"""tests"": {`n`t`t" +
"""nightly"": ""$nightly"",`n`t`t" +
"""weekly"": ""$weekly"",`n`t`t" +
"""slow"": ""$slow"",`n`t`t" +
"""awaitsfix"": ""$awaitsFix"",`n`t`t" +
"""codec"": ""$codec"",`n`t`t" +
"""docvaluesformat"": ""$docValuesFormat"",`n`t`t" +
"""postingsformat"": ""$postingsFormat"",`n`t`t" +
"""directory"": ""$directory"",`n`t`t" +
"""verbose"": ""$verbose"",`n`t`t" +
"""multiplier"": ""$multiplier""`n`t" +
"}`n" +
"}"
Out-File -filePath "$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)" -encoding UTF8 -inputObject $fileText
displayName: 'Persist Test Settings to lucene.testsettings.json'
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
# If this is a release pipeline, copy the version.props files as a version artifact, which will
# be included in the release.
- task: CopyFiles@2
displayName: 'Copy version.props Files to: /$(VersionArtifactName)'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
Contents: |
version.props
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)'
condition: and(succeeded(), eq(variables['IsRelease'], 'true'))
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(VersionArtifactName)'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)'
artifact: '$(VersionArtifactName)'
publishLocation: 'pipeline'
# Copy the .pdb files as build artifacts, which will
# later be used to push to the Azure Artifacts symbol server.
- task: CopyFiles@2
displayName: 'Copy .pdb Files to: /$(DebugArtifactName)'
inputs:
SourceFolder: '$(System.DefaultWorkingDirectory)'
Contents: '**/bin/$(BuildConfiguration)/**/*.pdb'
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(DebugArtifactName)'
condition: and(succeeded(), ne(variables['ArtifactFeedID'], ''))
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(DebugArtifactName)'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/$(DebugArtifactName)'
artifact: '$(DebugArtifactName)'
publishLocation: 'pipeline'
condition: and(succeeded(), ne(variables['ArtifactFeedID'], ''))
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(NuGetArtifactName)'
inputs:
targetPath: '$(NuGetArtifactDirectory)'
artifact: '$(NuGetArtifactName)'
publishLocation: 'pipeline'
condition: and(succeeded(), ne(variables['RunPack'], 'false'))
- pwsh: |
Remove-Item -Path "$(NuGetArtifactDirectory)/*" -Recurse -Force
displayName: 'Delete temp publish location: $(NuGetArtifactDirectory)'
condition: and(succeeded(), ne(variables['RunPack'], 'false'))
- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishDirectory)
framework: 'net8.0'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'
- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishDirectory)
framework: 'net6.0'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'
- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishDirectory)
framework: 'net5.0'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'
- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishDirectory)
framework: 'net472'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'
- template: '.build/azure-templates/publish-test-binaries.yml'
parameters:
publishDirectory: $(PublishDirectory)
framework: 'net48'
binaryArtifactName: '$(BinaryArtifactName)'
testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
configration: '$(BuildConfiguration)'
platform: '$(BuildPlatform)'
- job: Docs
condition: and(succeeded(), eq(variables['GenerateDocs'], 'true'))
pool:
vmImage: 'windows-latest'
steps:
- template: '.build/azure-templates/install-dotnet-sdk.yml'
parameters:
sdkVersion: '$(DotNetSDKVersion)'
- pwsh: |
$(Build.SourcesDirectory)/websites/apidocs/docs.ps1 -LuceneNetVersion $(PackageVersion) -Clean -BaseUrl https://lucenenet.apache.org/docs/
errorActionPreference: 'continue'
ignoreLASTEXITCODE: 'true'
failOnStderr: 'false'
displayName: 'Generate Documentation'
- task: ArchiveFiles@2
displayName: 'Zip Documenation Files'
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/websites/apidocs/_site'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/$(DocumentationArtifactName)/$(DocumentationArtifactZipFileName)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: $(DocumentationArtifactName)'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(DocumentationArtifactName)'
ArtifactName: '$(DocumentationArtifactName)'
- job: Website
condition: and(succeeded(), eq(variables['GenerateWebsite'], 'true'))
pool:
vmImage: 'windows-latest'
steps:
- pwsh: |
$(Build.SourcesDirectory)/websites/site/site.ps1 0 1
errorActionPreference: 'continue'
ignoreLASTEXITCODE: 'true'
failOnStderr: 'false'
displayName: 'Generate Website'
- task: ArchiveFiles@2
displayName: 'Zip Website Files'
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)/websites/site/_site'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/$(WebsiteArtifactName)/$(WebsiteArtifactZipFileName)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: $(WebsiteArtifactName)'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)/$(WebsiteArtifactName)'
ArtifactName: '$(WebsiteArtifactName)'
- stage: Test_Stage
displayName: 'Test Stage:'
jobs:
- job: Test_net8_0_x64
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-latest'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
Linux:
osName: 'Linux'
imageName: 'ubuntu-latest'
maximumParallelJobs: 7
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
macOS:
osName: 'macOS'
imageName: 'macOS-latest'
maximumParallelJobs: 7
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
displayName: 'Test net8.0,x64 on'
pool:
vmImage: $(imageName)
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'net8.0'
vsTestPlatform: 'x64'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net8_0_x86 # Only run Nightly or if explicitly enabled with RunX86Tests
condition: and(succeeded(), ne(variables['RunTests'], 'false'), or(eq(variables['IsNightly'], 'true'), eq(variables['RunX86Tests'], 'true')))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
displayName: 'Test net8.0,x86 on'
pool:
vmImage: $(imageName)
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'net8.0'
vsTestPlatform: 'x86'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net6_0_x64
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
Linux:
osName: 'Linux'
imageName: 'ubuntu-latest'
maximumParallelJobs: 7
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
macOS:
osName: 'macOS'
imageName: 'macOS-latest'
maximumParallelJobs: 7
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
displayName: 'Test net6.0,x64 on'
pool:
vmImage: $(imageName)
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'net6.0'
vsTestPlatform: 'x64'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net6_0_x86 # Only run Nightly or if explicitly enabled with RunX86Tests
condition: and(succeeded(), ne(variables['RunTests'], 'false'), or(eq(variables['IsNightly'], 'true'), eq(variables['RunX86Tests'], 'true')))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
displayName: 'Test net6.0,x86 on'
pool:
vmImage: $(imageName)
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'net6.0'
vsTestPlatform: 'x86'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net5_0_x64
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
Linux:
osName: 'Linux'
imageName: 'ubuntu-22.04' # NOTE: ubuntu-24.04 currently breaks the .NET 5 build
maximumParallelJobs: 7
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
macOS:
osName: 'macOS'
imageName: 'macOS-latest'
maximumParallelJobs: 7
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
displayName: 'Test net5.0,x64 on'
pool:
vmImage: $(imageName)
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'net5.0'
vsTestPlatform: 'x64'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net5_0_x86 # Only run Nightly or if explicitly enabled with RunX86Tests
condition: and(succeeded(), ne(variables['RunTests'], 'false'), or(eq(variables['IsNightly'], 'true'), eq(variables['RunX86Tests'], 'true')))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
displayName: 'Test net5.0,x86 on'
pool:
vmImage: $(imageName)
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'net5.0'
vsTestPlatform: 'x86'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net472_x64
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
displayName: 'Test net472,x64 on'
pool:
vmImage: $(imageName)
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'net472'
vsTestPlatform: 'x64'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net472_x86 # Only run Nightly or if explicitly enabled with RunX86Tests
condition: and(succeeded(), ne(variables['RunTests'], 'false'), or(eq(variables['IsNightly'], 'true'), eq(variables['RunX86Tests'], 'true')))
strategy:
matrix:
Windows:
osName: 'Windows'
imageName: 'windows-2019'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
displayName: 'Test net472,x86 on'
pool:
vmImage: $(imageName)
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: $(osName)
framework: 'net472'
vsTestPlatform: 'x86'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: $(maximumParallelJobs)
maximumAllowedFailures: $(maximumAllowedFailures)
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net48_Windows_x64
condition: and(succeeded(), ne(variables['RunTests'], 'false'))
displayName: 'Test net48,x64 on Windows'
pool:
vmImage: 'windows-2019'
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: 'Windows'
framework: 'net48'
vsTestPlatform: 'x64'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
dotNetSdkVersion: '$(DotNetSDKVersion)'
- job: Test_net48_Windows_x86 # Only run Nightly or if explicitly enabled with RunX86Tests
condition: and(succeeded(), ne(variables['RunTests'], 'false'), or(eq(variables['IsNightly'], 'true'), eq(variables['RunX86Tests'], 'true')))
displayName: 'Test net48,x86 on Windows'
pool:
vmImage: 'windows-2019'
steps:
- template: '.build/azure-templates/run-tests-on-os.yml'
parameters:
osName: 'Windows'
framework: 'net48'
vsTestPlatform: 'x86'
testBinariesArtifactName: '$(TestBinariesArtifactName)'
nugetArtifactName: '$(NuGetArtifactName)'
testResultsArtifactName: '$(TestResultsArtifactName)'
maximumParallelJobs: 8
maximumAllowedFailures: 0 # Maximum allowed failures for a successful build
dotNetSdkVersion: '$(DotNetSDKVersion)'
- stage: Publish_Stage
displayName: 'Publish Stage:'
jobs:
# Optional job to push to Azure Artifact feed. Just pass in
# the GUID of the artifact feed as ArtifactFeedID to enable.
- job: Publish_Azure_Artifacts
condition: and(succeeded(), ne(variables['ArtifactFeedID'], ''))
pool:
vmImage: 'windows-2019'
steps:
# We checkout here because we need to publish the source code along with the symbols for debugging
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
fetchDepth: '1' # the depth of commits to ask Git to fetch
- template: '.build/azure-templates/show-all-environment-variables.yml'
- task: DownloadPipelineArtifact@0
displayName: 'Download Build Artifacts: $(VersionArtifactName)'
inputs:
artifactName: '$(VersionArtifactName)'
targetPath: '$(System.DefaultWorkingDirectory)/$(VersionArtifactName)'
# For debugging this pipeline
#- pwsh: |
# Get-ChildItem -Path $(System.DefaultWorkingDirectory)
# Get-ChildItem -Path '$(VersionArtifactName)'
# NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
# the version cannot be passed to the Index Sources & Publish Symbols task.
- pwsh: |
$version = Get-Content '$(VersionArtifactName)/$(PackageVersionFileName)' -Raw
Write-Host "##vso[task.setvariable variable=PackageVersion;]$version"
Write-Host "##vso[build.updatebuildnumber]$version"
displayName: 'Read PackageVersion from File to Build.BuildNumber'
- template: '.build/azure-templates/show-all-environment-variables.yml'
- template: '.build/azure-templates/publish-nuget-packages.yml'
parameters:
artifactFeedID: '$(ArtifactFeedID)'
nugetArtifactName: '$(NuGetArtifactName)'
debugArtifactName: '$(DebugArtifactName)'
- stage: Release_Stage
displayName: 'Release Stage:'
jobs:
- job: Release
condition: and(succeeded(), eq(variables['IsRelease'], 'true'))
displayName: 'Build Release Artifacts for [VOTE]'
pool:
vmImage: 'windows-2019'
steps:
# We checkout here because we need to publish the source code along with the binaries per Apache's releae policy
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
fetchDepth: '1' # the depth of commits to ask Git to fetch
- template: '.build/azure-templates/show-all-environment-variables.yml'
- task: 'DownloadPipelineArtifact@0'
displayName: 'Download Build Artifacts: $(NuGetArtifactName)'
inputs:
artifactName: '$(NuGetArtifactName)'
targetPath: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
- task: DownloadPipelineArtifact@0
displayName: 'Download Build Artifacts: $(VersionArtifactName)'
inputs:
artifactName: '$(VersionArtifactName)'
targetPath: '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)'
- template: '.build/azure-templates/show-all-files.yml' # Uncomment for debugging
# NOTE: We are setting Build.BuildNumber here to the NuGet package version to work around the limitation that
# the version cannot be passed to the Index Sources & Publish Symbols task.
- pwsh: |
$version = Get-Content '$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)/$(PackageVersionFileName)' -Raw
$vcsLabel = 'Lucene.Net_' + $version.Replace('.', '_').Replace('-', '_')
Write-Host "##vso[task.setvariable variable=VCSLabel;]$vcsLabel"
Write-Host "##vso[task.setvariable variable=PackageVersion;]$version"
Write-Host "##vso[build.updatebuildnumber]$version"
displayName: 'Build VCS Label and Rehydrate Version Variables'
- pwsh: |
[string[]]$files = @('version.props')
foreach ($file in $files) {
Copy-Item -Path "$(Build.ArtifactStagingDirectory)/$(VersionArtifactName)/$file" -Destination "$(Build.SourcesDirectory)/$file" -Force -ErrorAction Continue
}
displayName: 'Update version.props to build only version $(PackageVersion)'
- template: '.build/azure-templates/show-all-environment-variables.yml'
- task: CopyFiles@2
displayName: 'Copy Source Code Files to: $(Build.ArtifactStagingDirectory)/srctemp'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
**
!.git/**/*
!.github/**/*
!branding/**/*
!_artifacts/**/*
!src/**/bin/**/*
!src/**/obj/**/*
!websites/**/*
branding/logo/lucene-net-icon-128x128.png
TargetFolder: '$(Build.ArtifactStagingDirectory)/srctemp'
- task: ArchiveFiles@2
displayName: 'Archive Source Code Files'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/srctemp'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)/Apache-Lucene.Net-$(PackageVersion).src.zip'
- task: CopyFiles@2
displayName: 'Copy License/Notice Files to: $(NuGetArtifactName)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: |
LICENSE.txt
NOTICE.txt
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
- task: ArchiveFiles@2
displayName: 'Archive Binary Files'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/$(NuGetArtifactName)'
includeRootFolder: false
archiveFile: '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)/Apache-Lucene.Net-$(PackageVersion).bin.zip'
- pwsh: |
$dir = '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)'
if (!(Test-Path $dir)) { New-Item -ItemType Directory -Path "$dir" -Force }
$nl = [Environment]::NewLine
"TODO: Review: http://www.apache.org/legal/release-policy.html" + $nl + `
"TODO: Tag Repository" + $nl + `
" commit: $(Build.SourceVersion)" + $nl + `
" tag: $(VCSLabel)" + $nl + `
"TODO: Sign release artifacts (see https://www.apache.org/dev/release-signing.html)" + $nl + `
"TODO: Push release artifacts to dev (https://dist.apache.org/repos/dist/dev/lucenenet/)" + $nl + `
"TODO: Start release [VOTE] (see https://www.apache.org/foundation/voting.html)" + $nl | Out-File -FilePath "$dir/RELEASE-TODO.txt" -Force
displayName: 'Write RELEASE-TODO.txt'
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(ReleaseArtifactName)'
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)/$(ReleaseArtifactName)'
artifact: '$(ReleaseArtifactName)'
publishLocation: 'pipeline'