From 67116fa2ebd33647d9211a39b3578a043079f03c Mon Sep 17 00:00:00 2001 From: shawnwu33 Date: Mon, 7 Oct 2024 23:57:38 +1100 Subject: [PATCH 01/10] Seperate mutation test and build tasks in build.cake --- build.cake | 99 +++++++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 45 deletions(-) diff --git a/build.cake b/build.cake index 0b57c2700dd..9f2d9f289f8 100644 --- a/build.cake +++ b/build.cake @@ -159,56 +159,29 @@ Task("__RunTests") } }); -Task("__RunMutationTests") +Task("__RunCoreMutationTests") .Does((context) => { - var runMutationTests = EnvironmentVariable("RUN_MUTATION_TESTS") switch - { - "false" => false, - _ => true - }; - - if (!runMutationTests) - { - return; - } - var oldDirectory = context.Environment.WorkingDirectory; context.Environment.WorkingDirectory = MakeAbsolute(Directory("test")); - TestProject(File("../src/Polly.Core/Polly.Core.csproj"), File("./Polly.Core.Tests/Polly.Core.Tests.csproj"), "Polly.Core.csproj"); - TestProject(File("../src/Polly.RateLimiting/Polly.RateLimiting.csproj"), File("./Polly.RateLimiting.Tests/Polly.RateLimiting.Tests.csproj"), "Polly.RateLimiting.csproj"); - TestProject(File("../src/Polly.Extensions/Polly.Extensions.csproj"), File("./Polly.Extensions.Tests/Polly.Extensions.Tests.csproj"), "Polly.Extensions.csproj"); - TestProject(File("../src/Polly.Testing/Polly.Testing.csproj"), File("./Polly.Testing.Tests/Polly.Testing.Tests.csproj"), "Polly.Testing.csproj"); - TestProject(File("../src/Polly/Polly.csproj"), File("./Polly.Specs/Polly.Specs.csproj"), "Polly.csproj"); + MutationTestProject(File("../src/Polly.Core/Polly.Core.csproj"), File("./Polly.Core.Tests/Polly.Core.Tests.csproj"), "Polly.Core.csproj"); + MutationTestProject(File("../src/Polly.RateLimiting/Polly.RateLimiting.csproj"), File("./Polly.RateLimiting.Tests/Polly.RateLimiting.Tests.csproj"), "Polly.RateLimiting.csproj"); + MutationTestProject(File("../src/Polly.Extensions/Polly.Extensions.csproj"), File("./Polly.Extensions.Tests/Polly.Extensions.Tests.csproj"), "Polly.Extensions.csproj"); + MutationTestProject(File("../src/Polly.Testing/Polly.Testing.csproj"), File("./Polly.Testing.Tests/Polly.Testing.Tests.csproj"), "Polly.Testing.csproj"); context.Environment.WorkingDirectory = oldDirectory; +}); - void TestProject(FilePath proj, FilePath testProj, string project) - { - var dotNetBuildSettings = new DotNetBuildSettings - { - Configuration = "Debug", - Verbosity = DotNetVerbosity.Minimal, - NoRestore = true - }; - - DotNetBuild(proj.ToString(), dotNetBuildSettings); - - var strykerPath = Context.Tools.Resolve("Stryker.CLI.dll"); - var mutationScore = XmlPeek(proj, "/Project/PropertyGroup/MutationScore/text()", new XmlPeekSettings { SuppressWarning = true }); - var score = int.Parse(mutationScore); - - Information($"Running mutation tests for '{proj}'. Test Project: '{testProj}'"); +Task("__RunLegacyMutationTests") + .Does((context) => +{ + var oldDirectory = context.Environment.WorkingDirectory; + context.Environment.WorkingDirectory = MakeAbsolute(Directory("test")); - var args = $"{strykerPath} --project {project} --test-project {testProj.FullPath} --break-at {score} --config-file {strykerConfig} --output {strykerOutput}/{project}"; + MutationTestProject(File("../src/Polly/Polly.csproj"), File("./Polly.Specs/Polly.Specs.csproj"), "Polly.csproj"); - var result = StartProcess("dotnet", args); - if (result != 0) - { - throw new InvalidOperationException($"The mutation testing of '{project}' project failed."); - } - } + context.Environment.WorkingDirectory = oldDirectory; }); Task("__CreateNuGetPackages") @@ -252,18 +225,20 @@ Task("__ValidateDocs") } }); +Task("__CommonBuild") + .IsDependentOn("__Clean") + .IsDependentOn("__RestoreNuGetPackages") + .IsDependentOn("__ValidateDocs") + .IsDependentOn("__BuildSolutions"); + ////////////////////////////////////////////////////////////////////// // BUILD TASKS ////////////////////////////////////////////////////////////////////// Task("Build") - .IsDependentOn("__Clean") - .IsDependentOn("__RestoreNuGetPackages") - .IsDependentOn("__ValidateDocs") - .IsDependentOn("__BuildSolutions") + .IsDependentOn("__CommonBuild") .IsDependentOn("__ValidateAot") .IsDependentOn("__RunTests") - .IsDependentOn("__RunMutationTests") .IsDependentOn("__CreateNuGetPackages"); /////////////////////////////////////////////////////////////////////////////// @@ -273,6 +248,14 @@ Task("Build") Task("Default") .IsDependentOn("Build"); +Task("MutationCore") + .IsDependentOn("__CommonBuild") + .IsDependentOn("__RunCoreMutationTests"); + +Task("MutationLegacy") + .IsDependentOn("__CommonBuild") + .IsDependentOn("__RunLegacyMutationTests"); + /////////////////////////////////////////////////////////////////////////////// // EXECUTION /////////////////////////////////////////////////////////////////////////////// @@ -287,3 +270,29 @@ string ToolsExePath(string exeFileName) { var exePath = System.IO.Directory.GetFiles("./tools", exeFileName, SearchOption.AllDirectories).FirstOrDefault(); return exePath; } + +void MutationTestProject(FilePath proj, FilePath testProj, string project) +{ + var dotNetBuildSettings = new DotNetBuildSettings + { + Configuration = "Debug", + Verbosity = DotNetVerbosity.Minimal, + NoRestore = true + }; + + DotNetBuild(proj.ToString(), dotNetBuildSettings); + + var strykerPath = Context.Tools.Resolve("Stryker.CLI.dll"); + var mutationScore = XmlPeek(proj, "/Project/PropertyGroup/MutationScore/text()", new XmlPeekSettings { SuppressWarning = true }); + var score = int.Parse(mutationScore); + + Information($"Running mutation tests for '{proj}'. Test Project: '{testProj}'"); + + var args = $"{strykerPath} --project {project} --test-project {testProj.FullPath} --break-at {score} --config-file {strykerConfig} --output {strykerOutput}/{project}"; + + var result = StartProcess("dotnet", args); + if (result != 0) + { + throw new InvalidOperationException($"The mutation testing of '{project}' project failed."); + } +} From 82e44d2bcf7248aadae601d4677c9228ab0571c3 Mon Sep 17 00:00:00 2001 From: shawnwu33 Date: Tue, 8 Oct 2024 00:12:22 +1100 Subject: [PATCH 02/10] add mutation-test-core --- .github/workflows/mutation-tests-core.yml | 63 +++++++++++++++++++++++ build.ps1 | 3 +- 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/mutation-tests-core.yml diff --git a/.github/workflows/mutation-tests-core.yml b/.github/workflows/mutation-tests-core.yml new file mode 100644 index 00000000000..5bf27840c46 --- /dev/null +++ b/.github/workflows/mutation-tests-core.yml @@ -0,0 +1,63 @@ +name: mutation-tests-core + +on: + push: + branches: [ main, release/* ] + tags: [ '*' ] + pull_request: + branches: [ main, release/* ] + workflow_dispatch: + +env: + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_GENERATE_ASPNET_CERTIFICATE: false + DOTNET_NOLOGO: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 + NUGET_XMLDOC_MODE: skip + TERM: xterm + +permissions: + contents: read + +jobs: + build: + name: Run Mutation Test + runs-on: windows-latest + timeout-minutes: 60 + + steps: + + - name: Checkout code + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + with: + fetch-depth: 0 + + - name: Setup .NET SDKs + uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 + with: + dotnet-version: | + 6.0.x + + - name: Setup .NET SDK + uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 + id: setup-dotnet + + - name: Setup NuGet cache + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props') }} + restore-keys: ${{ runner.os }}-nuget- + + - name: Build and Run Mutation Tests + id: build + shell: pwsh + run: ./build.ps1 -Target MutationCore + + - name: Upload Mutation Report + if: always() + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: mutation-report-core + path: ./artifacts/mutation-report diff --git a/build.ps1 b/build.ps1 index 24fa6319e45..a27db5991dd 100755 --- a/build.ps1 +++ b/build.ps1 @@ -26,7 +26,8 @@ https://cakebuild.net Param( [string]$Script = "build.cake", - [string]$Target = "Default", + [string]$Target = "Default" + [ValidateSet("Default", "MutationCore", "MutationLegacy")], [string]$Configuration = "Release", [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] [string]$Verbosity = "Verbose", From 9c6f9eb5f48f62763b8f62e4ac31a5e7742e4578 Mon Sep 17 00:00:00 2001 From: shawnwu33 Date: Tue, 8 Oct 2024 00:15:48 +1100 Subject: [PATCH 03/10] wip --- .github/workflows/build.yml | 13 +------------ .github/workflows/mutation-tests-core.yml | 2 +- build.ps1 | 4 ++-- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfcc15914f1..189e9496c9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: build on: push: - branches: [ main, release/* ] + branches: [ main, release/*, seperate_mutation_tests ] tags: [ '*' ] pull_request: branches: [ main, release/* ] @@ -26,10 +26,6 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 60 - env: - # HACK Running on Windows instead of Linux due to https://github.com/stryker-mutator/stryker-net/issues/2741 - RUN_MUTATION_TESTS: ${{ matrix.os_name == 'windows' && !startsWith(github.ref, 'refs/tags/') && 'true' || 'false' }} - outputs: dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }} dotnet-sign-version: ${{ steps.get-dotnet-tools-versions.outputs.dotnet-sign-version }} @@ -94,13 +90,6 @@ jobs: flags: ${{ matrix.os_name }} token: ${{ secrets.CODECOV_TOKEN }} - - name: Upload Mutation Report - if: always() && env.RUN_MUTATION_TESTS == 'true' - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: mutation-report - path: ./artifacts/mutation-report - - name: Publish NuGet packages uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: diff --git a/.github/workflows/mutation-tests-core.yml b/.github/workflows/mutation-tests-core.yml index 5bf27840c46..f4d0963fc2a 100644 --- a/.github/workflows/mutation-tests-core.yml +++ b/.github/workflows/mutation-tests-core.yml @@ -2,7 +2,7 @@ name: mutation-tests-core on: push: - branches: [ main, release/* ] + branches: [ main, release/*, seperate_mutation_tests] tags: [ '*' ] pull_request: branches: [ main, release/* ] diff --git a/build.ps1 b/build.ps1 index a27db5991dd..ca1cfcdd00f 100755 --- a/build.ps1 +++ b/build.ps1 @@ -26,8 +26,8 @@ https://cakebuild.net Param( [string]$Script = "build.cake", - [string]$Target = "Default" - [ValidateSet("Default", "MutationCore", "MutationLegacy")], + [string]$Target = "Default", + [ValidateSet("Default", "MutationCore", "MutationLegacy")] [string]$Configuration = "Release", [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] [string]$Verbosity = "Verbose", From 6203675aab7096e50e26570ddb7021b2f3fc1b16 Mon Sep 17 00:00:00 2001 From: shawnwu33 Date: Tue, 8 Oct 2024 00:26:43 +1100 Subject: [PATCH 04/10] add mutation-tests-legacy.yml --- .github/workflows/mutation-tests-legacy.yml | 63 +++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/mutation-tests-legacy.yml diff --git a/.github/workflows/mutation-tests-legacy.yml b/.github/workflows/mutation-tests-legacy.yml new file mode 100644 index 00000000000..8f919e6984d --- /dev/null +++ b/.github/workflows/mutation-tests-legacy.yml @@ -0,0 +1,63 @@ +name: mutation-tests-legacy + +on: + push: + branches: [ main, release/*, seperate_mutation_tests] + tags: [ '*' ] + pull_request: + branches: [ main, release/* ] + workflow_dispatch: + +env: + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_GENERATE_ASPNET_CERTIFICATE: false + DOTNET_NOLOGO: true + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true + DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 + NUGET_XMLDOC_MODE: skip + TERM: xterm + +permissions: + contents: read + +jobs: + build: + name: Run Mutation Test + runs-on: windows-latest + timeout-minutes: 60 + + steps: + + - name: Checkout code + uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 + with: + fetch-depth: 0 + + - name: Setup .NET SDKs + uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 + with: + dotnet-version: | + 6.0.x + + - name: Setup .NET SDK + uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 + id: setup-dotnet + + - name: Setup NuGet cache + uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props') }} + restore-keys: ${{ runner.os }}-nuget- + + - name: Build and Run Mutation Tests + id: build + shell: pwsh + run: ./build.ps1 -Target MutationLegacy + + - name: Upload Mutation Report + if: always() + uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 + with: + name: mutation-report-core + path: ./artifacts/mutation-report From 10b949ebf4e9a8885bf77234c9eb0edc8e69e441 Mon Sep 17 00:00:00 2001 From: shawnwu33 Date: Tue, 8 Oct 2024 09:40:47 +1100 Subject: [PATCH 05/10] clean up --- .github/workflows/build.yml | 2 +- .github/workflows/mutation-tests-core.yml | 2 +- .github/workflows/mutation-tests-legacy.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 189e9496c9a..6a80e23eda4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,7 @@ name: build on: push: - branches: [ main, release/*, seperate_mutation_tests ] + branches: [ main, release/* ] tags: [ '*' ] pull_request: branches: [ main, release/* ] diff --git a/.github/workflows/mutation-tests-core.yml b/.github/workflows/mutation-tests-core.yml index f4d0963fc2a..5bf27840c46 100644 --- a/.github/workflows/mutation-tests-core.yml +++ b/.github/workflows/mutation-tests-core.yml @@ -2,7 +2,7 @@ name: mutation-tests-core on: push: - branches: [ main, release/*, seperate_mutation_tests] + branches: [ main, release/* ] tags: [ '*' ] pull_request: branches: [ main, release/* ] diff --git a/.github/workflows/mutation-tests-legacy.yml b/.github/workflows/mutation-tests-legacy.yml index 8f919e6984d..21e03b085bc 100644 --- a/.github/workflows/mutation-tests-legacy.yml +++ b/.github/workflows/mutation-tests-legacy.yml @@ -2,7 +2,7 @@ name: mutation-tests-legacy on: push: - branches: [ main, release/*, seperate_mutation_tests] + branches: [ main, release/* ] tags: [ '*' ] pull_request: branches: [ main, release/* ] @@ -59,5 +59,5 @@ jobs: if: always() uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: - name: mutation-report-core + name: mutation-report-legacy path: ./artifacts/mutation-report From 260bc68ee67c012d6270e07498330b0745479200 Mon Sep 17 00:00:00 2001 From: ShawnWu33 Date: Wed, 9 Oct 2024 12:28:12 +1100 Subject: [PATCH 06/10] combine mutation tests into one workflow --- .github/workflows/mutation-tests-legacy.yml | 63 ------------------- ...tion-tests-core.yml => mutation-tests.yml} | 21 +++++-- 2 files changed, 17 insertions(+), 67 deletions(-) delete mode 100644 .github/workflows/mutation-tests-legacy.yml rename .github/workflows/{mutation-tests-core.yml => mutation-tests.yml} (76%) diff --git a/.github/workflows/mutation-tests-legacy.yml b/.github/workflows/mutation-tests-legacy.yml deleted file mode 100644 index 21e03b085bc..00000000000 --- a/.github/workflows/mutation-tests-legacy.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: mutation-tests-legacy - -on: - push: - branches: [ main, release/* ] - tags: [ '*' ] - pull_request: - branches: [ main, release/* ] - workflow_dispatch: - -env: - DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_GENERATE_ASPNET_CERTIFICATE: false - DOTNET_NOLOGO: true - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 - NUGET_XMLDOC_MODE: skip - TERM: xterm - -permissions: - contents: read - -jobs: - build: - name: Run Mutation Test - runs-on: windows-latest - timeout-minutes: 60 - - steps: - - - name: Checkout code - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - fetch-depth: 0 - - - name: Setup .NET SDKs - uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 - with: - dotnet-version: | - 6.0.x - - - name: Setup .NET SDK - uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 - id: setup-dotnet - - - name: Setup NuGet cache - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ~/.nuget/packages - key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props') }} - restore-keys: ${{ runner.os }}-nuget- - - - name: Build and Run Mutation Tests - id: build - shell: pwsh - run: ./build.ps1 -Target MutationLegacy - - - name: Upload Mutation Report - if: always() - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: mutation-report-legacy - path: ./artifacts/mutation-report diff --git a/.github/workflows/mutation-tests-core.yml b/.github/workflows/mutation-tests.yml similarity index 76% rename from .github/workflows/mutation-tests-core.yml rename to .github/workflows/mutation-tests.yml index 5bf27840c46..5bd1a0accca 100644 --- a/.github/workflows/mutation-tests-core.yml +++ b/.github/workflows/mutation-tests.yml @@ -1,4 +1,4 @@ -name: mutation-tests-core +name: mutation-tests on: push: @@ -22,10 +22,19 @@ permissions: jobs: build: - name: Run Mutation Test + name: Run Mutation Test ${{ matrix.target }} runs-on: windows-latest timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + include: + - name: core + target: Core + - name: legacy + target: Legacy + steps: - name: Checkout code @@ -53,11 +62,15 @@ jobs: - name: Build and Run Mutation Tests id: build shell: pwsh - run: ./build.ps1 -Target MutationCore + run: ./build.ps1 -Target Mutation${{ matrix.target }} + + - name: downcase target + run: | + echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} - name: Upload Mutation Report if: always() uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: - name: mutation-report-core + name: mutation-report-${{ matrix.name }} path: ./artifacts/mutation-report From f3011fc08fcf41be9d06455957f11450681eb43f Mon Sep 17 00:00:00 2001 From: ShawnWu33 Date: Wed, 9 Oct 2024 21:12:12 +1100 Subject: [PATCH 07/10] Refactor based on feedbacks --- .github/workflows/build.yml | 2 +- .github/workflows/mutation-tests.yml | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a80e23eda4..982d3d4b18a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: build: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} - timeout-minutes: 60 + timeout-minutes: 20 outputs: dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }} diff --git a/.github/workflows/mutation-tests.yml b/.github/workflows/mutation-tests.yml index 5bd1a0accca..49fc69aa34a 100644 --- a/.github/workflows/mutation-tests.yml +++ b/.github/workflows/mutation-tests.yml @@ -3,7 +3,6 @@ name: mutation-tests on: push: branches: [ main, release/* ] - tags: [ '*' ] pull_request: branches: [ main, release/* ] workflow_dispatch: @@ -21,8 +20,8 @@ permissions: contents: read jobs: - build: - name: Run Mutation Test ${{ matrix.target }} + mutations: + name: ${{ matrix.name }} runs-on: windows-latest timeout-minutes: 60 @@ -50,7 +49,6 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 - id: setup-dotnet - name: Setup NuGet cache uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 @@ -59,15 +57,10 @@ jobs: key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props') }} restore-keys: ${{ runner.os }}-nuget- - - name: Build and Run Mutation Tests - id: build + - name: Run mutation tests shell: pwsh run: ./build.ps1 -Target Mutation${{ matrix.target }} - - name: downcase target - run: | - echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} - - name: Upload Mutation Report if: always() uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 From 33b100842b69652eba4beaf33d2792e9c232dacd Mon Sep 17 00:00:00 2001 From: Shawn Wu Date: Wed, 9 Oct 2024 21:39:11 +1100 Subject: [PATCH 08/10] Update .github/workflows/mutation-tests.yml Co-authored-by: Martin Costello --- .github/workflows/mutation-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/mutation-tests.yml b/.github/workflows/mutation-tests.yml index 49fc69aa34a..70d4235a280 100644 --- a/.github/workflows/mutation-tests.yml +++ b/.github/workflows/mutation-tests.yml @@ -59,7 +59,9 @@ jobs: - name: Run mutation tests shell: pwsh - run: ./build.ps1 -Target Mutation${{ matrix.target }} + env: + MUTATION_TARGET: 'Mutation${{ matrix.target }}' + run: ./build.ps1 -Target ${env:MUTATION_TARGET} - name: Upload Mutation Report if: always() From 5e506e78ed3c4a19d4462e09bc8944116b2d9fd2 Mon Sep 17 00:00:00 2001 From: shawnwu33 Date: Wed, 9 Oct 2024 22:34:13 +1100 Subject: [PATCH 09/10] remove working directory changes when running mutation test --- build.cake | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/build.cake b/build.cake index 9f2d9f289f8..13173854b06 100644 --- a/build.cake +++ b/build.cake @@ -162,26 +162,16 @@ Task("__RunTests") Task("__RunCoreMutationTests") .Does((context) => { - var oldDirectory = context.Environment.WorkingDirectory; - context.Environment.WorkingDirectory = MakeAbsolute(Directory("test")); - - MutationTestProject(File("../src/Polly.Core/Polly.Core.csproj"), File("./Polly.Core.Tests/Polly.Core.Tests.csproj"), "Polly.Core.csproj"); - MutationTestProject(File("../src/Polly.RateLimiting/Polly.RateLimiting.csproj"), File("./Polly.RateLimiting.Tests/Polly.RateLimiting.Tests.csproj"), "Polly.RateLimiting.csproj"); - MutationTestProject(File("../src/Polly.Extensions/Polly.Extensions.csproj"), File("./Polly.Extensions.Tests/Polly.Extensions.Tests.csproj"), "Polly.Extensions.csproj"); - MutationTestProject(File("../src/Polly.Testing/Polly.Testing.csproj"), File("./Polly.Testing.Tests/Polly.Testing.Tests.csproj"), "Polly.Testing.csproj"); - - context.Environment.WorkingDirectory = oldDirectory; + MutationTestProject(File("./src/Polly.Core/Polly.Core.csproj"), File("./test/Polly.Core.Tests/Polly.Core.Tests.csproj"), "Polly.Core.csproj"); + MutationTestProject(File("./src/Polly.RateLimiting/Polly.RateLimiting.csproj"), File("./test/Polly.RateLimiting.Tests/Polly.RateLimiting.Tests.csproj"), "Polly.RateLimiting.csproj"); + MutationTestProject(File("./src/Polly.Extensions/Polly.Extensions.csproj"), File("./test/Polly.Extensions.Tests/Polly.Extensions.Tests.csproj"), "Polly.Extensions.csproj"); + MutationTestProject(File("./src/Polly.Testing/Polly.Testing.csproj"), File("./test/Polly.Testing.Tests/Polly.Testing.Tests.csproj"), "Polly.Testing.csproj"); }); Task("__RunLegacyMutationTests") .Does((context) => { - var oldDirectory = context.Environment.WorkingDirectory; - context.Environment.WorkingDirectory = MakeAbsolute(Directory("test")); - - MutationTestProject(File("../src/Polly/Polly.csproj"), File("./Polly.Specs/Polly.Specs.csproj"), "Polly.csproj"); - - context.Environment.WorkingDirectory = oldDirectory; + MutationTestProject(File("./src/Polly/Polly.csproj"), File("./test/Polly.Specs/Polly.Specs.csproj"), "Polly.csproj"); }); Task("__CreateNuGetPackages") From 4cf290ebf6fe59d3a1af54693db7e1263e4f3dc6 Mon Sep 17 00:00:00 2001 From: Shawn Wu Date: Wed, 9 Oct 2024 23:38:51 +1100 Subject: [PATCH 10/10] Update .github/workflows/mutation-tests.yml Co-authored-by: Martin Costello --- .github/workflows/mutation-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mutation-tests.yml b/.github/workflows/mutation-tests.yml index 70d4235a280..ee925eae17b 100644 --- a/.github/workflows/mutation-tests.yml +++ b/.github/workflows/mutation-tests.yml @@ -21,7 +21,7 @@ permissions: jobs: mutations: - name: ${{ matrix.name }} + name: 'mutations-${{ matrix.name }}' runs-on: windows-latest timeout-minutes: 60