Skip to content

Commit

Permalink
Merge branch '22_10_31_remove_net31_Tests'
Browse files Browse the repository at this point in the history
  • Loading branch information
NightOwl888 committed Nov 1, 2022
2 parents a2b4c31 + 0ea2fa4 commit 381a90d
Show file tree
Hide file tree
Showing 43 changed files with 583 additions and 377 deletions.
1 change: 1 addition & 0 deletions .build/runbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ properties {
[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"
[string]$where = ""
}
Expand Down
70 changes: 48 additions & 22 deletions .github/workflows/Generate-TestWorkflows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,13 @@
.PARAMETER Configurations
A string array of build configurations to run the tests on. The default is @('Release').
.PARAMETER DotNet6SDKVersion
The SDK version of .NET 6.x to install on the build agent to be used for building and
testing. This SDK is always installed on the build agent. The default is 6.0.100.
.PARAMETER DotNet5SDKVersion
The SDK version of .NET 5.x to install on the build agent to be used for building and
testing. This SDK is always installed on the build agent. The default is 5.0.400.
.PARAMETER DotNetCore3SDKVersion
The SDK version of .NET Core 3.x to install on the build agent to be used for building and
testing. This SDK is only installed on the build agent when targeting .NET Core 3.x.
The default is 3.1.412.
#>
param(
[string]$OutputDirectory = $PSScriptRoot,
Expand All @@ -75,9 +74,7 @@ param(

[string]$DotNet6SDKVersion = '6.0.100',

[string]$DotNet5SDKVersion = '5.0.400',

[string]$DotNetCore3SDKVersion = '3.1.412'
[string]$DotNet5SDKVersion = '5.0.400'
)


Expand Down Expand Up @@ -158,8 +155,7 @@ function Write-TestWorkflow(
[string[]]$TestPlatforms = @('x64'),
[string[]]$OperatingSystems = @('windows-latest', 'ubuntu-latest', 'macos-latest'),
[string]$DotNet6SDKVersion = $DotNet6SDKVersion,
[string]$DotNet5SDKVersion = $DotNet5SDKVersion,
[string]$DotNetCore3SDKVersion = $DotNetCore3SDKVersion) {
[string]$DotNet5SDKVersion = $DotNet5SDKVersion) {

$dependencies = New-Object System.Collections.Generic.HashSet[string]
Get-ProjectDependencies $ProjectPath $RelativeRoot $dependencies
Expand All @@ -173,6 +169,9 @@ function Write-TestWorkflow(
$projectRelativeDirectory = ([System.IO.Path]::GetDirectoryName($projectRelativePath) -replace '\\', '/').TrimStart('./')
$projectName = [System.IO.Path]::GetFileNameWithoutExtension($ProjectPath)

[bool]$isCLI = if ($projectName -eq "Lucene.Net.Tests.Cli") { $true } else { $false } # Special case
$luceneCliProjectPath = $projectRelativePath -replace "Lucene.Net.Tests.Cli", "lucene-cli" # Special case

[string]$frameworks = '[' + $($TestFrameworks -join ', ') + ']'
[string]$platforms = '[' + $($TestPlatforms -join ', ') + ']'
[string]$oses = '[' + $($OperatingSystems -join ', ') + ']'
Expand All @@ -194,6 +193,8 @@ function Write-TestWorkflow(
$directoryBuildPaths += " - '$path'" + [System.Environment]::NewLine
}



$fileText = "####################################################################################
# DO NOT EDIT: This file was automatically generated by Generate-TestWorkflows.ps1
####################################################################################
Expand Down Expand Up @@ -249,18 +250,30 @@ jobs:
- os: macos-latest
framework: net461
env:
project_path: '$projectRelativePath'
project_path: '$projectRelativePath'"

if ($isCLI) {
$fileText += "
project_under_test_path: '$luceneCliProjectPath'
run_slow_tests: 'true'"
} else {
$fileText += "
run_slow_tests: 'false'"
}

$fileText += "
trx_file_name: 'TestResults.trx'
md_file_name: 'TestResults.md' # Report file name for LiquidTestReports.Markdown
steps:
- uses: actions/checkout@v2
- name: Checkout Source Code
uses: actions/checkout@v2
- name: Setup .NET 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '$DotNetCore3SDKVersion'
if: `${{ startswith(matrix.framework, 'netcoreapp3.') }}
- name: Disable .NET SDK Telemetry and Logo
run: |
echo `"DOTNET_NOLOGO=1`" | Out-File -FilePath `$env:GITHUB_ENV -Encoding utf8 -Append
echo `"DOTNET_CLI_TELEMETRY_OPTOUT=1`" | Out-File -FilePath `$env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Setup .NET 5 SDK
uses: actions/setup-dotnet@v1
Expand All @@ -273,18 +286,31 @@ jobs:
with:
dotnet-version: '$DotNet6SDKVersion'
- run: |
- name: Setup Environment Variables
run: |
`$project_name = [System.IO.Path]::GetFileNameWithoutExtension(`$env:project_path)
`$test_results_artifact_name = `"testresults_`${{matrix.os}}_`${{matrix.framework}}_`${{matrix.platform}}_`${{matrix.configuration}}`"
`$working_directory = `"`$env:GITHUB_WORKSPACE`"
Write-Host `"Project Name: `$project_name`"
Write-Host `"Results Artifact Name: `$test_results_artifact_name`"
Write-Host `"Working Directory: `$working_directory`"
echo `"project_name=`$project_name`" | Out-File -FilePath `$env:GITHUB_ENV -Encoding utf8 -Append
echo `"test_results_artifact_name=`$test_results_artifact_name`" | Out-File -FilePath `$env:GITHUB_ENV -Encoding utf8 -Append
# Set the Azure DevOps default working directory env variable, so our tests only need to deal with a single env variable
echo `"SYSTEM_DEFAULTWORKINGDIRECTORY=`$working_directory`" | Out-File -FilePath `$env:GITHUB_ENV -Encoding utf8 -Append
# Title for LiquidTestReports.Markdown
echo `"title=Test Run for `$project_name - `${{matrix.framework}} - `${{matrix.platform}} - `${{matrix.os}}`" | Out-File -FilePath `$env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
shell: pwsh"

if ($isCLI) {
# Special case: Generate lucene-cli.nupkg for installation test so the test runner doesn't have to do it
$fileText += "
- run: dotnet pack `${{env.project_under_test_path}} --configuration `${{matrix.configuration}} /p:TestFrameworks=true /p:PortableDebugTypeOnly=true"
}

$fileText += "
- run: dotnet build `${{env.project_path}} --configuration `${{matrix.configuration}} --framework `${{matrix.framework}} /p:TestFrameworks=true
- run: dotnet test `${{env.project_path}} --configuration `${{matrix.configuration}} --framework `${{matrix.framework}} --no-build --no-restore --blame-hang --blame-hang-dump-type mini --blame-hang-timeout 20minutes --logger:`"console;verbosity=normal`" --logger:`"trx;LogFileName=`${{env.trx_file_name}}`" --logger:`"liquid.md;LogFileName=`${{env.md_file_name}};Title=`${{env.title}};`" --results-directory:`"`${{github.workspace}}/`${{env.test_results_artifact_name}}/`${{env.project_name}}`" -- RunConfiguration.TargetPlatform=`${{matrix.platform}} TestRunParameters.Parameter\(name=\`"tests:slow\`",\ value=\`"false\`"\)
- run: dotnet test `${{env.project_path}} --configuration `${{matrix.configuration}} --framework `${{matrix.framework}} --no-build --no-restore --blame-hang --blame-hang-dump-type mini --blame-hang-timeout 20minutes --logger:`"console;verbosity=normal`" --logger:`"trx;LogFileName=`${{env.trx_file_name}}`" --logger:`"liquid.md;LogFileName=`${{env.md_file_name}};Title=`${{env.title}};`" --results-directory:`"`${{github.workspace}}/`${{env.test_results_artifact_name}}/`${{env.project_name}}`" -- RunConfiguration.TargetPlatform=`${{matrix.platform}} TestRunParameters.Parameter\(name=\`"tests:slow\`",\ value=\`"\`${{env.run_slow_tests}}\`"\)
shell: bash
# upload reports as build artifacts
- name: Upload a Build Artifact
Expand Down Expand Up @@ -317,7 +343,7 @@ try {
Pop-Location
}

#Write-TestWorkflow -OutputDirectory $OutputDirectory -ProjectPath $projectPath -RelativeRoot $repoRoot -TestFrameworks @('net5.0','netcoreapp3.1') -OperatingSystems $OperatingSystems -TestPlatforms $TestPlatforms -Configurations $Configurations -DotNet6SDKVersion $DotNet6SDKVersion -DotNet5SDKVersion $DotNet5SDKVersion -DotNetCore3SDKVersion $DotNetCore3SDKVersion
#Write-TestWorkflow -OutputDirectory $OutputDirectory -ProjectPath $projectPath -RelativeRoot $repoRoot -TestFrameworks @('net5.0') -OperatingSystems $OperatingSystems -TestPlatforms $TestPlatforms -Configurations $Configurations -DotNet6SDKVersion $DotNet6SDKVersion -DotNet5SDKVersion $DotNet5SDKVersion

#Write-Host $TestProjects

Expand All @@ -344,5 +370,5 @@ foreach ($testProject in $TestProjects) {
Write-Host "Frameworks To Test for ${projectName}: $($frameworks -join ';')" -ForegroundColor Cyan

#Write-Host "Project: $projectName"
Write-TestWorkflow -OutputDirectory $OutputDirectory -ProjectPath $testProject -RelativeRoot $RepoRoot -TestFrameworks $frameworks -OperatingSystems $OperatingSystems -TestPlatforms $TestPlatforms -Configurations $Configurations -DotNet6SDKVersion $DotNet6SDKVersion -DotNet5SDKVersion $DotNet5SDKVersion -DotNetCore3SDKVersion $DotNetCore3SDKVersion
Write-TestWorkflow -OutputDirectory $OutputDirectory -ProjectPath $testProject -RelativeRoot $RepoRoot -TestFrameworks $frameworks -OperatingSystems $OperatingSystems -TestPlatforms $TestPlatforms -Configurations $Configurations -DotNet6SDKVersion $DotNet6SDKVersion -DotNet5SDKVersion $DotNet5SDKVersion
}
23 changes: 15 additions & 8 deletions .github/workflows/Lucene-Net-Tests-AllProjects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,17 +86,19 @@ jobs:
framework: net461
env:
project_path: './src/Lucene.Net.Tests.AllProjects/Lucene.Net.Tests.AllProjects.csproj'
run_slow_tests: 'false'
trx_file_name: 'TestResults.trx'
md_file_name: 'TestResults.md' # Report file name for LiquidTestReports.Markdown

steps:
- uses: actions/checkout@v2
- name: Checkout Source Code
uses: actions/checkout@v2

- name: Setup .NET 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.412'
if: ${{ startswith(matrix.framework, 'netcoreapp3.') }}
- name: Disable .NET SDK Telemetry and Logo
run: |
echo "DOTNET_NOLOGO=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh

- name: Setup .NET 5 SDK
uses: actions/setup-dotnet@v1
Expand All @@ -109,18 +111,23 @@ jobs:
with:
dotnet-version: '6.0.100'

- run: |
- name: Setup Environment Variables
run: |
$project_name = [System.IO.Path]::GetFileNameWithoutExtension($env:project_path)
$test_results_artifact_name = "testresults_${{matrix.os}}_${{matrix.framework}}_${{matrix.platform}}_${{matrix.configuration}}"
$working_directory = "$env:GITHUB_WORKSPACE"
Write-Host "Project Name: $project_name"
Write-Host "Results Artifact Name: $test_results_artifact_name"
Write-Host "Working Directory: $working_directory"
echo "project_name=$project_name" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "test_results_artifact_name=$test_results_artifact_name" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Set the Azure DevOps default working directory env variable, so our tests only need to deal with a single env variable
echo "SYSTEM_DEFAULTWORKINGDIRECTORY=$working_directory" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Title for LiquidTestReports.Markdown
echo "title=Test Run for $project_name - ${{matrix.framework}} - ${{matrix.platform}} - ${{matrix.os}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- run: dotnet build ${{env.project_path}} --configuration ${{matrix.configuration}} --framework ${{matrix.framework}} /p:TestFrameworks=true
- run: dotnet test ${{env.project_path}} --configuration ${{matrix.configuration}} --framework ${{matrix.framework}} --no-build --no-restore --blame-hang --blame-hang-dump-type mini --blame-hang-timeout 20minutes --logger:"console;verbosity=normal" --logger:"trx;LogFileName=${{env.trx_file_name}}" --logger:"liquid.md;LogFileName=${{env.md_file_name}};Title=${{env.title}};" --results-directory:"${{github.workspace}}/${{env.test_results_artifact_name}}/${{env.project_name}}" -- RunConfiguration.TargetPlatform=${{matrix.platform}} TestRunParameters.Parameter\(name=\"tests:slow\",\ value=\"false\"\)
- run: dotnet test ${{env.project_path}} --configuration ${{matrix.configuration}} --framework ${{matrix.framework}} --no-build --no-restore --blame-hang --blame-hang-dump-type mini --blame-hang-timeout 20minutes --logger:"console;verbosity=normal" --logger:"trx;LogFileName=${{env.trx_file_name}}" --logger:"liquid.md;LogFileName=${{env.md_file_name}};Title=${{env.title}};" --results-directory:"${{github.workspace}}/${{env.test_results_artifact_name}}/${{env.project_name}}" -- RunConfiguration.TargetPlatform=${{matrix.platform}} TestRunParameters.Parameter\(name=\"tests:slow\",\ value=\"\${{env.run_slow_tests}}\"\)
shell: bash
# upload reports as build artifacts
- name: Upload a Build Artifact
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/Lucene-Net-Tests-Analysis-Common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,19 @@ jobs:
framework: net461
env:
project_path: './src/Lucene.Net.Tests.Analysis.Common/Lucene.Net.Tests.Analysis.Common.csproj'
run_slow_tests: 'false'
trx_file_name: 'TestResults.trx'
md_file_name: 'TestResults.md' # Report file name for LiquidTestReports.Markdown

steps:
- uses: actions/checkout@v2
- name: Checkout Source Code
uses: actions/checkout@v2

- name: Setup .NET 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.412'
if: ${{ startswith(matrix.framework, 'netcoreapp3.') }}
- name: Disable .NET SDK Telemetry and Logo
run: |
echo "DOTNET_NOLOGO=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh

- name: Setup .NET 5 SDK
uses: actions/setup-dotnet@v1
Expand All @@ -93,18 +95,23 @@ jobs:
with:
dotnet-version: '6.0.100'

- run: |
- name: Setup Environment Variables
run: |
$project_name = [System.IO.Path]::GetFileNameWithoutExtension($env:project_path)
$test_results_artifact_name = "testresults_${{matrix.os}}_${{matrix.framework}}_${{matrix.platform}}_${{matrix.configuration}}"
$working_directory = "$env:GITHUB_WORKSPACE"
Write-Host "Project Name: $project_name"
Write-Host "Results Artifact Name: $test_results_artifact_name"
Write-Host "Working Directory: $working_directory"
echo "project_name=$project_name" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "test_results_artifact_name=$test_results_artifact_name" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Set the Azure DevOps default working directory env variable, so our tests only need to deal with a single env variable
echo "SYSTEM_DEFAULTWORKINGDIRECTORY=$working_directory" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# Title for LiquidTestReports.Markdown
echo "title=Test Run for $project_name - ${{matrix.framework}} - ${{matrix.platform}} - ${{matrix.os}}" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- run: dotnet build ${{env.project_path}} --configuration ${{matrix.configuration}} --framework ${{matrix.framework}} /p:TestFrameworks=true
- run: dotnet test ${{env.project_path}} --configuration ${{matrix.configuration}} --framework ${{matrix.framework}} --no-build --no-restore --blame-hang --blame-hang-dump-type mini --blame-hang-timeout 20minutes --logger:"console;verbosity=normal" --logger:"trx;LogFileName=${{env.trx_file_name}}" --logger:"liquid.md;LogFileName=${{env.md_file_name}};Title=${{env.title}};" --results-directory:"${{github.workspace}}/${{env.test_results_artifact_name}}/${{env.project_name}}" -- RunConfiguration.TargetPlatform=${{matrix.platform}} TestRunParameters.Parameter\(name=\"tests:slow\",\ value=\"false\"\)
- run: dotnet test ${{env.project_path}} --configuration ${{matrix.configuration}} --framework ${{matrix.framework}} --no-build --no-restore --blame-hang --blame-hang-dump-type mini --blame-hang-timeout 20minutes --logger:"console;verbosity=normal" --logger:"trx;LogFileName=${{env.trx_file_name}}" --logger:"liquid.md;LogFileName=${{env.md_file_name}};Title=${{env.title}};" --results-directory:"${{github.workspace}}/${{env.test_results_artifact_name}}/${{env.project_name}}" -- RunConfiguration.TargetPlatform=${{matrix.platform}} TestRunParameters.Parameter\(name=\"tests:slow\",\ value=\"\${{env.run_slow_tests}}\"\)
shell: bash
# upload reports as build artifacts
- name: Upload a Build Artifact
Expand Down
Loading

0 comments on commit 381a90d

Please sign in to comment.