-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* use ci for build server * Automatically linting code --------- Co-authored-by: david-driscoll <david-driscoll@users.noreply.github.com>
- Loading branch information
1 parent
d9d9531
commit 34e03e3
Showing
16 changed files
with
153 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System.Reflection; | ||
using Nuke.Common.CI.GitHubActions; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.Tooling; | ||
using Nuke.Common.Tools.Git; | ||
using Rocket.Surgery.Nuke.DotNetCore; | ||
using Serilog; | ||
|
||
namespace Rocket.Surgery.Nuke; | ||
|
||
/// <summary> | ||
/// Allows the build to lint staged files, as well as lint files from a given pull request. | ||
/// </summary> | ||
/// <remarks> | ||
/// uses the lint-staged npm package under the covers, with dotnet nuke lint-staged as the entry point. | ||
/// </remarks> | ||
public interface ICanLintStagedFiles : INukeBuild | ||
{ | ||
/// <summary> | ||
/// Run staged lint tasks | ||
/// </summary> | ||
public Target LintStaged => t => | ||
t | ||
.Executes( | ||
() => ProcessTasks.StartProcess( | ||
ToolPathResolver.GetPathExecutable("npx"), | ||
GitHubActions.Instance.IsPullRequest() ? $"lint-staged -r --diff=\"origin/{GitHubActions.Instance.BaseRef}...origin/{GitHubActions.Instance.HeadRef}\"" : "lint-staged -r", | ||
environmentVariables: EnvironmentInfo.Variables | ||
.AddIfMissing("NUKE_INTERNAL_INTERCEPTOR", "1") | ||
// ReSharper disable once NullableWarningSuppressionIsUsed | ||
.AddIfMissing("NUKE_BUILD_ASSEMBLY", RootDirectory.GetRelativePathTo(Assembly.GetEntryAssembly()!.Location)), | ||
logOutput: true, | ||
logger: (type, s) => | ||
{ | ||
if (type == OutputType.Std) | ||
{ | ||
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem | ||
Log.Information(s); | ||
} | ||
else | ||
{ | ||
// ReSharper disable once TemplateIsNotCompileTimeConstantProblem | ||
Log.Error(s); | ||
} | ||
} | ||
).AssertWaitForExit().AssertZeroExitCode() | ||
) | ||
.Executes( | ||
() => | ||
{ | ||
GitTasks.Git("add .nuke/build.schema.json"); | ||
GitTasks.Git("add .github/workflows/*.yml"); | ||
if (this is IHavePublicApis) | ||
{ | ||
GitTasks.Git("add *PublicAPI.Shipped.txt *PublicAPI.Unshipped.txt"); | ||
} | ||
} | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.