summaryrefslogtreecommitdiff
path: root/tests/helixpublishwitharcade.proj
blob: d4799690cab86ab26a72260fc43347fd85f492f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<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,
       to send test jobs to helix. -->

  <Import Project="..\dir.props" />

  <PropertyGroup>
    <!-- TODO: pick appropriate helix source and type. -->
    <HelixSource>pr/coreclr/master</HelixSource>
    <HelixType>test/stuff</HelixType>
    <HelixBuild>$(BUILD_BUILDNUMBER)</HelixBuild>

    <EnableXUnitReporter>true</EnableXUnitReporter>
    <WaitForWorkItemCompletion>true</WaitForWorkItemCompletion>
    <SourceDirectory>$(MSBuildProjectDirectory)/..</SourceDirectory>
  </PropertyGroup>

  <ItemGroup>
    <HelixCorrelationPayload Include="$(SourceDirectory)\bin\tests\*\archive\Core_Root\*.zip">
      <PayloadArchive>%(Identity)</PayloadArchive>
    </HelixCorrelationPayload>
  </ItemGroup>

  <Target Name="SubmitTestsToHelix">
    <ItemGroup>
      <Scenarios Include="$(Scenarios)" />
      <ProjectsToBuild Include="$(MSBuildProjectFile)">
        <Properties>Scenario=%(Scenarios.Identity)</Properties>
      </ProjectsToBuild>
    </ItemGroup>

    <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"
          BeforeTargets="Test">
    <PropertyGroup>
      <!-- The "normal" scenario is just a way to include the default
           (empty) scenario when specifying multiple scenarios at
           once. From here, on, treat it as the empty scenario so that
           job names will not have a scenario prefix and the runtest
           script doesn't have to define a "normal" scenario. -->
      <Scenario Condition=" '$(Scenario)' == 'normal' "></Scenario>
      <ScenarioPrefix Condition=" '$(Scenario)' == '' " />
      <ScenarioPrefix Condition=" '$(Scenario)' != '' ">$(Scenario) </ScenarioPrefix>
    </PropertyGroup>
    <ItemGroup>
      <TestZipFiles Include="$(SourceDirectory)\bin\tests\*\archive\tests\*.zip" />
      <HelixWorkItem Include="@(TestZipFiles->'$(ScenarioPrefix)%(FileName)')" >
        <PayloadArchive>%(Identity)</PayloadArchive>
        <Command Condition=" '$(Scenario)' == '' ">python runtest_helix.py -wrapper %(FileName).dll</Command>
        <Command Condition=" '$(Scenario)' != '' ">python runtest_helix.py -scenario $(Scenario) -wrapper %(FileName).dll</Command>
      </HelixWorkItem>
    </ItemGroup>

  </Target>

</Project>