From 3dc3b90573b509bbe5699d234233ad540e385800 Mon Sep 17 00:00:00 2001 From: Hamed Shirbandi Date: Sun, 8 Oct 2023 19:54:28 +0200 Subject: [PATCH] fix: missed dotnet tool restore and stryker dashboard report --- .gitignore | 1 + .nuke/build.schema.json | 2 ++ .../stryker-config.json | 3 +- .../Identity.Tests.Unit/stryker-config.json | 3 +- .../stryker-config.json | 3 +- .../stryker-config.json | 3 +- src/6-Build/Build.cs | 32 +++++++++++++------ 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 37731856c..2ad38f682 100644 --- a/.gitignore +++ b/.gitignore @@ -673,3 +673,4 @@ fabric.properties ocelot.json /src/2-Services/Identity/Api/Identity.Api/keys /src/6-Docker/mssqldata/Entropy.bin +/.nuke/temp/execution-plan.html diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index bdde12633..0801fcd2d 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -76,6 +76,7 @@ "Information", "Preparation", "Restore", + "RestoreDotNetTool", "RunMutationTests", "RunUnitTests" ] @@ -96,6 +97,7 @@ "Information", "Preparation", "Restore", + "RestoreDotNetTool", "RunMutationTests", "RunUnitTests" ] diff --git a/src/2-Services/Boards/Tests/Boards.Write.Tests.Unit/stryker-config.json b/src/2-Services/Boards/Tests/Boards.Write.Tests.Unit/stryker-config.json index 9196663ad..2ea2af5f3 100644 --- a/src/2-Services/Boards/Tests/Boards.Write.Tests.Unit/stryker-config.json +++ b/src/2-Services/Boards/Tests/Boards.Write.Tests.Unit/stryker-config.json @@ -12,8 +12,7 @@ ], "reporters": [ "html", - "progress", - "dashboard" + "progress" ], "project-info": { "module": "TaskoMask", diff --git a/src/2-Services/Identity/Tests/Identity.Tests.Unit/stryker-config.json b/src/2-Services/Identity/Tests/Identity.Tests.Unit/stryker-config.json index a5be47333..d3a9389fc 100644 --- a/src/2-Services/Identity/Tests/Identity.Tests.Unit/stryker-config.json +++ b/src/2-Services/Identity/Tests/Identity.Tests.Unit/stryker-config.json @@ -12,8 +12,7 @@ ], "reporters": [ "html", - "progress", - "dashboard" + "progress" ], "project-info": { "module": "TaskoMask", diff --git a/src/2-Services/Owners/Tests/Owners.Write.Tests.Unit/stryker-config.json b/src/2-Services/Owners/Tests/Owners.Write.Tests.Unit/stryker-config.json index 0204ae6b4..382efdd94 100644 --- a/src/2-Services/Owners/Tests/Owners.Write.Tests.Unit/stryker-config.json +++ b/src/2-Services/Owners/Tests/Owners.Write.Tests.Unit/stryker-config.json @@ -12,8 +12,7 @@ ], "reporters": [ "html", - "progress", - "dashboard" + "progress" ], "project-info": { "module": "TaskoMask", diff --git a/src/2-Services/Tasks/Tests/Tasks.Write.Tests.Unit/stryker-config.json b/src/2-Services/Tasks/Tests/Tasks.Write.Tests.Unit/stryker-config.json index 5ddf4e79a..104e07289 100644 --- a/src/2-Services/Tasks/Tests/Tasks.Write.Tests.Unit/stryker-config.json +++ b/src/2-Services/Tasks/Tests/Tasks.Write.Tests.Unit/stryker-config.json @@ -12,8 +12,7 @@ ], "reporters": [ "html", - "progress", - "dashboard" + "progress" ], "project-info": { "module": "TaskoMask", diff --git a/src/6-Build/Build.cs b/src/6-Build/Build.cs index 96465fbd6..22cd50acb 100644 --- a/src/6-Build/Build.cs +++ b/src/6-Build/Build.cs @@ -29,7 +29,6 @@ class Build : NukeBuild AbsolutePath TestResultDirectory = RootDirectory + "/Artifacts/Test-Results/"; Target Information => _ => _ - .Before(Preparation) .Executes(() => { Log.Information($"Solution path : {Solution}"); @@ -45,6 +44,13 @@ class Build : NukeBuild TestResultDirectory.CreateOrCleanDirectory(); }); + Target RestoreDotNetTool => _ => _ + .DependsOn(RunUnitTests) + .Executes(() => + { + DotNet(arguments: "tool restore"); + }); + Target Clean => _ => _ .DependsOn(Preparation) .Executes(() => @@ -91,14 +97,20 @@ class Build : NukeBuild .SetCoverletOutput(TestResultDirectory + $"{z.Name}.xml"))); }); - Target RunMutationTests => _ => _ - .DependsOn(RunUnitTests) - .Executes(() => - { - var testProjects = Solution.AllProjects.Where(s => s.Name.EndsWith(".Tests.Unit")); - - foreach (var testProject in testProjects) - DotNet(workingDirectory: testProject.Directory, arguments: "stryker --since"); - }); + .DependsOn(RunUnitTests, RestoreDotNetTool) + .Executes(() => + { + //It uses dashboard report for CI + string report = "--reporter dashboard"; + + //It uses reports specified in reports section in stryker-config.json + if (IsLocalBuild) + report = ""; + + var testProjects = Solution.AllProjects.Where(s => s.Name.EndsWith(".Tests.Unit")); + + foreach (var testProject in testProjects) + DotNet(workingDirectory: testProject.Directory, arguments: $"stryker --since {report}"); + }); }