summaryrefslogtreecommitdiff
path: root/tests/helixpublish.proj
blob: 7ae9666e3efbdf854e90f50478288bd262acd2b0 (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <__BuildArch>$(Platform)</__BuildArch>
  </PropertyGroup>
  
  <Import Project="..\dir.props" />
  <!-- CoreClr-Specific Helix test submission project. -->

  <PropertyGroup>
    <!-- Workaround for dealing with building on Linux/OSX.  
         It doesn't seem possible to pass a connection string on the command line, as it contains ';' characters. 
         Checking for the existence of a connection string will happen inside CloudTest.Helix.targets -->
    <CloudDropConnectionString    Condition="'$(CloudDropConnectionString)'==''"   >DefaultEndpointsProtocol=https;AccountName=$(CloudDropAccountName);AccountKey=$(CloudDropAccessToken);EndpointSuffix=core.windows.net</CloudDropConnectionString>
    <CloudResultsConnectionString Condition="'$(CloudResultsConnectionString)'==''">DefaultEndpointsProtocol=https;AccountName=$(CloudResultsAccountName);AccountKey=$(CloudResultsAccessToken);EndpointSuffix=core.windows.net</CloudResultsConnectionString>    

    <!-- Finally, these archives represent the zips of tests that are OSPlatform specific 
         This is used by CloudTest.Helix.Targets to generate relative blob paths for archives. -->
    <ArchivesRoot>$(TestWorkingDir)/archive/</ArchivesRoot>
    <TestArchivesRoot>$(ArchivesRoot)tests</TestArchivesRoot> 

    <RunnerScript Condition="'$(RunnerScript)' == ''">$(TestRunnerScript)</RunnerScript>
    <SupplementalPayloadDir Condition="'$(SupplementalPayloadDir)' == ''">$(TestWorkingDir)SupplementalPayload/</SupplementalPayloadDir>

    <!-- The old CloudTest.targets forced a single timeout value onto every test -->
    <!-- Possible TODO: With the CloudTest.Helix.targets refactor, we have the ability to specify variable timeout-->
    <TimeoutInSeconds Condition="'$(TimeoutInSeconds)' == ''">1000</TimeoutInSeconds>

    <!-- Set required properties for Helix Submission -->
    <IsOfficial Condition="'$(OfficialBuildId)'!=''">true</IsOfficial>
    <CurrentDate>$([System.DateTime]::Now.ToString(yyyyMMdd.mmss))</CurrentDate>

    <HelixJobType Condition="'$(HelixJobType)'==''">test/functional/cli/</HelixJobType>

    <HelixSource Condition="'$(HelixSource)'=='' And '$(IsOfficial)'!='' And '$(TestProduct)'!='' And '$(Branch)'!=''">official/$(TestProduct)/$(Branch)/</HelixSource>
    <HelixSource Condition="'$(HelixSource)'=='' And '$(IsOfficial)'=='' And '$(TestProduct)'!='' And '$(Branch)'!=''">pr/$(TestProduct)/$(Branch)/</HelixSource>
    <HelixSource Condition="'$(HelixSource)'==''">pr/unknown/</HelixSource>

    <!-- Local path for storing submission-related files -->
    <HelixLogFolder>$(ArchivesRoot)</HelixLogFolder>

    <!-- Properties used for submission by CloudTest.Helix.Targets-->
    <BuildMoniker>$(CurrentDate)</BuildMoniker>
    <BuildMoniker Condition="'$(IsOfficial)'=='true'">$(OfficialBuildId)</BuildMoniker>
    <HelixArchLabel>$(Platform)</HelixArchLabel>
    <HelixConfigLabel>$(BuildType)</HelixConfigLabel>
  </PropertyGroup>

  <!-- Set Helix environment vars based on target platform -->
  <!-- This is only used in the case where property 'UseScriptRunner' is true.-->
  <PropertyGroup Condition="'$(TargetsWindows)' == 'true'">
    <HelixPythonPath>%HELIX_PYTHONPATH%</HelixPythonPath>
    <RunnerScript>%HELIX_CORRELATION_PAYLOAD%\RunnerScripts\scriptrunner\scriptrunner.py</RunnerScript>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TargetsWindows)' != 'true'">
    <HelixPythonPath>$HELIX_PYTHONPATH</HelixPythonPath>
    <RunnerScript>$HELIX_CORRELATION_PAYLOAD/RunnerScripts/scriptrunner/scriptrunner.py</RunnerScript>
  </PropertyGroup>

  <Target Name="CoreClrPreCloudBuild" >
    <!-- Put anything you want to do before submitting the general purpose helix job here.
         Helix requires properly formatted work items and accessible zip files / others to upload, which we'll construct here. -->
    
    <!-- Gather the test archives for this build 
         If you change binplacing behavior and official runs break, 
         this is a good place to check.-->
    <ItemGroup>
      <HelixWorkItem Include="$(TestArchivesRoot)/*.zip" /> 
    </ItemGroup>
    <Message Text="Full test archive collection : @(HelixWorkItem)" Importance="Low" />

    <!-- Verify the test archives exist.  
         NOTE: It may be better to make this an error, but in the past we chose not to as this causes a build break when triggered, versus just no tests run. -->
    <Warning Condition="'@(HelixWorkItem->Count())' == '0'" Text="Didn't find any test archives in supplied folders!!! Review logs to see where test archive(s) were placed and fix." />

    <ItemGroup>      
      <HelixCorrelationPayloadFile Include="$(ArchivesRoot)Core_Root*/*.zip">
        <RelativeBlobPath>$(Platform)$(ConfigurationGroup)/%(Identity)</RelativeBlobPath>
      </HelixCorrelationPayloadFile>
      <HelixWorkItem>
        <Command Condition="'$(TargetsWindows)' == 'true'">$(HelixPythonPath) $(RunnerScript) --script %HELIX_WORKITEM_PAYLOAD%\runtests.cmd</Command>
        <Command Condition="'$(TargetsWindows)' != 'true'">chmod +x $HELIX_WORKITEM_PAYLOAD/runtests.sh &amp;&amp; $(HelixPythonPath) $(RunnerScript) --script $HELIX_WORKITEM_PAYLOAD/runtests.sh</Command>
        <PayloadFile>%(Identity)</PayloadFile>
        <WorkItemId>%(Filename)</WorkItemId>
        <TimeoutInSeconds>$(TimeoutInSeconds)</TimeoutInSeconds>
        <RelativeBlobPath>$(Platform)-$(ConfigurationGroup)/Tests/$([System.String]::Copy('%(RecursiveDir)').Replace('\', '/'))%(Filename)%(Extension)</RelativeBlobPath>
      </HelixWorkItem>      
    </ItemGroup>
  </Target>

  <!-- Import this at the end so that it can compose properties as needed -->
  <Import Project="$(ToolsDir)CloudTest.Helix.targets" />

  <!-- main Entrypoint -->
  <Target Name="Build">
    <Message Text="CoreClr-specific Helix test upload project, beginning submission to Helix" />
    <Message Condition="'$(EnableCloudTest)' == 'false'" Text="... skipping upload / submission due to property 'EnableCloudTest' being set to 'false'" />
    <CallTarget Condition="'$(EnableCloudTest)' != 'false'" Targets="CoreClrPreCloudBuild;HelixCloudBuild" />
  </Target>
  
</Project>