diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index de34b365..5e8d0958 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -79,7 +79,7 @@ jobs: ++$count; dotnet nuget push .\windows-latest\*.nupkg --source GitHub --skip-duplicate; } - while ($count -lt 30 -and $LastExitCode -ne 0) + while ($count -lt 1000 -and $LastExitCode -ne 0) shell: pwsh push-nuget: diff --git a/Source/Boxed.DotnetNewTest/ConfigurationService.cs b/Source/Boxed.DotnetNewTest/ConfigurationService.cs index 182b16b2..54abc674 100644 --- a/Source/Boxed.DotnetNewTest/ConfigurationService.cs +++ b/Source/Boxed.DotnetNewTest/ConfigurationService.cs @@ -9,6 +9,11 @@ namespace Boxed.DotnetNewTest /// public static class ConfigurationService { + /// + /// Gets or sets the default timeout period. + /// + public static TimeSpan DefaultTimeout { get; set; } = TimeSpan.FromMinutes(2); + /// /// Gets the temporary directory path. /// diff --git a/Source/Boxed.DotnetNewTest/DotnetNew.cs b/Source/Boxed.DotnetNewTest/DotnetNew.cs index fa42292f..ada936a3 100644 --- a/Source/Boxed.DotnetNewTest/DotnetNew.cs +++ b/Source/Boxed.DotnetNewTest/DotnetNew.cs @@ -63,7 +63,7 @@ public static async Task InstallAsync(string source, TimeSpan? timeout = null, b throw new ArgumentNullException(nameof(source)); } - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await ProcessExtensions .StartAsync( @@ -84,7 +84,7 @@ await ProcessExtensions /// A representing the asynchronous operation. public static async Task ReinitialiseAsync(TimeSpan? timeout = null, bool showShellWindow = false) { - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await ProcessExtensions .StartAsync( diff --git a/Source/Boxed.DotnetNewTest/ProjectExtensions.cs b/Source/Boxed.DotnetNewTest/ProjectExtensions.cs index ab9c4d49..cafbb4f8 100644 --- a/Source/Boxed.DotnetNewTest/ProjectExtensions.cs +++ b/Source/Boxed.DotnetNewTest/ProjectExtensions.cs @@ -5,7 +5,6 @@ namespace Boxed.DotnetNewTest using System.Linq; using System.Net.Http; using System.Net.Security; - using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; @@ -41,7 +40,7 @@ public static async Task DotnetRestoreAsync( throw new ArgumentNullException(nameof(project)); } - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await AssertStartAsync( project.DirectoryPath, @@ -73,7 +72,7 @@ public static async Task DotnetBuildAsync( } var noRestoreArgument = noRestore is null ? null : "--no-restore"; - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await AssertStartAsync( project.DirectoryPath, @@ -105,7 +104,7 @@ public static async Task DotnetTestAsync( } var noRestoreArgument = noRestore is null ? null : "--no-restore"; - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await AssertStartAsync( project.DirectoryPath, @@ -134,7 +133,7 @@ public static async Task DotnetToolRestoreAsync( throw new ArgumentNullException(nameof(project)); } - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await AssertStartAsync( project.DirectoryPath, @@ -166,7 +165,7 @@ public static async Task DotnetCakeAsync( } var targetArgument = target is null ? null : $"--target={target}"; - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await AssertStartAsync( project.DirectoryPath, @@ -205,7 +204,7 @@ public static async Task DotnetPublishAsync( var runtimeArgument = runtime is null ? null : $"--self-contained --runtime {runtime}"; var noRestoreArgument = noRestore is null ? null : "--no-restore"; DirectoryExtensions.CheckCreate(project.PublishDirectoryPath); - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await AssertStartAsync( project.DirectoryPath, diff --git a/Source/Boxed.DotnetNewTest/TempDirectoryExtensions.cs b/Source/Boxed.DotnetNewTest/TempDirectoryExtensions.cs index d3e27522..f3df3bbd 100644 --- a/Source/Boxed.DotnetNewTest/TempDirectoryExtensions.cs +++ b/Source/Boxed.DotnetNewTest/TempDirectoryExtensions.cs @@ -50,7 +50,7 @@ public static async Task DotnetNewAsync( } } - using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1))) + using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? ConfigurationService.DefaultTimeout)) { await ProcessExtensions .StartAsync(