Skip to content

Commit

Permalink
ci: Disable "ValidateCodeFormatting" when running on Azure pipelines (#2
Browse files Browse the repository at this point in the history
)

Running "dotnet format" on Azure Pipelines causes the build to hang when the .NET 9 SDK and Nerdbank.GitVersioning is used.
To work around this, disable valodation of code style on Azure Pipelines

See-Also: dotnet/sdk#44951
  • Loading branch information
ap0llo authored Dec 19, 2024
1 parent 9c1814b commit 44eb236
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions build/workflow/Program.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Cake.AzurePipelines.Module;
using Cake.Core;
using Cake.DotNetLocalTools.Module;
using Cake.Frosting;
using Grynwald.SharedBuild;
using Grynwald.SharedBuild.Tasks;

return new CakeHost()
.UseModule<AzurePipelinesModule>()
.UseModule<LocalToolsModule>()
.InstallToolsFromManifest(".config/dotnet-tools.json")
.UseSharedBuild<BuildContext>()
.UseSharedBuild<BuildContext>(taskFilter:
// Running dotnet format on Azure Pipelines when using the .NET 9 SDK and Nerdbank.GitVersioning causes the build to hang
// See: https://github.com/dotnet/sdk/issues/44951
// To work around this, exclude the task when running on Azure Pipelines
task =>
{
if (StringComparer.OrdinalIgnoreCase.Equals(Environment.GetEnvironmentVariable("TF_BUILD"), "true") &&
task == typeof(ValidateCodeFormattingTask))
{
return false;
}

return true;
}
)
.Run(args);

public class BuildContext(ICakeContext context) : DefaultBuildContext(context)
Expand Down

0 comments on commit 44eb236

Please sign in to comment.