Run MSBuild in parallel when submitting jobs to Helix (dotnet/coreclr#21390)
authorEgor Chesakov <Egor.Chesakov@microsoft.com>
Thu, 6 Dec 2018 18:22:50 +0000 (10:22 -0800)
committerGitHub <noreply@github.com>
Thu, 6 Dec 2018 18:22:50 +0000 (10:22 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/2161d9d1789d28b1e56f4edff47572b12585a680

eng/test-job.yml
src/coreclr/tests/helixpublishwitharcade.proj

index d596c93..32acec3 100644 (file)
@@ -113,7 +113,7 @@ jobs:
 
     # Send tests to helix
     - ${{ if or(eq(parameters.osGroup, 'Linux'), eq(parameters.osGroup, 'OSX')) }}:
-      - script: ./Tools/dotnetcli/dotnet msbuild tests/helixpublishwitharcade.proj /t:Test $(scenariosArg)
+      - script: ./Tools/dotnetcli/dotnet msbuild tests/helixpublishwitharcade.proj /maxcpucount $(scenariosArg)
         displayName: Send test jobs to Helix
         env:
           ${{ if eq(variables['System.TeamProject'], 'internal') }}:
@@ -123,7 +123,7 @@ jobs:
             # Access token variable for public project
             HelixAccessToken: $(BotAccount-dotnet-github-anon-kaonashi-bot-helix-token)
     - ${{ if eq(parameters.osGroup, 'Windows_NT') }}:
-      - script: .\Tools\dotnetcli\dotnet msbuild tests\helixpublishwitharcade.proj /t:Test $(scenariosArg)
+      - script: .\Tools\dotnetcli\dotnet msbuild tests\helixpublishwitharcade.proj /maxcpucount  $(scenariosArg)
         displayName: Send test jobs to Helix
         env:
           ${{ if eq(variables['System.TeamProject'], 'internal') }}:
index 38fb8d2..50d7818 100644 (file)
@@ -1,4 +1,4 @@
-<Project Sdk="Microsoft.DotNet.Helix.Sdk">
+<Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="SubmitTestsToHelix">
 
   <!-- This project uses the helix SDK ,documented at
        https://github.com/dotnet/arcade/tree/master/src/Microsoft.DotNet.Helix/Sdk,
   <Target Name="SubmitTestsToHelix">
     <ItemGroup>
       <Scenarios Include="$(Scenarios)" />
+      <ProjectsToBuild Include="$(MSBuildProjectFile)">
+        <Properties>Scenario=%(Scenarios.Identity)</Properties>
+      </ProjectsToBuild>
     </ItemGroup>
 
-    <!-- If no scenario was specified, just run the normal test
-         scenario -->
-    <MSBuild Projects="$(MSBuildProjectFile)" Targets="Test"
-             Condition=" '@(Scenarios->Count())' == '0' " />
-
-    <!-- If scenarios were specified, submit jobs for each
-         scenario. -->
-    <MSBuild Projects="$(MSBuildProjectFile)" Targets="Test"
-             Properties="Scenario=%(Scenarios.Identity)"
-             BuildInParallel="true"
-             Condition=" '@(Scenarios->Count())' != '0' " />
+    <PropertyGroup>
+      <BuildInParallel>false</BuildInParallel>
+      <BuildInParallel Condition=" '@(ProjectsToBuild->Count())' > '1' ">true</BuildInParallel>
+    </PropertyGroup>
 
+    <MSBuild Projects="@(ProjectsToBuild)" Targets="Test" BuildInParallel="$(BuildInParallel)" StopOnFirstFailure="false" UnloadProjectsOnCompletion="true" />
   </Target>
 
   <Target Name="BuildHelixWorkItem"