Update ADO build scripts/files for net8 test run
diff --git a/.build/azure-templates/run-tests-on-os.yml b/.build/azure-templates/run-tests-on-os.yml
index 146a798..7a3bce7 100644
--- a/.build/azure-templates/run-tests-on-os.yml
+++ b/.build/azure-templates/run-tests-on-os.yml
@@ -5,9 +5,9 @@
# 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
@@ -34,7 +34,7 @@
maximumAllowedFailures: 0
where: '' # A test filter expression, as defined by dotnet test
dotNetSdkVersion: '' # The .NET SDK version to install
-
+
steps:
- checkout: none # self represents the repo where the initial Pipelines YAML file was found
@@ -108,10 +108,18 @@
displayName: 'Use .NET sdk 6.0.403'
inputs:
packageType: 'sdk'
- version: '5.0.403'
+ version: '6.0.403'
performMultiLevelLookup: '${{ variables.PerformMultiLevelLookup }}'
condition: and(succeeded(), contains('${{ parameters.framework }}', 'net6.'))
+- task: UseDotNet@2
+ displayName: 'Use .NET sdk 8.0.202'
+ inputs:
+ packageType: 'sdk'
+ version: '8.0.202'
+ performMultiLevelLookup: '${{ variables.PerformMultiLevelLookup }}'
+ condition: and(succeeded(), contains('${{ parameters.framework }}', 'net8.'))
+
#- template: 'show-all-files.yml' # Uncomment for debugging
- pwsh: |
$framework = '${{ parameters.framework }}'
@@ -126,7 +134,7 @@
$tempDirectory = "$(Agent.TempDirectory)"
$isNightly = if ($env:ISNIGHTLY -eq 'true') { 'true' } else { 'false' }
$isWeekly = if ($env:ISWEEKLY -eq 'true') { 'true' } else { 'false' }
-
+
function IsSupportedFramework([string]$framework) {
if ($IsWindows -eq $null) {
$IsWindows = $env:OS.StartsWith('Win')
@@ -136,15 +144,15 @@
}
return $true
}
-
+
function RunTests([string]$framework, [string]$fileRegexPattern) {
if (!(IsSupportedFramework($framework))) { continue }
-
+
$testBinaries = Get-ChildItem -Path "$testBinaryRootDirectory" -File -Recurse | Where-Object {$_.FullName -match "$framework" -and $_.FullName -match "$fileRegexPattern" -and !$_.Name.EndsWith('.resources.dll') } | Sort-Object -Property FullName
Write-Host $testBinaries
foreach ($testBinary in $testBinaries) {
$testName = [System.IO.Path]::GetFileNameWithoutExtension($testBinary.FullName)
-
+
if ($maximumParalellJobs -gt 1) {
# Pause if we have queued too many parallel jobs
$running = @(Get-Job | Where-Object { $_.State -eq 'Running' })
@@ -155,7 +163,7 @@
$running | Wait-Job -Any | Out-Null
}
}
-
+
$testResultDirectory = "$testResultsArtifactDirectory/$testOSName/$framework/$testPlatform/$testName"
if (!(Test-Path "$testResultDirectory")) {
New-Item "$testResultDirectory" -ItemType Directory -Force
@@ -186,32 +194,32 @@
if (![string]::IsNullOrEmpty($where)) {
$testExpression = "$testExpression --filter ""$where"""
}
-
+
$testExpression = "$testExpression -- RunConfiguration.TargetPlatform=$testPlatform"
-
+
Write-Host "Testing '$($testBinary.FullName)' on framework '$framework' and outputting test results to '$testResultDirectory/$testResultsFileName'..."
Write-Host $testExpression -ForegroundColor Magenta
if ($maximumParalellJobs -le 1) {
Invoke-Expression $testExpression # For running in the foreground
} else {
-
+
$testExpression += " > ""$testResultDirectory/dotnet-test.log"" 2> ""$testResultDirectory/dotnet-test-error.log"""
$scriptBlock = {
param([string]$testExpression)
Invoke-Expression $testExpression
}
-
+
# Avoid dotnet test collisions by delaying for 500ms
Start-Sleep -Milliseconds 500
-
+
# Execute the jobs in parallel
Start-Job -Name "$testName,$framework,$testPlatform" -ScriptBlock $scriptBlock -ArgumentList $testExpression
}
}
}
-
+
RunTests -Framework "$framework" -FileRegexPattern "$testBinaryFilesPattern"
-
+
if ($maximumParalellJobs -gt 1) {
# Wait for it all to complete
do {
@@ -229,7 +237,7 @@
}
} until ($running.Count -eq 0)
}
-
+
$global:LASTEXITCODE = 0 # Force the script to continue on error
displayName: 'dotnet test ${{ parameters.framework }},${{ parameters.vsTestPlatform }}'
ignoreLASTEXITCODE: true
@@ -247,7 +255,7 @@
# it would be a ton of work to make a replacement for the
# Publish Test Results task or the (deprecated) TfsPublisher
# our only other option is to make a task for every supported
-# platform and project and update it whenever a new platform
+# platform and project and update it whenever a new platform
# is targeted or test project is created in Lucene.Net.
- template: 'publish-test-results-for-test-projects.yml'
@@ -270,4 +278,4 @@
}
if ($failed) {
Write-Host "##vso[task.complete result=Failed;]"
- }
\ No newline at end of file
+ }
diff --git a/.build/runbuild.ps1 b/.build/runbuild.ps1
index d8d1c0a..346eec1 100644
--- a/.build/runbuild.ps1
+++ b/.build/runbuild.ps1
@@ -6,9 +6,9 @@
# 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.
@@ -27,7 +27,7 @@
[string]$testResultsDirectory = "$artifactsDirectory/TestResults"
[string]$publishDirectory = "$artifactsDirectory/Publish"
[string]$solutionFile = "$baseDirectory/Lucene.Net.sln"
- [string]$minimumSdkVersion = "7.0.100"
+ [string]$minimumSdkVersion = "8.0.202"
[string]$globalJsonFile = "$baseDirectory/global.json"
[string]$versionPropsFile = "$baseDirectory/version.props"
[string]$luceneReadmeFile = "$baseDirectory/src/Lucene.Net/readme-nuget.md"
@@ -48,7 +48,7 @@
[string]$publishedArtifactZipFileName = "artifact.zip"
[int]$maximumParallelJobs = 8
-
+
#test parameters
#The build uses Lucene.Net.Tests.Analysis.Common to determine all of the targets for the solution:
[string]$projectWithAllTestFrameworks = "$baseDirectory/src/Lucene.Net.Tests.Analysis.Common/Lucene.Net.Tests.Analysis.Common.csproj"
@@ -116,7 +116,7 @@
task Restore -description "This task restores the dependencies" {
Write-Host "##teamcity[progressMessage 'Restoring']"
Write-Host "##vso[task.setprogress]'Restoring'"
- Exec {
+ Exec {
& dotnet restore $solutionFile --no-dependencies /p:TestFrameworks=true
}
}
@@ -195,13 +195,13 @@
try {
$frameworksToTest = Get-FrameworksToTest
-
+
if ($zipPublishedArtifacts) {
$outDirectory = New-TemporaryDirectory
} else {
$outDirectory = $publishDirectory
}
-
+
foreach ($framework in $frameworksToTest) {
# Pause if we have queued too many parallel jobs
@@ -215,7 +215,7 @@
# Do this first so there is no conflict
Ensure-Directory-Exists $outputPath
-
+
Write-Host "Configuration: $configuration"
$expression = "dotnet publish `"$solutionFile`" --configuration `"$configuration`" --framework `"$framework`" --output `"$outputPath`""
@@ -271,7 +271,7 @@
popd
$testProjects = $testProjects | Sort-Object -Property FullName
-
+
$frameworksToTest = Get-FrameworksToTest
[int]$totalProjects = $testProjects.Length * $frameworksToTest.Length
@@ -281,7 +281,7 @@
foreach ($testProject in $testProjects) {
$testName = $testProject.Directory.Name
-
+
# Call the target to get the configured test frameworks for this project. We only read the first line because MSBuild adds extra output.
$frameworksString = $(dotnet build "$testProject" --verbosity minimal --nologo --no-restore /t:PrintTargetFrameworks /p:TestProjectsOnly=true /p:TestFrameworks=true)[0].Trim()
@@ -296,7 +296,7 @@
$frameworks = [System.Collections.Generic.HashSet[string]]::new($frameworksString -split '\s*;\s*')
foreach ($framework in $frameworksToTest) {
-
+
# If the framework is not valid for this configuration, we need to adjust our
# initial estimate and skip the combination.
if (-not $frameworks.Contains($framework)) {
@@ -304,7 +304,7 @@
$remainingProjects--
continue
}
-
+
Write-Host ""
Write-Host " Next Project in Queue: $testName, Framework: $framework" -ForegroundColor Yellow
@@ -336,7 +336,7 @@
# Also log to a file in TRX format, so we have a build artifact both when
# doing release inspection and on the CI server.
$testExpression = "$testExpression --logger:""trx;LogFileName=TestResults.trx"""
-
+
if (![string]::IsNullOrEmpty($where)) {
$testExpression = "$testExpression --TestCaseFilter:""$where"""
}
@@ -580,7 +580,7 @@
$_.FullName
}
popd
-
+
[int]$totalCountForFramework = 0
[int]$executedCountForFramework = 0
[int]$passedCountForFramework = 0
@@ -604,7 +604,7 @@
$reader = [System.Xml.XmlReader]::Create($testReport)
try {
while ($reader.Read()) {
-
+
if ($reader.NodeType -eq [System.Xml.XmlNodeType]::Element -and $reader.Name -eq 'ResultSummary') {
$outcome = $reader.GetAttribute('outcome')
if ($outcomeForFramework -eq 'Completed') {
@@ -751,4 +751,4 @@
function Normalize-FileSystemSlashes([string]$path) {
$sep = [System.IO.Path]::DirectorySeparatorChar
return $($path -replace '/',$sep -replace '\\',$sep)
-}
\ No newline at end of file
+}
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 84de7f7..fff38cd 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -55,7 +55,7 @@
- name: BuildCounter
value: $[counter(variables['VersionSuffix'],coalesce(variables['BuildCounterSeed'], 1250))]
- name: DotNetSDKVersion
- value: '7.0.100'
+ value: '8.0.202'
- name: DocumentationArtifactName
value: 'docs'
- name: DocumentationArtifactZipFileName