Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force test run for all projects #22

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
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
63 changes: 41 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,19 +250,24 @@ 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: Setup .NET 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '$DotNetCore3SDKVersion'
if: `${{ startswith(matrix.framework, 'netcoreapp3.') }}

- name: Setup .NET 5 SDK
uses: actions/setup-dotnet@v1
with:
Expand All @@ -273,18 +279,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 +336,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 +363,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
}
16 changes: 8 additions & 8 deletions .github/workflows/Lucene-Net-Tests-AllProjects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,13 @@ 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: Setup .NET 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.412'
if: ${{ startswith(matrix.framework, 'netcoreapp3.') }}

- name: Setup .NET 5 SDK
uses: actions/setup-dotnet@v1
with:
Expand All @@ -109,18 +104,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
16 changes: 8 additions & 8 deletions .github/workflows/Lucene-Net-Tests-Analysis-Common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,13 @@ 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: Setup .NET 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.412'
if: ${{ startswith(matrix.framework, 'netcoreapp3.') }}

- name: Setup .NET 5 SDK
uses: actions/setup-dotnet@v1
with:
Expand All @@ -93,18 +88,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
16 changes: 8 additions & 8 deletions .github/workflows/Lucene-Net-Tests-Analysis-Kuromoji.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,13 @@ jobs:
framework: net461
env:
project_path: './src/Lucene.Net.Tests.Analysis.Kuromoji/Lucene.Net.Tests.Analysis.Kuromoji.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: Setup .NET 3.1 SDK
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.412'
if: ${{ startswith(matrix.framework, 'netcoreapp3.') }}

- name: Setup .NET 5 SDK
uses: actions/setup-dotnet@v1
with:
Expand All @@ -90,18 +85,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