Skip to content

Commit

Permalink
updated editorconfig and format settings (#1677)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-driscoll authored Nov 29, 2023
1 parent 833d146 commit 81a8ed3
Show file tree
Hide file tree
Showing 19 changed files with 3,927 additions and 1,034 deletions.
20 changes: 15 additions & 5 deletions .build/Build.CI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@
ExcludedTargets = new[] { nameof(ICanClean.Clean), nameof(ICanRestoreWithDotNetCore.DotnetToolRestore) },
Enhancements = new[] { nameof(CiMiddleware) }
)]
[GitHubActionsLint(
"lint",
GitHubActionsImage.UbuntuLatest,
AutoGenerate = false,
OnPullRequestTargetBranches = new[] { "master", "main", "next" },
Enhancements = new[] { nameof(LintStagedMiddleware) }
)]
[PrintBuildVersion]
[PrintCIEnvironment]
[UploadLogs]
Expand Down Expand Up @@ -69,15 +76,18 @@ public static RocketSurgeonGitHubActionsConfiguration CiMiddleware(RocketSurgeon
.UseDotNetSdks("6.0", "8.0")
.AddNuGetCache()
.ConfigureStep<CheckoutStep>(step => step.FetchDepth = 0)
.PublishLogs<Pipeline>()
.FailFast = false;
.PublishLogs<Pipeline>();

return configuration;
}

private static int GetCheckStepIndex(RocketSurgeonsGithubActionsJob job)
public static RocketSurgeonGitHubActionsConfiguration LintStagedMiddleware(RocketSurgeonGitHubActionsConfiguration configuration)
{
var checkoutStep = job.Steps.OfType<CheckoutStep>().SingleOrDefault();
return checkoutStep is null ? 1 : job.Steps.IndexOf(checkoutStep);
configuration
.Jobs.OfType<RocketSurgeonsGithubActionsJob>()
.First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase))
.UseDotNetSdks("6.0", "8.0");

return configuration;
}
}
48 changes: 16 additions & 32 deletions .build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
[MSBuildVerbosityMapping]
[NuGetVerbosityMapping]
[ShutdownDotNetAfterServerBuild]
[LocalBuildConventions]
public partial class Pipeline : NukeBuild,
ICanRestoreWithDotNetCore,
ICanBuildWithDotNetCore,
Expand All @@ -27,10 +28,15 @@ public partial class Pipeline : NukeBuild,
IHaveNuGetPackages,
IHaveDataCollector,
ICanClean,
ICanLintStagedFiles,
ICanDotNetFormat,
ICanPrettier,
// IHavePublicApis,
ICanUpdateReadme,
IGenerateCodeCoverageReport,
IGenerateCodeCoverageSummary,
IGenerateCodeCoverageBadges,
ICanRegenerateBuildConfiguration,
IHaveConfiguration<Configuration>
{
/// <summary>
Expand All @@ -45,48 +51,26 @@ public static int Main()
return Execute<Pipeline>(x => x.Default);
}

public static int FindFreePort()
{
var port = 0;
var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
try
{
var localEP = new IPEndPoint(IPAddress.Any, 0);
socket.Bind(localEP);
localEP = (IPEndPoint)socket.LocalEndPoint;
port = localEP.Port;
}
finally
{
socket.Close();
}

return port;
}

public Target Pack => _ => _.Inherit<ICanPackWithDotNetCore>(x => x.CorePack)
.DependsOn(Clean);

public Target BuildVersion => _ => _.Inherit<IHaveBuildVersion>(x => x.BuildVersion)
.Before(Default)
.Before(Clean);

[OptionalGitRepository] public GitRepository? GitRepository { get; }

private Target Default => _ => _
.DependsOn(Restore)
.DependsOn(Build)
.DependsOn(Test)
.DependsOn(Pack);

[Solution(GenerateProjects = true)] private Solution Solution { get; } = null!;

public Target Build => _ => _.Inherit<ICanBuildWithDotNetCore>(x => x.CoreBuild);

public Target Clean => _ => _.Inherit<ICanClean>(x => x.Clean);
public Target Pack => _ => _.Inherit<ICanPackWithDotNetCore>(x => x.CorePack)
.DependsOn(Clean);

public Target Clean => _ => _.Inherit<ICanClean>(x => x.Clean);
public Target Lint => _ => _.Inherit<ICanLint>(x => x.Lint);
public Target Restore => _ => _.Inherit<ICanRestoreWithDotNetCore>(x => x.CoreRestore);
public Target Test => _ => _.Inherit<ICanTestWithDotNetCore>(x => x.CoreTest);

[Solution(GenerateProjects = true)] private Solution Solution { get; } = null!;
Nuke.Common.ProjectModel.Solution IHaveSolution.Solution => Solution;

[OptionalGitRepository] public GitRepository? GitRepository { get; }
[ComputedGitVersion] public GitVersion GitVersion { get; } = null!;
public Target Test => _ => _.Inherit<ICanTestWithDotNetCore>(x => x.CoreTest);
[Parameter("Configuration to build")] public Configuration Configuration { get; } = IsLocalBuild ? Configuration.Debug : Configuration.Release;
}
8 changes: 4 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"version": "2023.2.3",
"commands": ["jb"]
},
"dotnet-format": {
"version": "5.1.250801",
"commands": ["dotnet-format"]
},
"nukeeper": {
"version": "0.35.0",
"commands": ["nukeeper"]
},
"docfx": {
"version": "2.73.2",
"commands": ["docfx"]
},
"strawberryshake.tools": {
"version": "13.7.0",
"commands": ["dotnet-graphql"]
Expand Down
Loading

0 comments on commit 81a8ed3

Please sign in to comment.