Skip to content

Commit fc50019

Browse files
committed
Hook up CI runs to run tests as tools
1 parent 9b418b4 commit fc50019

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

.vsts-ci.yml

+16
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,22 @@ phases:
5555
_BuildConfig: Release
5656
_PublishType: none
5757
_SignType: test
58+
- template: /eng/build.yml
59+
parameters:
60+
agentOs: Windows_NT_TestAsTools
61+
queue:
62+
name: dotnet-external-temp
63+
parallel: 2
64+
timeoutInMinutes: 120
65+
matrix:
66+
Build_Debug:
67+
_BuildConfig: Debug
68+
_PublishType: none
69+
_SignType: test
70+
Build_Release:
71+
_BuildConfig: Release
72+
_PublishType: none
73+
_SignType: test
5874

5975
- template: /eng/build.yml
6076
parameters:

Directory.Build.targets

+7
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,11 @@
1515
</ItemGroup>
1616

1717
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
18+
19+
<!-- Optionally override arcade's test target with one which will run the tests as tools.
20+
Conditionally overriding a target requires a conditional import of another (.targets)
21+
file. -->
22+
<Import Project="OverrideTest.targets"
23+
Condition="'$(RunTestsAsTool)' == 'true' And '$(CanRunTestAsTool)' == 'true'"/>
24+
1825
</Project>

OverrideTest.targets

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
3+
<Project>
4+
<Target Name="Test" DependsOnTargets="TestAsTool"
5+
Condition="'$(IsUnitTestProject)' == 'true' or '$(IsPerformanceTestProject)' == 'true'"/>
6+
7+
</Project>

eng/build.yml

+14-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,20 @@ phases:
7272
PublishType: $(_PublishType)
7373
TestFullMSBuild: 'true'
7474

75-
- ${{ if notIn(parameters.agentOs, 'Windows_NT', 'Windows_NT_FullFramework') }}:
75+
- ${{ if eq(parameters.agentOs, 'Windows_NT_TestAsTools') }}:
76+
- script: eng\common\CIBuild.cmd
77+
-configuration $(_BuildConfig)
78+
$(_PublishArgs)
79+
$(_SignArgs)
80+
$(_OfficialBuildIdArgs)
81+
/p:RunTestsAsTool=true
82+
displayName: Build
83+
env:
84+
BuildConfig: $(_BuildConfig)
85+
BlobFeedUrl: $(PB_PublishBlobFeedUrl)
86+
PublishType: $(_PublishType)
87+
88+
- ${{ if notIn(parameters.agentOs, 'Windows_NT', 'Windows_NT_FullFramework', 'Windows_NT_TestAsTools') }}:
7689
- script: eng/common/cibuild.sh
7790
--configuration $(_BuildConfig)
7891
$(_PublishArgs)

src/Tests/Directory.Build.targets

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<IsPackable>true</IsPackable>
1010
<PackAsTool>true</PackAsTool>
1111
<ToolCommandName>$(PackageId)</ToolCommandName>
12+
<CanRunTestAsTool>true</CanRunTestAsTool>
1213

1314
<!-- Put packages for tests in subfolder so we don't try to sign them -->
1415
<PackageOutputPath>$(PackageOutputPath)tests\</PackageOutputPath>
@@ -26,7 +27,7 @@
2627

2728
</ItemGroup>
2829

29-
<Target Name="TestAsTool" DependsOnTargets="_InnerGetTestsToRun">
30+
<Target Name="TestAsTool" DependsOnTargets="Pack;_InnerGetTestsToRun">
3031
<PropertyGroup>
3132
<TestLocalToolFolder>$(ArtifactsTmpDir)$(ToolCommandName)\</TestLocalToolFolder>
3233
</PropertyGroup>

0 commit comments

Comments
 (0)