Skip to content

Commit

Permalink
[devops] Run the bgen tests on Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Aug 17, 2023
1 parent 028c539 commit 908be6b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tools/devops/automation/scripts/run-generator-tests-on-windows.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Dump the environment to see what we're working with.
& "$Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\show_env.ps1"

# Set a few variables
$Env:DOTNET = "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe"
$Env:DOTNET_DIR = "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet\"
$Env:TESTS_USE_SYSTEM = "1"

# Compute the <platform>_NUGET_VERSION_NO_METADATA variables and set them in the environment
$configurationDotNetPlatforms = $Env:CONFIGURATION_DOTNET_PLATFORMS
$dotnetPlatforms = $configurationDotNetPlatforms.Split(' ', [StringSplitOptions]::RemoveEmptyEntries)
foreach ($platform in $dotnetPlatforms) {
$manifestPath = "$Env:BUILD_SOURCESDIRECTORY\artifacts\AssetManifests\$($platform)\AssetManifest.xml"
$productVersion = Select-Xml -Path "$manifestPath" -XPath "/Build/Package[@Id='Microsoft.$($platform).Sdk']/@Version" | ForEach-Object { $_.Node.Value }
$variableName = "$($platform.ToUpper())_NUGET_VERSION_NO_METADATA"
[Environment]::SetEnvironmentVariable($variableName, $productVersion)
Write-Host "$variableName = $productVersion"
}

# Tell the tests how they can execute the C# compiler
$csc = Get-ChildItem "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet" -Include csc.dll -Recurse -File | %{$_.FullName}
$Env:DOTNET_CSC_COMMAND = "$Env:DOTNET exec $csc".Replace("\", "/")
Write-Host "DOTNET_CSC_COMMAND: $Env:DOTNET_CSC_COMMAND"

# Tell the tests where the BCL is
$Env:DOTNET_BCL_DIR = Get-ChildItem "$Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet\packs\Microsoft.NETCore.App.Ref" -Include System.dll -Recurse -File | %{$_.DirectoryName}
Write-Host "DOTNET_BCL_DIR: $Env:DOTNET_BCL_DIR"

# Finally we can run the tests
& $Env:BUILD_SOURCESDIRECTORY\xamarin-macios\tests\dotnet\Windows\bin\dotnet\dotnet.exe `
test `
"$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/tests/bgen/bgen-tests.csproj" `
"--results-directory:$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/jenkins-results/windows/bgen-tests/" `
"--logger:console;verbosity=detailed" `
"--logger:trx;LogFileName=$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/jenkins-results/windows/bgen-tests/results.trx" `
"--logger:html;LogFileName=$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/jenkins-results/windows/bgen-tests/results.html" `
"-bl:$Env:BUILD_SOURCESDIRECTORY/xamarin-macios/jenkins-results/windows/bgen-tests/results.binlog"
13 changes: 13 additions & 0 deletions tools/devops/automation/templates/windows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@ steps:
"-bl:$(Build.SourcesDirectory)/xamarin-macios/tests/dotnet/Windows/run-dotnet-tests.binlog"
displayName: 'Run .NET tests'

- pwsh: |
Import-Module $Env:SYSTEM_DEFAULTWORKINGDIRECTORY\xamarin-macios\tools\devops\automation\scripts\MaciosCI.psd1
$configFile = "$(Build.SourcesDirectory)\artifacts\build-configuration\configuration.json"
$config = Import-BuildConfiguration -ConfigFile $configFile
$config | Write-Host
name: configuration
continueOnError: true
displayName: 'Parse build configuration'
timeoutInMinutes: 1

- pwsh: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/run-generator-tests-on-windows.ps1
displayName: 'Run generator tests'

# Archive files for the Html Report so that the report can be easily uploaded as artifacts of the build.
- task: ArchiveFiles@1
displayName: 'Archive HtmlReport'
Expand Down

0 comments on commit 908be6b

Please sign in to comment.