Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/update apis #1002

Merged
merged 2 commits into from
Nov 21, 2023
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 .build/Build.CI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
[UploadLogs]
[TitleEvents]
[ContinuousIntegrationConventions]
public partial class Pipeline

Check warning on line 74 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / lint

The type name Pipeline conflicts in whole or in part with the namespace name 'Azure.Core.Pipeline'. Change either name to eliminate the conflict. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1724)

Check warning on line 74 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

The type name Pipeline conflicts in whole or in part with the namespace name 'Azure.Core.Pipeline'. Change either name to eliminate the conflict. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1724)

Check warning on line 74 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

The type name Pipeline conflicts in whole or in part with the namespace name 'Azure.Core.Pipeline'. Change either name to eliminate the conflict. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1724)

Check warning on line 74 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type name Pipeline conflicts in whole or in part with the namespace name 'Azure.Core.Pipeline'. Change either name to eliminate the conflict. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1724)

Check warning on line 74 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The type name Pipeline conflicts in whole or in part with the namespace name 'Azure.Core.Pipeline'. Change either name to eliminate the conflict. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1724)

Check warning on line 74 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type name Pipeline conflicts in whole or in part with the namespace name 'Azure.Core.Pipeline'. Change either name to eliminate the conflict. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1724)

Check warning on line 74 in .build/Build.CI.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The type name Pipeline conflicts in whole or in part with the namespace name 'Azure.Core.Pipeline'. Change either name to eliminate the conflict. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1724)
{
public static RocketSurgeonGitHubActionsConfiguration CiIgnoreMiddleware(RocketSurgeonGitHubActionsConfiguration configuration)
{
Expand Down Expand Up @@ -110,7 +110,7 @@
.First(z => z.Name.Equals("Build", StringComparison.OrdinalIgnoreCase))
.UseDotNetSdks("6.0", "8.0")
.AddNuGetCache()
// .ConfigureForGitVersion()
// .ConfigureForGitVersion()
.ConfigureStep<CheckoutStep>(step => step.FetchDepth = 0)
.PublishLogs<Pipeline>();

Expand Down
3 changes: 3 additions & 0 deletions .build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
[NuGetVerbosityMapping]
[ShutdownDotNetAfterServerBuild]
[LocalBuildConventions]
#pragma warning disable CA1050
public partial class Pipeline : NukeBuild,
#pragma warning restore CA1050
ICanRestoreWithDotNetCore,
ICanBuildWithDotNetCore,
ICanTestWithDotNetCore,
Expand All @@ -35,6 +37,7 @@
IGenerateCodeCoverageReport,
IGenerateCodeCoverageSummary,
IGenerateCodeCoverageBadges,
ICanRegenerateBuildConfiguration,
IHaveConfiguration<Configuration>
{
/// <summary>
Expand Down Expand Up @@ -67,7 +70,7 @@
public Target Test => _ => _.Inherit<ICanTestWithDotNetCore>(x => x.CoreTest);

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

Check warning on line 73 in .build/Build.cs

View workflow job for this annotation

GitHub Actions / lint

Make 'Pipeline' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'Rocket.Surgery.Nuke.IHaveSolution.get_Solution' and is visible to derived classes (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033)

Check warning on line 73 in .build/Build.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Make 'Pipeline' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'Rocket.Surgery.Nuke.IHaveSolution.get_Solution' and is visible to derived classes (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033)

Check warning on line 73 in .build/Build.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Make 'Pipeline' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'Rocket.Surgery.Nuke.IHaveSolution.get_Solution' and is visible to derived classes (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033)

Check warning on line 73 in .build/Build.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Make 'Pipeline' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'Rocket.Surgery.Nuke.IHaveSolution.get_Solution' and is visible to derived classes (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033)

Check warning on line 73 in .build/Build.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Make 'Pipeline' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'Rocket.Surgery.Nuke.IHaveSolution.get_Solution' and is visible to derived classes (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033)

Check warning on line 73 in .build/Build.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Make 'Pipeline' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'Rocket.Surgery.Nuke.IHaveSolution.get_Solution' and is visible to derived classes (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033)

Check warning on line 73 in .build/Build.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Make 'Pipeline' sealed (a breaking change if this class has previously shipped), implement the method non-explicitly, or implement a new method that exposes the functionality of 'Rocket.Surgery.Nuke.IHaveSolution.get_Solution' and is visible to derived classes (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1033)
[ComputedGitVersion] public GitVersion GitVersion { get; } = null!;
[OptionalGitRepository] public GitRepository? GitRepository { get; }
[Parameter] public string? GitHubToken { get; }
Expand Down
1 change: 0 additions & 1 deletion .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ if (!process.env.NUKE_BUILD_ASSEMBLY) {

module.exports = {
'!(*verified|*received).cs': filenames => [`dotnet ${process.env.NUKE_BUILD_ASSEMBLY} lint --lint-files ${filenames.join(' ')}`],
'*.{Shipped.txt,Unshipped.txt}': filenames => [`dotnet ${process.env.NUKE_BUILD_ASSEMBLY} move-unshipped-to-shipped --lint-files ${filenames.join(' ')}`],
'*.{csproj,targets,props,xml}': filenames => [`prettier --write '${filenames.join(`' '`)}`],
'*.{js,ts,jsx,tsx,json,yml,yaml}': filenames => [`prettier --write '${filenames.join(`' '`)}`],
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"prettier": "^3.0.0"
},
"scripts": {
"prepare": "husky install"
"husky": "husky install"
},
"dependencies": {
"which": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion src/Nuke/DotNetCore/ICanDotNetFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
d
.TriggeredBy(PostLint)
.After(Lint)
.OnlyWhenStatic(() => IsLocalBuild)
.OnlyWhenStatic(() => IsLocalBuild || LintPaths.Any())

Check warning on line 22 in src/Nuke/DotNetCore/ICanDotNetFormat.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/DotNetCore/ICanDotNetFormat.cs#L22

Added line #L22 was not covered by tests
.Executes(
() => LintPaths.Any()
? DotNetTasks.DotNet($"format --severity {DotNetFormatSeverity} --include {string.Join(",", LintPaths)}")
Expand Down
12 changes: 7 additions & 5 deletions src/Nuke/EnsureGitHooksAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,17 @@
if (( NukeBuild.RootDirectory / "package.json" ).FileExists() && !NukeBuild.RootDirectory.ContainsDirectory("node_modules"))
{
Log.Information("package.json found running npm install to see if that installs any hooks");
ProcessTasks.StartProcess(ToolPathResolver.GetPathExecutable("npm"), "install", workingDirectory: NukeBuild.RootDirectory)
ProcessTasks.StartProcess(ToolPathResolver.GetPathExecutable("npm"), NukeBuild.IsLocalBuild ? "install" : "ci", workingDirectory: NukeBuild.RootDirectory)
.AssertWaitForExit()
.AssertZeroExitCode();
ProcessTasks.StartProcess(ToolPathResolver.GetPathExecutable("npm"), "run prepare", workingDirectory: NukeBuild.RootDirectory)
.AssertWaitForExit();
}
}

private class HuskyEngine : IGitHooksEngine
{
public bool AreHooksInstalled(IReadOnlyCollection<string> hooks)
{
if (NukeBuild.IsServerBuild) return true;
try
{
var hooksOutput = GitTasks.Git($"config --get core.hookspath", logOutput: false, logInvocation: false);
Expand All @@ -96,8 +95,11 @@
ProcessTasks.StartProcess(ToolPathResolver.GetPathExecutable("npm"), "install", workingDirectory: NukeBuild.RootDirectory)
.AssertWaitForExit()
.AssertZeroExitCode();
ProcessTasks.StartProcess(ToolPathResolver.GetPathExecutable("npm"), "run prepare", workingDirectory: NukeBuild.RootDirectory)
.AssertWaitForExit();
if (NukeBuild.IsLocalBuild)
{
ProcessTasks.StartProcess(ToolPathResolver.GetPathExecutable("npm"), "run husky", workingDirectory: NukeBuild.RootDirectory)
.AssertWaitForExit();
}

Check warning on line 102 in src/Nuke/EnsureGitHooksAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/EnsureGitHooksAttribute.cs#L99-L102

Added lines #L99 - L102 were not covered by tests
}

if (!AreHooksInstalled(hooks))
Expand Down
8 changes: 8 additions & 0 deletions src/Nuke/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.ObjectModel;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.IO;
using Nuke.Common.Tools.ReportGenerator;
using Nuke.Common.Utilities.Collections;
Expand Down Expand Up @@ -57,6 +58,13 @@ public static T SetReports<T>(this T toolSettings, IEnumerable<AbsolutePath> rep
return toolSettings.SetReports(reports.Select(z => z.ToString()).ToArray());
}

/// <summary>
/// Determine if there is a pullrequest happening or not.
/// </summary>
/// <param name="actions"></param>
/// <returns></returns>
public static bool IsPullRequest(this GitHubActions? actions) => actions?.EventName is "pull_request" or "pull_request_target";

/// <summary>
/// Add a value to the dictionary if it's missing
/// </summary>
Expand Down
5 changes: 3 additions & 2 deletions src/Nuke/GithubActions/GitHubActionsLintAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,16 @@
.ConfigureStep<CheckoutStep>(
step =>
{
step.FetchDepth = 0;

Check warning on line 64 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/GithubActions/GitHubActionsLintAttribute.cs#L64

Added line #L64 was not covered by tests
step.Repository = "${{ github.event.pull_request.head.repo.full_name }}";
step.Ref = "${{ github.event.pull_request.head.ref }}";
}
)
.AddStep(
new UsingStep("Add & Commit")
{
Uses = "EndBug/add-and-commit@v9",
With = { ["message"] = "Automatically linting code", }
Uses = "stefanzweifel/git-auto-commit-action@v5",
With = { ["commit_message"] = "Automatically linting code", }

Check warning on line 73 in src/Nuke/GithubActions/GitHubActionsLintAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/GithubActions/GitHubActionsLintAttribute.cs#L72-L73

Added lines #L72 - L73 were not covered by tests
}
);

Expand Down
8 changes: 4 additions & 4 deletions src/Nuke/GithubActions/GitHubActionsStepsAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@

var environmentVariables =
GetAllSecrets(secrets)
// ReSharper disable once CoVariantArrayConversion
// ReSharper disable once CoVariantArrayConversion

Check warning on line 142 in src/Nuke/GithubActions/GitHubActionsStepsAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/GithubActions/GitHubActionsStepsAttribute.cs#L142

Added line #L142 was not covered by tests
.Concat<ITriggerValue>(variables)
// ReSharper disable once CoVariantArrayConversion
// ReSharper disable once CoVariantArrayConversion

Check warning on line 144 in src/Nuke/GithubActions/GitHubActionsStepsAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/GithubActions/GitHubActionsStepsAttribute.cs#L144

Added line #L144 was not covered by tests
.Concat(environmentAttributes)
.SelectMany(
z =>
Expand Down Expand Up @@ -183,8 +183,8 @@
var lookupTable = new LookupTable<ExecutableTarget, ExecutableTarget[]>();
foreach (var (execute, targets) in relevantTargets
.Select(
x => ( ExecutableTarget: x,
Targets: GetInvokedTargets(x, relevantTargets).ToArray() )
x => (ExecutableTarget: x,
Targets: GetInvokedTargets(x, relevantTargets).ToArray())

Check warning on line 187 in src/Nuke/GithubActions/GitHubActionsStepsAttribute.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/GithubActions/GitHubActionsStepsAttribute.cs#L186-L187

Added lines #L186 - L187 were not covered by tests
)
.ForEachLazy(x => lookupTable.Add(x.ExecutableTarget, x.Targets.ToArray()))
)
Expand Down
2 changes: 1 addition & 1 deletion src/Nuke/GithubActions/UsingStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
With?.Add(
transformName(property.Name), value switch
{
null => "",
null => string.Empty,

Check warning on line 46 in src/Nuke/GithubActions/UsingStep.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/GithubActions/UsingStep.cs#L46

Added line #L46 was not covered by tests
bool b => b.ToString().ToLowerInvariant(),
string s => s,
_ => value.ToString() ?? ""
Expand Down
62 changes: 0 additions & 62 deletions src/Nuke/ICanLint.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
using System.Reflection;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.IO;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.Git;
using Nuke.Common.Utilities.Collections;
using Serilog;

namespace Rocket.Surgery.Nuke;

Expand Down Expand Up @@ -36,60 +31,3 @@ public interface ICanLint : INukeBuild
/// </summary>
protected internal IEnumerable<AbsolutePath> LintPaths => PrivateLintFiles.Select(z => Path.IsPathRooted(z) ? (AbsolutePath)z : RootDirectory / z);
}

/// <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 : ICanRegenerateBuildConfiguration, INukeBuild
{
/// <summary>
/// Run staged lint tasks
/// </summary>
public Target LintStaged => t =>
t
.DependsOn(RegenerateBuildConfigurations)
.OnlyWhenDynamic(() => LintStagedIsPullRequest || IsLocalBuild)
.Executes(
() => ProcessTasks.StartProcess(
ToolPathResolver.GetPathExecutable("npx"),
$"lint-staged -r {( LintStagedIsPullRequest ? $"""--diff="origin/{GitHubActions.Instance.BaseRef}...origin/{GitHubActions.Instance.HeadRef}" """ : "" )}",
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");
}
}
);

/// <summary>
/// Defines if the current environment is a pull request
/// </summary>
public bool LintStagedIsPullRequest => GitHubActions.Instance?.IsPullRequest == true;
}
59 changes: 59 additions & 0 deletions src/Nuke/ICanLintStagedFiles.cs
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");
}
}
);

Check warning on line 58 in src/Nuke/ICanLintStagedFiles.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/ICanLintStagedFiles.cs#L22-L58

Added lines #L22 - L58 were not covered by tests
}
6 changes: 4 additions & 2 deletions src/Nuke/ICanRegenerateBuildConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@
{
internal Target RegenerateBuildConfigurations => t =>
t
.TryDependentFor<ICanLintStagedFiles>(static z => z.LintStaged)
.TryTriggeredBy<ICanLint>(static z => z.Lint)

Check warning on line 16 in src/Nuke/ICanRegenerateBuildConfiguration.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/ICanRegenerateBuildConfiguration.cs#L15-L16

Added lines #L15 - L16 were not covered by tests
.Unlisted()
.Executes(
() =>
{
var allHosts = this.GetType()
var allHosts = GetType()

Check warning on line 21 in src/Nuke/ICanRegenerateBuildConfiguration.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/ICanRegenerateBuildConfiguration.cs#L21

Added line #L21 was not covered by tests
.GetCustomAttributes<ConfigurationAttributeBase>()
.OfType<IConfigurationGenerator>();

allHosts
// ReSharper disable once NullableWarningSuppressionIsUsed
// ReSharper disable once NullableWarningSuppressionIsUsed

Check warning on line 26 in src/Nuke/ICanRegenerateBuildConfiguration.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/ICanRegenerateBuildConfiguration.cs#L26

Added line #L26 was not covered by tests
.Select(z => $"""{Assembly.GetEntryAssembly()!.Location} --{BuildServerConfigurationGeneration.ConfigurationParameterName} {z.Id} --host {z.HostName}""")
.ForEach(
command => DotNetTasks.DotNet(
Expand Down
2 changes: 1 addition & 1 deletion src/Nuke/ICanUpdateReadme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/// </summary>
public Target GenerateReadme => d => d
.Unlisted()
.OnlyWhenStatic(() => NukeBuild.IsLocalBuild)
.OnlyWhenStatic(() => IsLocalBuild)

Check warning on line 28 in src/Nuke/ICanUpdateReadme.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/ICanUpdateReadme.cs#L28

Added line #L28 was not covered by tests
.Executes(
() =>
{
Expand Down
16 changes: 3 additions & 13 deletions src/Nuke/IHavePublicApis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/// <summary>
/// Determine if Unshipped apis should always be pushed the Shipped file used in lint-staged to automatically update the shipped file
/// </summary>
public bool ShouldMoveUnshippedToShipped => IsLocalBuild;
public bool ShouldMoveUnshippedToShipped => true;

Check warning on line 17 in src/Nuke/IHavePublicApis.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/IHavePublicApis.cs#L17

Added line #L17 was not covered by tests

/// <summary>
/// All the projects that depend on the Microsoft.CodeAnalysis.PublicApiAnalyzers package
Expand Down Expand Up @@ -49,7 +49,6 @@
public Target LintPublicApiAnalyzers => d =>
d
.TriggeredBy(Lint)
.OnlyWhenDynamic(() => IsLocalBuild)
.Unlisted()
.Executes(
async () =>
Expand All @@ -68,16 +67,7 @@
await File.WriteAllTextAsync(unshippedFilePath, "#nullable enable");
}

#pragma warning disable CA1860
if (LintPaths.Any())
#pragma warning restore CA1860
{
DotNetTasks.DotNet($"format {project.Path} --diagnostics=RS0016 --include {string.Join(",", LintPaths)}");
}
else
{
DotNetTasks.DotNet($"format {project.Path} --diagnostics=RS0016");
}
DotNetTasks.DotNet($"format {project.Path} --diagnostics=RS0016");

Check warning on line 70 in src/Nuke/IHavePublicApis.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/IHavePublicApis.cs#L70

Added line #L70 was not covered by tests
}
}
);
Expand All @@ -88,7 +78,7 @@
[UsedImplicitly]
public Target MoveUnshippedToShipped => d =>
d
.After(LintPublicApiAnalyzers)
.DependsOn(LintPublicApiAnalyzers)

Check warning on line 81 in src/Nuke/IHavePublicApis.cs

View check run for this annotation

Codecov / codecov/patch

src/Nuke/IHavePublicApis.cs#L81

Added line #L81 was not covered by tests
.TriggeredBy(LintPublicApiAnalyzers)
.OnlyWhenDynamic(() => ShouldMoveUnshippedToShipped)
.Executes(
Expand Down
Loading
Loading