From badddc2702cad936b1e3f47a8b5ca78129ce451f Mon Sep 17 00:00:00 2001 From: Cyrille NDOUMBE Date: Tue, 3 Dec 2024 12:48:02 +0100 Subject: [PATCH] fix(deps): update Nuke usage --- .../Components/IBenchmark.cs | 4 +-- .../Components/IHaveGitVersion.cs | 2 +- .../Components/IMutationTest.cs | 31 +++++++++++++------ 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/Candoumbe.Pipelines/Components/IBenchmark.cs b/src/Candoumbe.Pipelines/Components/IBenchmark.cs index 2eb1c3c..336d84f 100644 --- a/src/Candoumbe.Pipelines/Components/IBenchmark.cs +++ b/src/Candoumbe.Pipelines/Components/IBenchmark.cs @@ -49,8 +49,8 @@ public interface IBenchmark : ICompile, IHaveArtifacts /// public sealed Configure BenchmarksSettingsBase => _ => _ .SetConfiguration(Configuration) - .SetProcessArgumentConfigurator(args => args.Add("-- --filter {0}", "*", customValue: true) - .Add("--artifacts {0}", BenchmarkResultDirectory) + .SetProcessArgumentConfigurator(args => args.Add("-- --filter *") + .Add($"--artifacts {BenchmarkResultDirectory}") .Add("--join")); /// diff --git a/src/Candoumbe.Pipelines/Components/IHaveGitVersion.cs b/src/Candoumbe.Pipelines/Components/IHaveGitVersion.cs index d02e09d..d794c57 100644 --- a/src/Candoumbe.Pipelines/Components/IHaveGitVersion.cs +++ b/src/Candoumbe.Pipelines/Components/IHaveGitVersion.cs @@ -15,7 +15,7 @@ public interface IHaveGitVersion : INukeBuild, IRequireNuGetPackage /// /// The GitVersion tool that can be used to version the project /// - [GitVersion(Framework = "net6.0")] + [GitVersion(Framework = "net8.0")] [Required] public GitVersion GitVersion => TryGetValue(() => GitVersion); diff --git a/src/Candoumbe.Pipelines/Components/IMutationTest.cs b/src/Candoumbe.Pipelines/Components/IMutationTest.cs index 1b1be1c..32351f4 100644 --- a/src/Candoumbe.Pipelines/Components/IMutationTest.cs +++ b/src/Candoumbe.Pipelines/Components/IMutationTest.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using Candoumbe.Pipelines.Components.Workflows; +using JetBrains.Annotations; using Nuke.Common; +using Nuke.Common.Git; using Nuke.Common.IO; using Nuke.Common.ProjectModel; using Nuke.Common.Tooling; @@ -96,8 +98,8 @@ void RunMutationTestsForTheProject(MutationProjectConfiguration mutationProject, Verbose("{ProjectName} will run mutation tests for the following frameworks : {@Frameworks}", sourceProject.Name, sourceProject.GetTargetFrameworks()); Arguments args = new(); - args = args.Apply(StrykerArgumentsSettingsBase) - .Apply(StrykerArgumentsSettings); + args = StrykerArgumentsSettingsBase.Invoke(args); + args = StrykerArgumentsSettings.Invoke(args); args.Add("--target-framework {value}", framework) .Add("--output {value}", MutationTestResultDirectory / sourceProject.Name / framework); @@ -185,14 +187,22 @@ void RunMutationTestsForTheProject(MutationProjectConfiguration mutationProject, }); internal Configure StrykerArgumentsSettingsBase => _ - => _ - .When(IsLocalBuild, args => args.Add("--open-report:{value}", "html")) - .WhenNotNull(StrykerDashboardApiKey, - (args, apiKey) => args.Add("--dashboard-api-key {value}", apiKey, secret: true) - .Add("--reporter dashboard")) - .Add("--reporter markdown") - .Add("--reporter html") - .When(IsLocalBuild, args => args.Add("--reporter progress")); + => + { + Arguments args = new(); + + if (IsLocalBuild) + { + args = args.Add("--open-report:{value}", "html") + .Add("--reporter progress"); + } + + return args.WhenNotNull(StrykerArgumentsSettings, + (args, apiKey) => args.Add("--dashboard-api-key {value}", apiKey, secret: true) + .Add("--reporter dashboard")) + .Add("--reporter markdown") + .Add("--reporter html"); + }; /// /// Configures arguments that will be used by when running Stryker tool @@ -203,6 +213,7 @@ void RunMutationTestsForTheProject(MutationProjectConfiguration mutationProject, /// /// Wraps information on mutation tests for a specific project. /// +[UsedImplicitly] public record MutationProjectConfiguration { ///