-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Helix project and supporting targets (#4847)
- Loading branch information
1 parent
eca7fc9
commit 03fd89e
Showing
11 changed files
with
300 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<Project> | ||
<Target Name="CollectHelixWorkItems" | ||
Outputs="@(HelixWorkItem)"> | ||
<ItemGroup> | ||
<_TargetFrameworks Remove="@(_TargetFrameworks)" /> | ||
<_TargetFrameworks Include="$(TargetFrameworks)" /> | ||
</ItemGroup> | ||
<MSBuild Projects="$(MSBuildProjectFullPath)" | ||
Targets="CollectHelixWorkItems" | ||
Properties="TargetFramework=%(_TargetFrameworks.Identity)" | ||
RemoveProperties="TargetFrameworks"> | ||
<Output TaskParameter="TargetOutputs" | ||
ItemName="HelixWorkItem" /> | ||
</MSBuild> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<Project> | ||
<ItemGroup> | ||
<!-- Set TEST_DOTNET_ROOT to same as DOTNET_ROOT (which is provided by the dotnet cli correlation payload) --> | ||
<HelixWorkItemPreCommand Include="export TEST_DOTNET_ROOT=${DOTNET_ROOT}" | ||
Condition="'$(IsHelixPosixShell)' == 'true'" /> | ||
<HelixWorkItemPreCommand Include="SET TEST_DOTNET_ROOT=%DOTNET_ROOT%" | ||
Condition="'$(IsHelixPosixShell)' != 'true'" /> | ||
</ItemGroup> | ||
|
||
<!-- TODO: Add Helix work item PreCommands to install Node and Azurite --> | ||
|
||
<Target Name="CollectHelixWorkItems" | ||
Outputs="@(HelixWorkItem)" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<IsHelixPosixShell>true</IsHelixPosixShell> | ||
<IsHelixPosixShell Condition="$(HelixTargetQueue.Contains('windows'))">false</IsHelixPosixShell> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project> | ||
<!-- | ||
MSBuild uses the IsCrossTargetingBuild property (which checks | ||
that TargetFrameworks is non-empty and that TargetFramework is empty). | ||
--> | ||
<Import Project="$(MSBuildThisFileDirectory)Helix.CrossTarget.targets" Condition="'$(IsCrossTargetingBuild)' == 'true'" /> | ||
<Import Project="$(MSBuildThisFileDirectory)Helix.SingleTarget.targets" Condition="'$(IsCrossTargetingBuild)' != 'true'" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
<Project Sdk="Microsoft.DotNet.Helix.Sdk" | ||
DefaultTargets="Test"> | ||
|
||
<PropertyGroup> | ||
<HelixConfiguration>$(Configuration)</HelixConfiguration> | ||
<HelixArchitecture>$(BuildArch)</HelixArchitecture> | ||
<UseOpenQueues>true</UseOpenQueues> | ||
<UseOpenQueues Condition="'$(HelixAccessToken)' != ''">false</UseOpenQueues> | ||
<!-- Ensure dotnet correlation payloads match the tested RID --> | ||
<DotNetCliRuntime>$(PackageRid)</DotNetCliRuntime> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(UseOpenQueues)' == 'true'"> | ||
<QueueSuffix>.open</QueueSuffix> | ||
<!-- Open queues require a creator to be set. --> | ||
<Creator Condition=" '$(USERNAME)' != '' ">$(USERNAME)</Creator> | ||
<Creator Condition=" '$(USER)' != '' ">$(USER)</Creator> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(SYSTEM_COLLECTIONURI)' == 'https://dev.azure.com/dnceng/'"> | ||
<HelixSourcePrefix Condition="'$(BUILD_REASON)' == 'Manual'">pr</HelixSourcePrefix> | ||
<HelixSourcePrefix Condition="'$(BUILD_REASON)' == 'PullRequest'">pr</HelixSourcePrefix> | ||
<HelixSourcePrefix Condition="'$(HelixSourcePrefix)' == ''">official</HelixSourcePrefix> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<HelixSourcePrefix Condition="'$(HelixSourcePrefix)' == ''">pr</HelixSourcePrefix> | ||
<HelixSource>$(HelixSourcePrefix)/dotnet/dotnet-monitor</HelixSource> | ||
<HelixSource Condition="'$(BUILD_SOURCEBRANCH)' != ''">$(HelixSource)/$(BUILD_SOURCEBRANCH)</HelixSource> | ||
<HelixType>test/binaries/</HelixType> | ||
</PropertyGroup> | ||
|
||
<ItemDefinitionGroup> | ||
<HelixAvailableTargetQueue> | ||
<AdditionalProperties>Platform=$(HelixArchitecture)</AdditionalProperties> | ||
</HelixAvailableTargetQueue> | ||
</ItemDefinitionGroup> | ||
|
||
<!-- List of all available Helix machines: https://helix.dot.net/ --> | ||
|
||
<!-- Windows queues --> | ||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform(Windows))"> | ||
<!-- win-arm64 --> | ||
<HelixAvailableTargetQueue Include="windows.11.arm64$(QueueSuffix)" | ||
Condition="'$(HelixArchitecture)' == 'arm64'"> | ||
<TestRunName>Windows 11 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
<!-- win-x64 --> | ||
<HelixAvailableTargetQueue Include="windows.10.amd64.client$(QueueSuffix)" | ||
Condition="'$(HelixArchitecture)' == 'x64'"> | ||
<TestRunName>Windows 10 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
<!-- win-x86 --> | ||
<!-- Windows x64 clients can run dotnet x86 natively --> | ||
<HelixAvailableTargetQueue Include="windows.10.amd64.client$(QueueSuffix)" | ||
Condition="'$(HelixArchitecture)' == 'x86'"> | ||
<TestRunName>Windows 10 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
</ItemGroup> | ||
|
||
<!-- Linux gnu libc queues --> | ||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform(Linux)) and !$(PackageRid.Contains(musl))"> | ||
<!-- linux-arm64 --> | ||
<HelixAvailableTargetQueue Include="ubuntu.1804.armarch$(QueueSuffix)@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-arm64v8" | ||
Condition="'$(HelixArchitecture)' == 'arm64'"> | ||
<TestRunName>Debian 11 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
<HelixAvailableTargetQueue Include="ubuntu.1804.armarch$(QueueSuffix)@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8" | ||
Condition="'$(HelixArchitecture)' == 'arm64'"> | ||
<TestRunName>Ubuntu 18.04 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
<!-- linux-x64 --> | ||
<HelixAvailableTargetQueue Include="ubuntu.1804.amd64$(QueueSuffix)@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-11-helix-amd64" | ||
Condition="'$(HelixArchitecture)' == 'x64'"> | ||
<TestRunName>Debian 11 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
<HelixAvailableTargetQueue Include="ubuntu.1804.amd64$(QueueSuffix)@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64" | ||
Condition="'$(HelixArchitecture)' == 'x64'"> | ||
<TestRunName>Mariner 2.0 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
<HelixAvailableTargetQueue Include="ubuntu.1804.amd64$(QueueSuffix)@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-amd64" | ||
Condition="'$(HelixArchitecture)' == 'x64'"> | ||
<TestRunName>Ubuntu 18.04 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
</ItemGroup> | ||
|
||
<!-- Linux musl libc queues --> | ||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform(Linux)) and $(PackageRid.Contains(musl))"> | ||
<!-- linux-musl-arm64 --> | ||
<HelixAvailableTargetQueue Include="ubuntu.1804.armarch$(QueueSuffix)@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.15-helix-arm64v8" | ||
Condition="'$(HelixArchitecture)' == 'arm64'"> | ||
<TestRunName>Alpine 3.15 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
<!-- linux-musl-x64 --> | ||
<HelixAvailableTargetQueue Include="ubuntu.1804.amd64$(QueueSuffix)@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.15-helix-amd64" | ||
Condition="'$(HelixArchitecture)' == 'x64'"> | ||
<TestRunName>Alpine 3.15 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
</ItemGroup> | ||
|
||
<!-- OSX queues --> | ||
<ItemGroup Condition="$([MSBuild]::IsOSPlatform(OSX))"> | ||
<!-- osx-arm64 --> | ||
<HelixAvailableTargetQueue Include="osx.13.arm64$(QueueSuffix)" | ||
Condition="'$(HelixArchitecture)' == 'arm64'"> | ||
<TestRunName>OSX 13 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
<!-- osx-x64 --> | ||
<HelixAvailableTargetQueue Include="osx.13.amd64$(QueueSuffix)" | ||
Condition="'$(HelixArchitecture)' == 'x64'"> | ||
<TestRunName>OSX 13 $(HelixArchitecture) $(HelixConfiguration)</TestRunName> | ||
</HelixAvailableTargetQueue> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<HelixTargetQueue Include="@(HelixAvailableTargetQueue)"> | ||
<AdditionalProperties>%(AdditionalProperties);Configuration=$(HelixConfiguration)</AdditionalProperties> | ||
</HelixTargetQueue> | ||
</ItemGroup> | ||
|
||
<!-- Correlation Payload: SDK (to use "dotnet test") --> | ||
<PropertyGroup> | ||
<IncludeDotNetCli>true</IncludeDotNetCli> | ||
<DotNetCliPackageType>sdk</DotNetCliPackageType> | ||
<DotNetCliVersion>$(MicrosoftDotnetSdkInternalVersion)</DotNetCliVersion> | ||
</PropertyGroup> | ||
|
||
<!-- Correlation Payload: AspNetCore (these packages also contain corresponding NetCoreApp version) --> | ||
<ItemGroup> | ||
<AdditionalDotNetPackage Include="$(MicrosoftAspNetCoreApp60Version)"> | ||
<PackageType>aspnetcore-runtime</PackageType> | ||
</AdditionalDotNetPackage> | ||
<AdditionalDotNetPackage Include="$(MicrosoftAspNetCoreApp70Version)"> | ||
<PackageType>aspnetcore-runtime</PackageType> | ||
</AdditionalDotNetPackage> | ||
<AdditionalDotNetPackage Include="$(MicrosoftAspNetCoreApp80Version)"> | ||
<PackageType>aspnetcore-runtime</PackageType> | ||
</AdditionalDotNetPackage> | ||
</ItemGroup> | ||
|
||
<!-- Correlation Payload: Common Helix payload --> | ||
<ItemGroup> | ||
<HelixCorrelationPayload Include="$(RepoRoot)eng\helix\payload" /> | ||
</ItemGroup> | ||
|
||
<!-- Correlation Payload: Built binaries --> | ||
<ItemGroup> | ||
<HelixCorrelationPayload Include="$(ArtifactsBinDir)" /> | ||
</ItemGroup> | ||
|
||
<!-- Collect HelixWorkItems from each project that participates in testing. --> | ||
<Target Name="CollectHelixWorkItems" | ||
BeforeTargets="BeforeTest"> | ||
<ItemGroup> | ||
<ProjectWithHelixWorkItems Include="$(RepoRoot)src\Tests\**\*.*proj" /> | ||
</ItemGroup> | ||
<MSBuild Projects="@(ProjectWithHelixWorkItems)" | ||
Targets="CollectHelixWorkItems" | ||
SkipNonexistentTargets="true"> | ||
<Output TaskParameter="TargetOutputs" | ||
ItemName="HelixWorkItem" /> | ||
</MSBuild> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@echo off | ||
setlocal | ||
|
||
set testAssembly=%1 | ||
set configuration=%2 | ||
set targetFramework=%3 | ||
set architecture=%~4 | ||
set timeoutMinutes=%~5 | ||
|
||
set filterArgs= | ||
if not "%~6" == "" ( | ||
set filterArgs=--filter ^"%~6^" | ||
) | ||
|
||
set exit_code=0 | ||
|
||
echo "Start tests..." | ||
|
||
dotnet.exe test ^ | ||
"%HELIX_CORRELATION_PAYLOAD%\%testAssembly%\%configuration%\%targetFramework%\%testAssembly%.dll" ^ | ||
--logger:"console;verbosity=normal" ^ | ||
--logger:"trx;LogFileName=%testAssembly%_%targetFramework%_%architecture%.trx" ^ | ||
--logger:"html;LogFileName=%testAssembly%_%targetFramework%_%architecture%.html" ^ | ||
--ResultsDirectory:%HELIX_WORKITEM_UPLOAD_ROOT% ^ | ||
--blame "CollectHangDump;TestTimeout=%timeoutMinutes%m" ^ | ||
%filterArgs% | ||
|
||
if not errorlevel 0 ( | ||
set exit_code=%errorlevel% | ||
) | ||
|
||
echo "Finished tests; exit code: %exit_code%" | ||
|
||
exit /b %exit_code% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
testAssembly="$1" | ||
configuration="$2" | ||
targetFramework="$3" | ||
architecture="$4" | ||
timeoutMinutes="$5" | ||
|
||
filterArgs="" | ||
if [[ ! -z "$6" ]]; then | ||
filterArgs="--filter \"$6\"" | ||
fi | ||
|
||
exit_code=0 | ||
|
||
echo "Start tests..." | ||
|
||
dotnet test \ | ||
"$HELIX_CORRELATION_PAYLOAD/$testAssembly/$configuration/$targetFramework/$testAssembly.dll" \ | ||
--logger:"console;verbosity=normal" \ | ||
--logger:"trx;LogFileName=${testAssembly}_${targetFramework}_${architecture}.trx" \ | ||
--logger:"html;LogFileName=${testAssembly}_${targetFramework}_${architecture}.html" \ | ||
--ResultsDirectory:$HELIX_WORKITEM_UPLOAD_ROOT \ | ||
--blame "CollectHangDump;TestTimeout=${timeoutMinutes}m" \ | ||
$filterArgs | ||
|
||
exit_code=$? | ||
|
||
echo "Finished tests; exit code: $exit_code" | ||
|
||
exit $exit_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Project> | ||
<PropertyGroup Condition="'$(TargetFramework)' != ''"> | ||
<HelixDotnetTestArgs>$(TargetName) $(Configuration) $(TargetFramework) $(Platform) $(TestRunnerTestTimeoutMinutes) $(TestRunnerFilterArguments)</HelixDotnetTestArgs> | ||
<HelixDotnetTestCommand Condition="'$(IsHelixPosixShell)' != 'true'">call %HELIX_CORRELATION_PAYLOAD%\dotnettest.cmd $(HelixDotnetTestArgs)</HelixDotnetTestCommand> | ||
<HelixDotnetTestCommand Condition="'$(IsHelixPosixShell)' == 'true'">$HELIX_CORRELATION_PAYLOAD/dotnettest.sh $(HelixDotnetTestArgs)</HelixDotnetTestCommand> | ||
<!-- Add an arbitrary of time to the test timeout so that the work item has extra time to run pre and post commands. --> | ||
<HelixTimeoutMinutes>$([MSBuild]::Add($(TestRunnerTestTimeoutMinutes), 10))</HelixTimeoutMinutes> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' != ''"> | ||
<!-- Helix work item that calls "dotnet test" for the test assembly. --> | ||
<HelixWorkItem Include="$(MSBuildProjectName)-$(TargetFramework)-$(Platform)"> | ||
<PreCommands Condition="'$(HelixTargetQueue)' != ''">@(HelixWorkItemPreCommand)</PreCommands> | ||
<Command Condition="'$(HelixTargetQueue)' != ''">$(HelixDotnetTestCommand)</Command> | ||
<PostCommands Condition="'$(HelixTargetQueue)' != ''">@(HelixWorkItemPostCommand)</PostCommands> | ||
<Timeout>00:$(HelixTimeoutMinutes):00</Timeout> | ||
</HelixWorkItem> | ||
</ItemGroup> | ||
</Project> |