sendtohelix.proj 5.9 KB
Newer Older
1
<Project InitialTargets="PrintHelixQueues;BuildHelixWorkItems" Sdk="Microsoft.DotNet.Helix.Sdk">
2 3 4 5 6
  <PropertyGroup>
    <!-- Set helix build to build number if available -->
    <HelixBuild Condition="'$(HelixBuild)' == ''">$(BUILD_BUILDNUMBER)</HelixBuild>
    <HelixBuild Condition="'$(HelixBuild)' == ''">default</HelixBuild>

M
Matt Galbraith 已提交
7
    <!-- For arm/arm64 we set a 30 min timeout temporarily until we split up slow test assemblies. -->
8
    <TimeoutInSeconds Condition="'$(ArchGroup)' == 'arm64' or '$(ArchGroup)' == 'arm'">1800</TimeoutInSeconds>
9
    <TimeoutInSeconds Condition="'$(TimeoutInSeconds)' == ''">900</TimeoutInSeconds>
10 11
    <_timeoutSpan>$([System.TimeSpan]::FromSeconds($(TimeoutInSeconds)))</_timeoutSpan>
    
12 13 14
    <!-- We need to enable xunit reporter so that it parses test results
         Package testing doesn't run on xunit. -->
    <EnableXunitReporter Condition="'$(TargetGroup)' != 'AllConfigurations'">true</EnableXunitReporter>
15 16
    
    <TestArchiveRuntimeFile>$(TestArchiveRuntimeRoot)test-runtime-$(BuildConfiguration).zip</TestArchiveRuntimeFile>
17
    <TestArchiveRuntimeFile Condition="'$(TargetGroup)' == 'AllConfigurations'">$(TestArchiveRuntimeRoot)packages-testPayload-$(ConfigurationGroup).zip</TestArchiveRuntimeFile>
18 19 20 21 22 23 24 25 26 27 28

    <!-- The helix runtime payload and the tests to run -->
    <HelixCorrelationPayload Condition="'$(HelixCorrelationPayload)' == ''">$(TestArchiveRuntimeFile)</HelixCorrelationPayload>
    <WorkItemArchiveWildCard Condition="'$(WorkItemArchiveWildCard)' == ''">$(TestArchiveTestsRoot)**/*.zip</WorkItemArchiveWildCard>

    <HelixConfiguration>$(ConfigurationGroup)</HelixConfiguration>
    <HelixArchitecture>$(ArchGroup)</HelixArchitecture>

    <!-- This property is used to show the tests results in Azure Dev Ops. By setting this property the
    test run name will be displayed as $(BuildConfiguration)-$(HelixTargetQueue) -->
    <TestRunNamePrefix>$(BuildConfiguration)-</TestRunNamePrefix>
29
    <TestRunNamePrefix Condition="'$(TestRunNamePrefixSuffix)' != ''">$(TestRunNamePrefix)$(TestRunNamePrefixSuffix)-</TestRunNamePrefix>
30

31
    <FailOnTestFailure Condition="'$(WaitForWorkItemCompletion)' != ''">$(WaitForWorkItemCompletion)</FailOnTestFailure>
32 33
  </PropertyGroup>

34 35 36 37 38 39 40 41 42
  <PropertyGroup Condition="'$(TargetGroup)' == 'AllConfigurations'">
    <!-- Use helix feature to include dotnet CLI for every workitem and add it to the path -->
    <IncludeDotNetCli>true</IncludeDotNetCli>
    <DotNetCliPackageType>sdk</DotNetCliPackageType>

    <GlobalJsonContent>$([System.IO.File]::ReadAllText('$(RepoRoot)global.json'))</GlobalJsonContent>
    <DotNetCliVersion>$([System.Text.RegularExpressions.Regex]::Match($(GlobalJsonContent), '(%3F&lt;="dotnet": ").*(%3F=")'))</DotNetCliVersion>
  </PropertyGroup>

43
  <PropertyGroup Condition="'$(HelixType)' == ''">
44
    <!-- For PRs we want helixtype to be the same for all frameworks except package testing-->
45 46
    <TestScope Condition="'$(TestScope)' == ''">innerloop</TestScope>
    <HelixType>test/functional/cli/$(TestScope)/</HelixType>
47
    <HelixType Condition="'$(TargetGroup)' == 'AllConfigurations'">test/functional/packaging/</HelixType>
48 49
  </PropertyGroup>

50
  <PropertyGroup Condition="'$(HelixCommand)' == '' and '$(TargetGroup)' == 'AllConfigurations'">
51 52
    <HelixPreCommands>set DOTNET_CLI_TELEMETRY_OPTOUT=1;set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1;set DOTNET_MULTILEVEL_LOOKUP=0</HelixPreCommands>

53
    <HelixCommand>dotnet msbuild %HELIX_CORRELATION_PAYLOAD%\test.msbuild</HelixCommand>
54
    <HelixCommand>$(HelixCommand) /warnaserror</HelixCommand>
55 56
    <HelixCommand>$(HelixCommand) /p:PackageTestProjectsDir=%HELIX_WORKITEM_PAYLOAD%</HelixCommand>
    <HelixCommand>$(HelixCommand) /p:RestorePackagesPath=%HELIX_WORKITEM_PAYLOAD%\packages</HelixCommand>
57
    <HelixCommand>$(HelixCommand) /p:LocalPackagesPath="%HELIX_CORRELATION_PAYLOAD%\packages\"</HelixCommand>
58 59
  </PropertyGroup>

60
  <PropertyGroup Condition="'$(HelixCommand)' == ''">
61 62 63 64 65
    <!--
      For windows we need to use call, since the command is going to be called from a bat script created by Helix
      and we exit /b at the end of RunTests.cmd, Helix runs some other commands after ours within the bat script,
      if we don't use call, then we cause the parent script to exit, and anything after will not be executed.
    -->
66 67
    <HelixCommand Condition="'$(TargetsWindows)' == 'true'">call RunTests.cmd --runtime-path %HELIX_CORRELATION_PAYLOAD%</HelixCommand>
    <HelixCommand Condition="'$(TargetsWindows)' != 'true'">./RunTests.sh --runtime-path "$HELIX_CORRELATION_PAYLOAD"</HelixCommand>
68 69
  </PropertyGroup>

70 71 72 73
  <!--
    We need to include all dlls in the runtime path as inputs to make it really incremental if we use the root folder,
    if a dll is updated, the folder's timestamp is not updated, therefore skipped.
  -->
74 75 76 77 78
  <ItemGroup>
    <_RuntimeInputs Include="$(TestHostRootPath)**/*.dll" />
  </ItemGroup>

  <Target Name="CompressRuntimeDirectory"
79
          Inputs="@(_RuntimeInputs);@(TestArchiveRuntimeDependency)"
80 81
          Outputs="$(TestArchiveRuntimeFile)"
          Condition="'$(TargetGroup)' != 'AllConfigurations'">
82 83

    <MakeDir Directories="$(TestArchiveRuntimeRoot)" />
84 85 86
    <ZipDirectory SourceDirectory="$(TestHostRootPath)"
                  DestinationFile="$(TestArchiveRuntimeFile)"
                  Overwrite="true" />
87 88 89

  </Target>

90 91
  <Target Name="BuildHelixWorkItems"
          DependsOnTargets="CompressRuntimeDirectory">
92

93
    <ItemGroup>
94 95 96 97 98 99 100 101 102 103
      <HelixCorrelationPayload Include="$(HelixCorrelationPayload)" />

      <_WorkItem Include="$(WorkItemArchiveWildCard)" Exclude="$(HelixCorrelationPayload)" />

      <HelixWorkItem Include="@(_WorkItem -> '%(FileName)')">
        <PayloadArchive>%(Identity)</PayloadArchive>
        <Command>$(HelixCommand)</Command>
        <Timeout>$(_timeoutSpan)</Timeout>
      </HelixWorkItem>
    </ItemGroup>
104

105
  </Target>
106 107 108 109

  <Target Name="PrintHelixQueues">
    <Message Importance="High" Text="Using Queues: $(HelixTargetQueues)" />
  </Target>
110
</Project>