You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/07/15 02:30:07 UTC
[lucenenet] 11/14: azure-pipelines.yml: Added build features for
the test framework's system properties
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit fc222302b25ddb48fc21b943fb8e5730fa02a17e
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Tue Jul 14 05:49:47 2020 +0700
azure-pipelines.yml: Added build features for the test framework's system properties
---
Lucene.Net.sln | 1 +
azure-pipelines.yml | 97 ++++++++++++++++++-------
build/azure-templates/publish-test-binaries.yml | 38 ++++++++++
3 files changed, 108 insertions(+), 28 deletions(-)
diff --git a/Lucene.Net.sln b/Lucene.Net.sln
index 389ea17..aa712c3 100644
--- a/Lucene.Net.sln
+++ b/Lucene.Net.sln
@@ -21,6 +21,7 @@ MinimumVisualStudioVersion = 15.0.26730.8
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "azure-templates", "azure-templates", "{05CE3A39-40D4-452D-AFE0-E57E536A08C6}"
ProjectSection(SolutionItems) = preProject
build\azure-templates\publish-nuget-packages.yml = build\azure-templates\publish-nuget-packages.yml
+ build\azure-templates\publish-test-binaries.yml = build\azure-templates\publish-test-binaries.yml
build\azure-templates\publish-test-results-for-test-projects.yml = build\azure-templates\publish-test-results-for-test-projects.yml
build\azure-templates\publish-test-results.yml = build\azure-templates\publish-test-results.yml
build\azure-templates\run-tests-on-os.yml = build\azure-templates\run-tests-on-os.yml
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index af14c19..1e10718 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -18,14 +18,13 @@
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)
-# RunTests: 'true' (Optional - set to 'false' to disable test jobs - useful for debugging. If not provided, tests will be run.)
# Versioning Variables
@@ -34,6 +33,20 @@ name: 'vNext$(rev:.r)' # Format for build number (will be overridden)
# 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.)
+# 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: 'false' (Optional - set to 'true' to run 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)
+
variables:
- name: BuildCounter
value: $[counter(variables['VersionSuffix'],coalesce(variables['BuildCounterSeed'], 1250))]
@@ -63,6 +76,8 @@ variables:
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
@@ -113,13 +128,39 @@ stages:
displayName: 'PSake Build, Pack, and Publish'
- template: 'build/azure-templates/show-all-environment-variables.yml'
- - powershell: |
+ - 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: 'Write Versions to Files'
+
+ # Generate a lucene.testsettings.json file for use with the test framework
+ $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 -eq 'true') { '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""tests"":`n`t{`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 Variables to Files'
+
# If this is a release pipeline, copy the build.bat and Version.props files as version artifacts, which will
# overwrite the build.bat and Version.props files of the release.
- task: CopyFiles@2
@@ -148,30 +189,30 @@ stages:
Contents: |
**\**\bin\**\*.pdb
TargetFolder: '$(Build.ArtifactStagingDirectory)/$(DebugArtifactName)'
-
- - task: PublishPipelineArtifact@1
- displayName: 'Publish Artifact: $(BinaryArtifactName)_netcoreapp3.1'
- inputs:
- targetPath: '$(PublishTempDirectory)\netcoreapp3.1'
- artifact: '$(BinaryArtifactName)_netcoreapp3.1'
- publishLocation: 'pipeline'
- condition: and(succeeded(), ne(variables['RunTests'], 'false'))
-
- - task: PublishPipelineArtifact@1
- displayName: 'Publish Artifact: $(BinaryArtifactName)_netcoreapp2.1'
- inputs:
- targetPath: '$(PublishTempDirectory)\netcoreapp2.1'
- artifact: '$(BinaryArtifactName)_netcoreapp2.1'
- publishLocation: 'pipeline'
- condition: and(succeeded(), ne(variables['RunTests'], 'false'))
-
- - task: PublishPipelineArtifact@1
- displayName: 'Publish Artifact: $(BinaryArtifactName)_net48'
- inputs:
- targetPath: '$(PublishTempDirectory)\net48'
- artifact: '$(BinaryArtifactName)_net48'
- publishLocation: 'pipeline'
- condition: and(succeeded(), ne(variables['RunTests'], 'false'))
+
+ - ${{ if ne(variables['RunTests'], 'false') }}:
+ - template: 'build/azure-templates/publish-test-binaries.yml'
+ parameters:
+ publishDirectory: $(PublishTempDirectory)
+ framework: 'netcoreapp3.1'
+ binaryArtifactName: '$(BinaryArtifactName)'
+ testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
+
+ - ${{ if ne(variables['RunTests'], 'false') }}:
+ - template: 'build/azure-templates/publish-test-binaries.yml'
+ parameters:
+ publishDirectory: $(PublishTempDirectory)
+ framework: 'netcoreapp2.1'
+ binaryArtifactName: '$(BinaryArtifactName)'
+ testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
+
+ - ${{ if ne(variables['RunTests'], 'false') }}:
+ - template: 'build/azure-templates/publish-test-binaries.yml'
+ parameters:
+ publishDirectory: $(PublishTempDirectory)
+ framework: 'net48'
+ binaryArtifactName: '$(BinaryArtifactName)'
+ testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/$(TestSettingsFileName)'
- task: PublishPipelineArtifact@1
displayName: 'Publish Artifact: $(NuGetArtifactName)'
diff --git a/build/azure-templates/publish-test-binaries.yml b/build/azure-templates/publish-test-binaries.yml
new file mode 100644
index 0000000..ae620f8
--- /dev/null
+++ b/build/azure-templates/publish-test-binaries.yml
@@ -0,0 +1,38 @@
+# 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.
+
+# Copies the provided test framework configuration file
+# to the binary publish subdirectory for the provided target
+# framework, and then publishes to an pipeline artifact.
+
+parameters:
+ publishDirectory: '' # The path of the root publish staging directory where the binaries can be found $(PublishTempDirectory)
+ framework: '' # The target framework
+ binaryArtifactName: '' # The prefix of the binary artifact to publish $(BinaryArtifactName)
+ testSettingsFilePath: '$(Build.ArtifactStagingDirectory)/lucene.testsettings.json' #The name of the
+
+steps:
+- pwsh: |
+ Copy-Item -Path "${{ parameters.testSettingsFilePath }}" -Destination "${{ parameters.publishDirectory }}/${{ parameters.framework }}/" -Force
+ displayName: 'Copy lucene.testsettings.json File to: ${{ parameters.publishDirectory }}/${{ parameters.framework }}'
+
+- task: PublishPipelineArtifact@1
+ displayName: 'Publish Artifact: ${{ parameters.binaryArtifactName }}_${{ parameters.framework }}'
+ inputs:
+ targetPath: '${{ parameters.publishDirectory }}/${{ parameters.framework }}'
+ artifact: '${{ parameters.binaryArtifactName }}_${{ parameters.framework }}'
+ publishLocation: 'pipeline'