Skip to content

[WIP] Use helix on CI #628

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
91e764c
Add helix CI job
HaoK Dec 11, 2018
7bf8283
Disable failing OSX loc tests
HaoK Dec 11, 2018
9f542e5
Add using
HaoK Dec 11, 2018
a6c9912
Skip logging analyzer tests for now
HaoK Dec 11, 2018
858505b
Skip more OSX tests
HaoK Dec 11, 2018
37c279e
Skip last failing test
HaoK Dec 11, 2018
6a0329c
Cleanup and use version variables
HaoK Dec 11, 2018
334ce16
Revert "Skip logging analyzer tests for now"
HaoK Dec 12, 2018
e36ba8c
Change friendly name separator
HaoK Dec 13, 2018
2c86fb1
Try not building in parallel
HaoK Dec 13, 2018
3f3635b
see if helix failures fail build now
HaoK Dec 13, 2018
a05ecf3
Update helix.proj
HaoK Dec 13, 2018
108f262
Try latest sdk
HaoK Dec 14, 2018
ebad1b0
Turn on xunit reporter only for net461
HaoK Dec 18, 2018
27f5be2
Missing "
HaoK Dec 18, 2018
bc35956
Revert "Skip last failing test"
HaoK Dec 18, 2018
dda24be
Trigger build
HaoK Jan 4, 2019
0276485
Get rid of access token for public helix builds
HaoK Jan 4, 2019
261004f
Try newer helix sdk
HaoK Jan 4, 2019
a899fd5
Add properties
HaoK Jan 4, 2019
5d57e04
Cleanup windows queue check
HaoK Jan 7, 2019
0a71002
Cleanup comment
HaoK Jan 7, 2019
3c5e7c3
Fix typo
HaoK Jan 7, 2019
85ea12b
Remove debug flag
natemcmaster Jan 7, 2019
4dc72c8
Remove trim workaround
HaoK Jan 7, 2019
54ab1ab
Fallback to $USER
HaoK Jan 7, 2019
0625fa5
Try targeting all queues
HaoK Jan 7, 2019
ebdb8fe
Skip failing loc test on OSX
HaoK Jan 7, 2019
7b07b52
Update to sdk with helix test failing fix
HaoK Jan 7, 2019
c2a8e97
Remove timeout property
HaoK Jan 7, 2019
2481f4e
Remove redhat 6 queue
HaoK Jan 7, 2019
adb2adc
Add helix doc
HaoK Jan 7, 2019
cb32e22
Tweak doc
HaoK Jan 7, 2019
b977eda
Add single retry for dotnet-install.sh
HaoK Jan 7, 2019
e8ee21a
Reskip test
HaoK Jan 8, 2019
fd495e0
Correctly disable test on OSX
HaoK Jan 8, 2019
ed91592
Disable flaky cache tests
HaoK Jan 8, 2019
2d4d068
Disable flaky caching tests
HaoK Jan 8, 2019
75ab547
Disable failing test
HaoK Jan 8, 2019
c7f5606
Disable more flaky tests
HaoK Jan 8, 2019
da490bb
Fix retry test
HaoK Jan 8, 2019
4a57a13
Disable more failing cache tests
HaoK Jan 8, 2019
5886cbf
Hardcode standard timeout for now
HaoK Jan 8, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,71 @@

<Import Project="eng\targets\Packaging.targets" Condition=" '$(MSBuildProjectExtension)' == '.csproj' " />
<Import Project="eng\targets\ResolveReferences.targets" Condition=" '$(DisableReferenceRestrictions)' != 'true' AND '$(MSBuildProjectExtension)' == '.csproj' " />

<ItemGroup>
<PackageReference Include="xunit.runner.console" Version="2.4.1" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
</ItemGroup>

<Target Name="CreateTestPayload" Returns="@(TestPayload)">

<ItemGroup>
<_TargetFrameworks Remove="@(_TargetFrameworks)" />
<_TargetFrameworks Include="$(TargetFrameworks);$(TargetFramework)" />
</ItemGroup>

<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="_CreateTestPayloadInner"
Properties="TargetFramework=%(_TargetFrameworks.Identity)">
<Output TaskParameter="TargetOutputs" ItemName="TestPayload" />
</MSBuild>
</Target>

<Target Name="CollectXunitConsoleRunner" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PropertyGroup>
<XunitConsoleRunnerDir>$([System.IO.Path]::GetDirectoryName($(XunitConsole472Path)))</XunitConsoleRunnerDir>
</PropertyGroup>

<ItemGroup>
<XunitConsoleRunnerFiles Include="$(XunitConsoleRunnerDir)/**/*" />
</ItemGroup>

<Copy SourceFiles="@(XunitConsoleRunnerFiles)" DestinationFolder="$(PublishDir)" />
</Target>

<Target Name="_CreateTestPayloadInner"
DependsOnTargets="Publish;CollectXunitConsoleRunner"
Condition="'$(IsTestProject)' == 'true' AND ($(HelixTargetQueue.StartsWith('Windows')) OR '$(TargetFrameworkIdentifier)' != '.NETFramework')"
Returns="@(TestPayload)">

<ConvertToAbsolutePath Paths="$(PublishDir)">
<Output TaskParameter="AbsolutePaths" PropertyName="PublishAbsoluteDir" />
</ConvertToAbsolutePath>

<!-- Windows NetCore -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework' AND $(HelixTargetQueue.StartsWith('Windows'))" >
<_CopyItems Include="$(MSBuildThisFileDirectory)test\vstest\runtests.cmd" />
</ItemGroup>

<!-- Windows NetFramework -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' AND $(HelixTargetQueue.StartsWith('Windows'))" >
<_CopyItems Include="$(MSBuildThisFileDirectory)test\xunit\runtests.cmd" />
</ItemGroup>

<!-- NonWindows -->
<ItemGroup Condition="!$(HelixTargetQueue.StartsWith('Windows'))" >
<_CopyItems Include="$(MSBuildThisFileDirectory)test\vstest\runtests.sh" />
</ItemGroup>

<Copy SourceFiles="@(_CopyItems)" DestinationFolder="$(PublishAbsoluteDir)" />

<ItemGroup>
<TestPayload Include="$(PublishAbsoluteDir)">
<TestAssembly>$(TargetFileName)</TestAssembly>
<TestName>$(MSBuildProjectName)-$(TargetFramework)</TestName>
<Command Condition="$(HelixTargetQueue.StartsWith('Windows'))">runtests.cmd $(TargetFileName) $(NETCoreSdkVersion) $(RuntimeFrameworkVersion)</Command>
<Command Condition="!$(HelixTargetQueue.StartsWith('Windows'))">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(RuntimeFrameworkVersion)</Command>
<TestTimeout>00:30:00</TestTimeout>
</TestPayload>
</ItemGroup>
</Target>
</Project>
7 changes: 6 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<configuration>
<packageSources>
<clear />
<!-- Restore sources should be defined in build/sources.props. -->
<!--
Restore sources should be defined in build/sources.props.
The only allowed feeds here are for MSBuild SDKs, which are required to work around
https://github.com/Microsoft/msbuild/issues/2914
-->
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
</packageSources>
</configuration>
11 changes: 11 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ jobs:
parameters:
agentOs: Linux
configuration: Release

- job: Helix
pool:
name: Hosted VS2017
vmImage: vs2017-win2016
steps:
- checkout: self
clean: true
- script: .\build.cmd -ci /t:Helix
displayName: Run build.cmd helix target

10 changes: 10 additions & 0 deletions build/repo.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project InitialTargets="TagCiBuilds">
<PropertyGroup>
<BuildDependsOn Condition="'$(Configuration)' == 'Release' AND '$(OS)' == 'Windows_NT' AND $(PublishType.Contains('blob'))" >$(BuildDependsOn);PublishToProdCon</BuildDependsOn>
<TestDependsOn Condition="'$(UseHelix)' == 'true'">$(TestDependsOn);Helix</TestDependsOn>
</PropertyGroup>

<Target Name="TagCiBuilds" Condition=" '$(CI)' == 'true' AND '$(BUILD_REASON)' != 'PullRequest' ">
Expand Down Expand Up @@ -44,4 +45,13 @@

<WriteLinesToFile File="$(ProjectListFile)" Lines="$(ProjectListContent)" Overwrite="true" />
</Target>

<!-- will move into korebuild -->
<Target Name="Helix" DependsOnTargets="ResolveProjects;Restore">
<MSBuild Projects="$(MSBuildThisFileDirectory)..\test\helix.proj"
Targets="Test"
Properties="ProjectsToTest=$(ProjectToBuildList)"
BuildInParallel="false" />
</Target>

</Project>
16 changes: 15 additions & 1 deletion docs/build-from-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ Configuration | `Debug` or `Release`. Default = `Debug`.
SkipTests | `true` or `false`. When true, builds without running tests.
NoBuild | `true` or `false`. Runs tests without rebuilding.

## Running helix tests

Triggering a helix test run is via the Helix target
```
.\build.cmd /t:Helix

// In the output will be something like this
Results will be available from https://mc.dot.net/#/user/aspnet-extensions/pr~2Faspnet~2Fextensions/ci/20190107.18
```

This will send a helix job which will run all of the test projects on various OS configurations (Windows, OSX, Linux, etc).

For more information on helix see: https://github.com/dotnet/arcade/blob/master/Documentation/AzureDevOps/SendingJobsToHelix.md

## Use the result of your build

After building Extensions from source, you can use these in a project by pointing NuGet to the folder containing the .nupkg files.
Expand Down Expand Up @@ -100,4 +114,4 @@ After building Extensions from source, you can use these in a project by pointin
```

Some features, such as new target frameworks, may require prerelease tooling builds for Visual Studio.
These are available in the [Visual Studio Preview](https://www.visualstudio.com/vs/preview/).
These are available in the [Visual Studio Preview](https://www.visualstudio.com/vs/preview/).
12 changes: 6 additions & 6 deletions src/Caching/Memory/test/CapacityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void DoNotAddEntryIfItExceedsCapacity()
Assert.Equal(4, cache.Size);
}

[Fact]
[Fact(Skip = "https://github.com/aspnet/Extensions/issues/913")]
public async Task DoNotAddIfSizeOverflows()
{
var cache = new MemoryCache(new MemoryCacheOptions
Expand Down Expand Up @@ -144,7 +144,7 @@ public async Task DoNotAddIfSizeOverflows()
Assert.Equal(0, cache.Size);
}

[Fact]
[Fact(Skip = "https://github.com/aspnet/Extensions/issues/913")]
public async Task ExceedsCapacityCompacts()
{
var cache = new MemoryCache(new MemoryCacheOptions
Expand Down Expand Up @@ -237,7 +237,7 @@ public void AddingReplacementWhenTotalSizeExceedsCapacityDoesNotUpdateAndRemoves
Assert.Equal(0, cache.Size);
}

[Fact]
[Fact(Skip = "https://github.com/aspnet/Extensions/issues/913")]
public async Task AddingReplacementWhenTotalSizeExceedsCapacityDoesNotUpdateRemovesOldEntryAndTriggersCompaction()
{
var cache = new MemoryCache(new MemoryCacheOptions
Expand Down Expand Up @@ -306,7 +306,7 @@ public void RemovingEntryDecreasesCacheSize()
Assert.Equal(0, cache.Size);
}

[Fact]
[Fact(Skip = "https://github.com/aspnet/Extensions/issues/913")]
public async Task ExpiringEntryDecreasesCacheSize()
{
var cache = new MemoryCache(new MemoryCacheOptions
Expand Down Expand Up @@ -341,7 +341,7 @@ public async Task ExpiringEntryDecreasesCacheSize()
Assert.Equal(0, cache.Size);
}

[Fact]
[Fact(Skip = "https://github.com/aspnet/Extensions/issues/913")]
public async Task CompactsToLessThanLowWatermarkUsingLRUWhenHighWatermarkExceeded()
{
var testClock = new TestClock();
Expand Down Expand Up @@ -408,4 +408,4 @@ public void NoCompactionWhenNoMaximumEntriesCountSpecified()
Assert.Equal(6, cache.Count);
}
}
}
}
4 changes: 2 additions & 2 deletions src/Caching/Memory/test/TimeExpirationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void AbsoluteExpirationExpires()
Assert.Null(result);
}

[Fact]
[Fact(Skip = "https://github.com/aspnet/Extensions/issues/913")]
public void AbsoluteExpirationExpiresInBackground()
{
var clock = new TestClock();
Expand Down Expand Up @@ -263,4 +263,4 @@ public void SlidingExpirationRenewedByAccessUntilAbsoluteExpiration()
Assert.Null(result);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public MsBuildTargetTest(ITestOutputHelper output)
}
}

[Fact]
[Fact(Skip = "https://github.com/aspnet/Extensions/issues/624")]
public void GeneratesAssemblyAttributeFile()
{
var target = Path.Combine(_solutionRoot.FullName, "src", "Configuration", "Config.UserSecrets", "src", "build", "netstandard2.0", "Microsoft.Extensions.Configuration.UserSecrets.targets");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Reflection;
using System.Resources;
using Microsoft.AspNetCore.Testing;
using Microsoft.AspNetCore.Testing.xunit;
using Microsoft.Extensions.Localization.Internal;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Testing;
Expand All @@ -17,7 +18,8 @@ namespace Microsoft.Extensions.Localization
{
public class ResourceManagerStringLocalizerTest
{
[Fact]
[ConditionalFact]
[OSSkipCondition(OperatingSystems.MacOSX)] // https://github.com/aspnet/Extensions/issues/627
public void EnumeratorCachesCultureWalkForSameAssembly()
{
// Arrange
Expand Down Expand Up @@ -54,7 +56,8 @@ public void EnumeratorCachesCultureWalkForSameAssembly()
Assert.Equal(expectedCallCount, resourceAssembly.ManifestResourceStreamCallCount);
}

[Fact]
[ConditionalFact]
[OSSkipCondition(OperatingSystems.MacOSX)] // https://github.com/aspnet/Extensions/issues/627
public void EnumeratorCacheIsScopedByAssembly()
{
// Arrange
Expand Down Expand Up @@ -169,7 +172,8 @@ public void ResourceManagerStringLocalizer_GetAllStrings_ReturnsExpectedValue(bo
Assert.Equal("TestName", value.Value);
}

[Theory]
[ConditionalTheory]
[OSSkipCondition(OperatingSystems.MacOSX)] // https://github.com/aspnet/Extensions/issues/627
[InlineData(true)]
[InlineData(false)]
public void ResourceManagerStringLocalizer_GetAllStrings_MissingResourceThrows(bool includeParentCultures)
Expand Down
50 changes: 50 additions & 0 deletions test/helix.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project DefaultTargets="Test">

<!-- Version included until we get global.json generation to support this SDK. -->
<Sdk Name="Microsoft.DotNet.Helix.Sdk" Version="1.0.0-beta.19057.4" />

<Target Name="Gather" BeforeTargets="Test">
<ItemGroup>
<ProjectsToTest Include="$(ProjectsToTest)" />
</ItemGroup>
<MSBuild Projects="@(ProjectsToTest)"
Targets="CreateTestPayload"
BuildInParallel="true">
<Output TaskParameter="TargetOutputs" ItemName="TestPayload" />
</MSBuild>
<ItemGroup>
<HelixWorkItem Include="%(TestPayload.TestName)">
<Command>%(TestPayload.Command)</Command>
<PayloadDirectory>%(TestPayload.Identity)</PayloadDirectory>
<Timeout>%(TestPayload.TestTimeout)</Timeout>
</HelixWorkItem>
</ItemGroup>
</Target>

<PropertyGroup>
<!-- TODO: Follow up with helix SDK -->
<SkipInvalidConfigurations>true</SkipInvalidConfigurations>
<HelixSource>pr/aspnet/extensions</HelixSource>
<HelixType>ci</HelixType>
<HelixBuild>private-$(USERNAME)</HelixBuild>
<HelixBuild Condition=" '$(USERNAME)' == '' ">private-$(USER)</HelixBuild>
<HelixBuild Condition=" '$(CI)' == 'true' ">$(BUILD_BUILDNUMBER)</HelixBuild>
<!-- IsExternal is required for .Open helix queues -->
<IsExternal>true</IsExternal>
<Creator>aspnet-extensions</Creator>
<WaitForWorkItemCompletion Condition=" '$(CI)' == 'true' ">true</WaitForWorkItemCompletion>

<!-- HelixTargetQueues>Windows.10.Amd64.Open;OSX.1012.Amd64.Open;Ubuntu.1604.Amd64.Open</HelixTargetQueues> -->
<HelixTargetQueues>Windows.10.Amd64.Open;OSX.1012.Amd64.Open;Ubuntu.1604.Amd64.Open;Ubuntu.1810.Amd64.Open;Centos.7.Amd64.Open;Debian.8.Amd64.Open;Debian.9.Amd64.Open;Fedora.27.Amd64.Open;Fedora.28.Amd64.Open;Redhat.7.Amd64.Open;</HelixTargetQueues>

<!--
xml file found in the work item working directory.
The following file names are accepted:
testResults.xml
test-results.xml
test_results.xml
-->
<EnableXUnitReporter Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">true</EnableXUnitReporter>

</PropertyGroup>
</Project>
13 changes: 13 additions & 0 deletions test/vstest/runtests.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
set target=%1
set sdkVersion=%2
set runtimeVersion=%3
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Version %sdkVersion% -InstallDir %HELIX_CORRELATION_PAYLOAD%\sdk"
powershell.exe -NoProfile -ExecutionPolicy unrestricted -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; &([scriptblock]::Create((Invoke-WebRequest -useb 'https://dot.net/v1/dotnet-install.ps1'))) -Runtime dotnet -Version %runtimeVersion% -InstallDir %HELIX_CORRELATION_PAYLOAD%\sdk"
set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_ROOT="$HELIX_CORRELATION_PAYLOAD/sdk"
set PATH="$DOTNET_ROOT:$PATH"
set DOTNET_MULTILEVEL_LOOKUP=0
set DOTNET_CLI_HOME="$HELIX_CORRELATION_PAYLOAD/home"
%HELIX_CORRELATION_PAYLOAD%\sdk\dotnet vstest %target% --logger:trx


25 changes: 25 additions & 0 deletions test/vstest/runtests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version $2 --install-dir $HELIX_CORRELATION_PAYLOAD/sdk
if [ $? -ne 0 ]; then
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version $2 --install-dir $HELIX_CORRELATION_PAYLOAD/sdk
fi
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --runtime dotnet --version $3 --install-dir $HELIX_CORRELATION_PAYLOAD/sdk
if [ $? -ne 0 ]; then
curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --runtime dotnet --version $3 --install-dir $HELIX_CORRELATION_PAYLOAD/sdk
fi

export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1

# Ensures every invocation of dotnet apps uses the same dotnet.exe
export DOTNET_ROOT="$HELIX_CORRELATION_PAYLOAD/sdk"

# Ensure dotnet comes first on PATH
export PATH="$DOTNET_ROOT:$PATH"

# Prevent fallback to global .NET locations. This ensures our tests use the shared frameworks we specify and don't rollforward to something else that might be installed on the machine
export DOTNET_MULTILEVEL_LOOKUP=0

# Avoid contaminating userprofiles
export DOTNET_CLI_HOME="$HELIX_CORRELATION_PAYLOAD/home"

$HELIX_CORRELATION_PAYLOAD/sdk/dotnet vstest $1 --logger:trx
2 changes: 2 additions & 0 deletions test/xunit/runtests.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set target=%1
xunit.console.exe %target% -xml testResults.xml