Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"cake.tool": {
"version": "2.0.0",
"version": "3.0.0",
"commands": [
"dotnet-cake"
]
Expand Down
7 changes: 2 additions & 5 deletions .github/ISSUE_TEMPLATE/how-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@ about: You have something specific to achieve and the existing documentation has
<!--
Be sure to check out the ReadMe (https://github.com/App-vNext/Polly/blob/main/README.md) and wiki (https://github.com/App-vNext/Polly/wiki) first!

https://github.com/App-vNext/Polly/wiki contains detailed pages on each policy type. Many questions are answered there about policy operation, how to change operation with configuration options, and how to attach behaviour via delegates. Other wiki pages cover [unit-testing](https://github.com/App-vNext/Polly/wiki/Unit-testing-with-Polly), [async usage](https://github.com/App-vNext/Polly/wiki/Asynchronous-action-execution), common patterns, and [using HttpClientFactory in ASPNET Core2.1 as the best way to integrate Polly into outbound `HttpClient` calls](https://github.com/App-vNext/Polly/wiki/Polly-and-HttpClientFactory).
https://github.com/App-vNext/Polly/wiki contains detailed pages on each policy type. Many questions are answered there about policy operation, how to change operation with configuration options, and how to attach behaviour via delegates. Other wiki pages cover [unit-testing](https://github.com/App-vNext/Polly/wiki/Unit-testing-with-Polly), [async usage](https://github.com/App-vNext/Polly/wiki/Asynchronous-action-execution), common patterns, and [using HttpClientFactory in ASP.NET Core 2.1 as the best way to integrate Polly into outbound `HttpClient` calls](https://github.com/App-vNext/Polly/wiki/Polly-and-HttpClientFactory).

-->


**Summary: What are you wanting to achieve?**


**What code or approach do you have so far?**


It is _always_ useful to see:

+ **code of any policy declarations**,
+ **code of any policy declarations**,
+ **code of the calls to `.Execute/AndCapture/Async(...)`**
8 changes: 8 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
Expand All @@ -44,6 +46,12 @@ jobs:
NUGET_XMLDOC_MODE: skip
TERM: xterm

- uses: codecov/codecov-action@v3
name: Upload coverage to Codecov
with:
file: ./src/Polly.Specs/coverage-reports/Cobertura.xml
flags: ${{ matrix.os_name }}

- name: Publish NuGet packages
uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,6 @@ tools
*.lock.json
*.nuget.targets
*.nuget.props
coverage.*.cobertura.xml
coverage.*.json
coverage-reports/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ We are a member of the [.NET Foundation](https://www.dotnetfoundation.org/about)

**Keep up to date with new feature announcements, tips & tricks, and other news through [www.thepollyproject.org](http://www.thepollyproject.org)**

[![NuGet version](https://badge.fury.io/nu/polly.svg)](https://badge.fury.io/nu/polly) [![Build status](https://github.com/App-vNext/Polly/workflows/build/badge.svg?branch=main&event=push)](https://github.com/App-vNext/Polly/actions?query=workflow%3Abuild+branch%3Amain+event%3Apush) [![Slack Status](http://www.pollytalk.org/badge.svg)](http://www.pollytalk.org)
[![NuGet version](https://badge.fury.io/nu/polly.svg)](https://badge.fury.io/nu/polly) [![Build status](https://github.com/App-vNext/Polly/workflows/build/badge.svg?branch=main&event=push)](https://github.com/App-vNext/Polly/actions?query=workflow%3Abuild+branch%3Amain+event%3Apush) [![Code coverage](https://codecov.io/gh/App-vNext/Polly/branch/main/graph/badge.svg)](https://codecov.io/gh/App-vNext/Polly) [![Slack Status](http://www.pollytalk.org/badge.svg)](http://www.pollytalk.org)

![Polly logo](https://raw.github.com/App-vNext/Polly/main/Polly-Logo.png)

Expand Down
77 changes: 33 additions & 44 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ var configuration = Argument<string>("configuration", "Release");
// EXTERNAL NUGET TOOLS
//////////////////////////////////////////////////////////////////////

#Tool "GitVersion.CommandLine&version=5.8.1"
#Tool "xunit.runner.console&version=2.4.1"
#Tool "GitVersion.CommandLine&version=5.11.1"
#Tool "xunit.runner.console&version=2.4.2"

//////////////////////////////////////////////////////////////////////
// EXTERNAL NUGET LIBRARIES
//////////////////////////////////////////////////////////////////////

#addin nuget:?package=Cake.FileHelpers&version=5.0.0
#addin nuget:?package=Cake.Yaml&version=4.0.0
#addin nuget:?package=Newtonsoft.Json&version=13.0.1
#addin nuget:?package=YamlDotNet&version=11.2.1
#addin nuget:?package=Cake.FileHelpers&version=6.0.0
#addin nuget:?package=Cake.Yaml&version=6.0.0
#addin nuget:?package=Newtonsoft.Json&version=13.0.2
#addin nuget:?package=YamlDotNet&version=12.3.1

///////////////////////////////////////////////////////////////////////////////
// GLOBAL VARIABLES
Expand Down Expand Up @@ -158,64 +158,47 @@ Task("__UpdateAssemblyVersionInformation")
Information("AssemblyInformationalVersion -> {0}", assemblySemver);
});

Task("__UpdateDotNetStandardAssemblyVersionNumber")
.WithCriteria(() => AppVeyor.IsRunningOnAppVeyor)
.Does(() =>
{
Information("Updating Assembly Version Information");

var attributeToValueMap = new Dictionary<string, string>()
{
{ "AssemblyVersion", assemblyVersion },
{ "FileVersion", assemblySemver },
{ "InformationalVersion", assemblySemver },
{ "Version", nugetVersion },
{ "PackageVersion", nugetVersion },
{ "ContinuousIntegrationBuild", "true" },
};

var csproj = File("./src/" + projectName + "/" + projectName + ".csproj");

foreach(var attributeMap in attributeToValueMap)
{
var attribute = attributeMap.Key;
var value = attributeMap.Value;

var replacedFiles = ReplaceRegexInFiles(csproj, $@"\<{attribute}\>[^\<]*\</{attribute}\>", $@"<{attribute}>{value}</{attribute}>");
if (!replacedFiles.Any())
{
throw new Exception($"{attribute} version could not be updated in {csproj}.");
}
}
});

Task("__BuildSolutions")
.Does(() =>
{
foreach(var solution in solutions)
{
Information("Building {0}", solution);

var dotNetCoreBuildSettings = new DotNetBuildSettings
var dotNetBuildSettings = new DotNetBuildSettings
{
Configuration = configuration,
Verbosity = DotNetCoreVerbosity.Minimal,
Verbosity = DotNetVerbosity.Minimal,
NoRestore = true,
MSBuildSettings = new DotNetMSBuildSettings { TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error },
MSBuildSettings = new DotNetMSBuildSettings
{
AssemblyVersion = assemblyVersion,
FileVersion = assemblySemver,
TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error,
Version = nugetVersion,
},
};

DotNetBuild(solution.ToString(), dotNetCoreBuildSettings);
DotNetBuild(solution.ToString(), dotNetBuildSettings);
}
});

Task("__RunTests")
.Does(() =>
{
var loggers = Array.Empty<string>();

if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("GITHUB_SHA")))
{
loggers = new[] { "GitHubActions;report-warnings=false" };
}

foreach(var specsProj in GetFiles("./src/**/*.Specs.csproj"))
{
DotNetTest(specsProj.FullPath, new DotNetTestSettings
{
Configuration = configuration,
Loggers = loggers,
NoBuild = true,
});
}
Expand All @@ -228,14 +211,21 @@ Task("__CreateSignedNuGetPackage")

Information("Building {0}.{1}.nupkg", packageName, nugetVersion);

var dotNetCorePackSettings = new DotNetPackSettings
var dotNetPackSettings = new DotNetPackSettings
{
Configuration = configuration,
NoBuild = true,
OutputDirectory = nupkgDestDir,
MSBuildSettings = new DotNetMSBuildSettings
{
AssemblyVersion = assemblyVersion,
FileVersion = assemblySemver,
TreatAllWarningsAs = MSBuildTreatAllWarningsAs.Error,
Version = nugetVersion,
},
};

DotNetPack(System.IO.Path.Combine(srcDir, projectName + ".sln"), dotNetCorePackSettings);
DotNetPack(System.IO.Path.Combine(srcDir, projectName + ".sln"), dotNetPackSettings);
});

//////////////////////////////////////////////////////////////////////
Expand All @@ -246,7 +236,6 @@ Task("Build")
.IsDependentOn("__Clean")
.IsDependentOn("__RestoreNuGetPackages")
.IsDependentOn("__UpdateAssemblyVersionInformation")
.IsDependentOn("__UpdateDotNetStandardAssemblyVersionNumber")
.IsDependentOn("__BuildSolutions")
.IsDependentOn("__RunTests")
.IsDependentOn("__CreateSignedNuGetPackage");
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ if (-Not $SkipToolPackageRestore.IsPresent)
# Install just Cake if missing config
else
{
$NuGetOutput = Invoke-Expression "&`"$DOTNET`" tool install Cake.Tool --version 2.0.0"
$NuGetOutput = Invoke-Expression "&`"$DOTNET`" tool install Cake.Tool --version 3.0.0"
Write-Verbose ($NuGetOutput | Out-String)
}
Pop-Location
Expand Down
4 changes: 2 additions & 2 deletions src/Polly.Benchmarks/Polly.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.3" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
</ItemGroup>
<ItemGroup Condition=" '$(BenchmarkFromNuGet)' != 'True' ">
<ProjectReference Include="..\Polly\Polly.csproj" />
Expand Down
27 changes: 18 additions & 9 deletions src/Polly.Specs/Polly.Specs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net6.0</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net461;net472</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">$(TargetFrameworks);net472</TargetFrameworks>
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
</PropertyGroup>

Expand All @@ -11,23 +11,32 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.2" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="6.5.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Moq" Version="4.18.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" PrivateAssets="all" />
<PackageReference Include="coverlet.msbuild" Version="3.2.0" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="6.8.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="ReportGenerator" Version="5.1.13" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" PrivateAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)'=='net461' or '$(TargetFramework)'=='net472'">
<ItemGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) == '.NETFramework'">
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<PropertyGroup Condition="'$(TargetFramework)'!='net461' and '$(TargetFramework)'!='net472'">
<PropertyGroup Condition="$([MSBuild]::GetTargetFrameworkIdentifier('$(TargetFramework)')) != '.NETFramework'">
<CollectCoverage>true</CollectCoverage>
<CoverletOutputFormat>cobertura</CoverletOutputFormat>
<Exclude>[xunit.*]*</Exclude>
<ExcludeByAttribute>System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute</ExcludeByAttribute>
<Threshold>75,60,70</Threshold>
</PropertyGroup>

<Target Name="GenerateCoverageReports" AfterTargets="GenerateCoverageResultAfterTest" Condition=" '$(CollectCoverage)' == 'true' ">
<ReportGenerator ReportFiles="@(CoverletReport)"
ReportTypes="Cobertura;Html"
TargetDirectory="$([System.IO.Path]::Combine($(MSBuildThisFileDirectory), 'coverage-reports'))" />
</Target>

</Project>
4 changes: 2 additions & 2 deletions src/Polly/Polly.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<FileVersion>7.2.4.0</FileVersion>
<InformationalVersion>7.2.4.0</InformationalVersion>
<PackageVersion>7.2.4</PackageVersion>
<Company>App vNext</Company>
<Copyright>Copyright (c) $([System.DateTime]::Now.ToString(yyyy)), App vNext</Copyright>
<Description>Polly is a library that allows developers to express resilience and transient fault handling policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner.</Description>
Expand All @@ -16,7 +15,8 @@
<Authors>Michael Wolfenden, App vNext</Authors>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<EmbedUntrackedSources>true</EmbedUntrackedSources> <!-- EmbedUntrackedSources for deterministic build -->
<ContinuousIntegrationBuild>false</ContinuousIntegrationBuild>
<ContinuousIntegrationBuild Condition=" '$(CI)' != '' ">true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Label="SourceLink">
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand Down