Skip to content
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
22 changes: 17 additions & 5 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,43 @@
"version": "5.0.0",
"commands": [
"dotnet-cake"
]
],
"rollForward": false
},
"docfx": {
"version": "2.78.2",
"commands": [
"docfx"
]
],
"rollForward": false
},
"dotnet-stryker": {
"version": "4.5.1",
"commands": [
"dotnet-stryker"
],
"rollForward": false
},
"markdownsnippets.tool": {
"version": "27.0.2",
"commands": [
"mdsnippets"
]
],
"rollForward": false
},
"MartinCostello.WaitForNuGetPackage": {
"version": "1.1.0",
"commands": [
"dotnet-wait-for-package"
]
],
"rollForward": false
},
"sign": {
"version": "0.9.1-beta.24529.1",
"commands": [
"sign"
]
],
"rollForward": false
}
}
}
3 changes: 3 additions & 0 deletions .github/workflows/actions-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Add actionlint problem matcher
run: echo "::add-matcher::.github/actionlint-matcher.json"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/after-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false
token: ${{ steps.generate-application-token.outputs.token }}

- name: Update Polly version
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
show-progress: false

- name: Setup .NET SDKs
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
Expand Down Expand Up @@ -252,9 +253,11 @@ jobs:
- name: Checkout vcsjones/AuthenticodeLint
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
path: AuthenticodeLint
ref: 90dd05293effe918b149c7f8323540b7730c06d2
repository: martincostello/AuthenticodeLint
show-progress: false
submodules: recursive

- name: Setup .NET SDK
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Initialize CodeQL
uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/dependabot-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Approve pull request and enable auto-merge
shell: bash
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: dependency-review

on:
pull_request:
branches:
branches:
- main
- release/*
- dotnet-vnext
Expand All @@ -19,6 +19,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Review dependencies
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
3 changes: 3 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Lint Markdown files
uses: DavidAnson/markdownlint-cli2-action@05f32210e84442804257b2a6f20b273450ec8265 # v19.1.0
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/mutation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
show-progress: false

- name: Setup .NET SDKs
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
Expand All @@ -57,11 +58,15 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0

- name: Restore .NET tools
run: dotnet tool restore

- name: Run mutation tests for ${{ matrix.target }}
shell: pwsh
env:
MUTATION_TARGET: 'MutationTests${{ matrix.target }}'
SKIP_POLLY_ANALYZERS: 'true'
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
run: ./build.ps1 -Target ${env:MUTATION_TARGET}

- name: Upload Mutation Report
Expand All @@ -77,12 +82,18 @@ jobs:
runs-on: ubuntu-latest
env:
MUTATIONS_SUCCESS: ${{ !contains(needs.*.result, 'failure') }}
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
steps:
- run: |
if [ -z "${STRYKER_DASHBOARD_API_KEY}" ]
then
DASHBOARD_URL="https://dashboard.stryker-mutator.io/reports/github.com/${GITHUB_REPOSITORY}/${GITHUB_REF_NAME}"
printf "# Mutations Dashboard\n\n[View report :notebook:](%s)\n" "${DASHBOARD_URL}" >> "${GITHUB_STEP_SUMMARY}"
fi
if [ "$MUTATIONS_SUCCESS" == "true" ]
then
echo 'Mutation tests successful ✅'
echo "Mutation tests successful ✅"
else
echo 'One or more mutation test runs failed ❌'
echo "::error title=Mutation Tests::One or more mutation test runs failed ❌"
exit 1
fi
3 changes: 3 additions & 0 deletions .github/workflows/nuget-packages-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Setup .NET SDK
uses: actions/setup-dotnet@3951f0dfe7a07e2313ec93c75700083e2005cbab # v4.3.0
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/on-push-do-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false
token: ${{ steps.generate-application-token.outputs.token }}

- name: Setup .NET SDK
Expand All @@ -37,14 +39,14 @@ jobs:
shell: pwsh
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
run: |
$ErrorActionPreference = "Stop"
$ProgressPreference = "SilentlyContinue"

dotnet tool restore
dotnet mdsnippets

$GitStatus = (git status --porcelain)
if ([string]::IsNullOrEmpty($GitStatus)) {
Write-Host "No changes to commit."
Expand All @@ -57,18 +59,18 @@ jobs:

$GitEmail = "138034000+polly-updater-bot[bot]@users.noreply.github.com"
$GitUser = "polly-updater-bot[bot]"

git config user.email $GitEmail | Out-Null
git config user.name $GitUser | Out-Null
git remote set-url "${{ github.server_url }}/${{ github.repository }}.git" | Out-Null
git fetch origin | Out-Null
git rev-parse --verify --quiet ("remotes/origin/" + $BranchName) | Out-Null

if ($LASTEXITCODE -eq 0) {
Write-Host "Branch $BranchName already exists."
exit 0
}

git checkout -b $BranchName
git add .
git commit -m "Update the code-snippets in the documentation"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ossf-scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
persist-credentials: false
show-progress: false

- name: Run analysis
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Create release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/updater-approve.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: updater-approve

on:
pull_request:
branches:
branches:
- main
- release/*
- dotnet-vnext
Expand Down Expand Up @@ -99,6 +99,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
filter: 'tree:0'
show-progress: false

- name: Approve pull request and enable auto-merge
if: steps.check-dependencies.outputs.is-trusted-update == 'true'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ We are a member of the [.NET Foundation](https://www.dotnetfoundation.org/about)

**Keep up to date with new feature announcements, tips & tricks, and other news through [www.thepollyproject.org](https://www.thepollyproject.org)**

[![Build status](https://github.com/App-vNext/Polly/actions/workflows/build.yml/badge.svg?branch=main&event=push)](https://github.com/App-vNext/Polly/actions/workflows/build.yml?query=branch%3Amain+event%3Apush) [![Code coverage](https://codecov.io/gh/App-vNext/Polly/branch/main/graph/badge.svg)](https://codecov.io/gh/App-vNext/Polly) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/App-vNext/Polly/badge)](https://securityscorecards.dev/viewer/?uri=github.com/App-vNext/Polly)
[![Build status](https://github.com/App-vNext/Polly/actions/workflows/build.yml/badge.svg?branch=main&event=push)](https://github.com/App-vNext/Polly/actions/workflows/build.yml?query=branch%3Amain+event%3Apush) [![Code coverage](https://codecov.io/gh/App-vNext/Polly/branch/main/graph/badge.svg)](https://codecov.io/gh/App-vNext/Polly) [![Mutation score](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.amrom.workers.dev%2FApp-vNext%2FPolly%2Fmain)](https://dashboard.stryker-mutator.io/reports/github.com/App-vNext/Polly/main) [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/App-vNext/Polly/badge)](https://securityscorecards.dev/viewer/?uri=github.com/App-vNext/Polly)

<!-- markdownlint-disable MD042 -->
[![Polly logo](https://raw.github.com/App-vNext/Polly/main/Polly-Logo.png)](#)
Expand Down
65 changes: 56 additions & 9 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
var target = Argument<string>("target", "Default");
var configuration = Argument<string>("configuration", "Release");

//////////////////////////////////////////////////////////////////////
// EXTERNAL NUGET TOOLS
//////////////////////////////////////////////////////////////////////

#Tool "xunit.runner.console&version=2.9.3"
#Tool "dotnet-stryker&version=4.5.1"

//////////////////////////////////////////////////////////////////////
// EXTERNAL NUGET LIBRARIES
//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -65,6 +58,12 @@ Teardown(_ =>
Task("__Clean")
.Does(() =>
{
if (Environment.GetEnvironmentVariable("GITHUB_ACTIONS") == "true")
{
// Nothing to clean in CI
return;
}

CleanDirectories(
[
testResultsDir,
Expand Down Expand Up @@ -289,18 +288,66 @@ string ToolsExePath(string exeFileName) {

void RunMutationTests(FilePath target, FilePath testProject)
{
var strykerPath = Context.Tools.Resolve("Stryker.CLI.dll");
var mutationScore = XmlPeek(target, "/Project/PropertyGroup/MutationScore/text()", new XmlPeekSettings { SuppressWarning = true });
var score = int.Parse(mutationScore);
var targetFileName = target.GetFilename();
var isGitHubActions = Environment.GetEnvironmentVariable("GITHUB_ACTIONS") == "true";
var dashboardUrl = string.Empty;
var moduleName = target.GetFilenameWithoutExtension().ToString();

if (isGitHubActions &&
!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("STRYKER_DASHBOARD_API_KEY")))
{
var projectName = $"github.com/{Environment.GetEnvironmentVariable("GITHUB_REPOSITORY")}";
var version = Environment.GetEnvironmentVariable("GITHUB_REF_NAME");

dashboardUrl = $"https://dashboard.stryker-mutator.io/reports/{projectName}/{version}#mutant/{moduleName}";

var config = Newtonsoft.Json.Linq.JObject.Parse(System.IO.File.ReadAllText(strykerConfig.FullPath));

var reporters = config["stryker-config"].Value<Newtonsoft.Json.Linq.JArray>("reporters");
reporters.Add("dashboard");

config["stryker-config"]["reporters"] = reporters;
config["stryker-config"]["project-info"] = new Newtonsoft.Json.Linq.JObject()
{
["module"] = moduleName,
["name"] = projectName,
["version"] = version
};

System.IO.File.WriteAllText(strykerConfig.FullPath, config.ToString());

Information("Configured Stryker dashboard.");
Information($"Mutation report will be available at {dashboardUrl}");
}

Information($"Running mutation tests for '{targetFileName}'. Test Project: '{testProject}'");

var args = $"{strykerPath} --project {targetFileName} --test-project {testProject.FullPath} --break-at {score} --config-file {strykerConfig} --output {strykerOutput}/{targetFileName}";
var args = $"stryker --project {targetFileName} --test-project {testProject.FullPath} --break-at {score} --config-file {strykerConfig} --output {strykerOutput}/{targetFileName}";

var result = StartProcess("dotnet", args);
if (result != 0)
{
throw new InvalidOperationException($"The mutation testing of '{targetFileName}' project failed.");
}

var stepSummary = Environment.GetEnvironmentVariable("GITHUB_STEP_SUMMARY");
var markdownSummary = System.IO.Path.Combine(
strykerOutput.FullPath,
targetFileName.ToString(),
"reports",
"mutation-report.md");

if (!string.IsNullOrWhiteSpace(stepSummary) && System.IO.File.Exists(markdownSummary))
{
var markdown = System.IO.File.ReadAllText(markdownSummary);

if (!string.IsNullOrWhiteSpace(dashboardUrl))
{
markdown += $"\n\n## Mutation Dashboard\n\n[View Mutation Report :notebook:]({dashboardUrl})";
}

System.IO.File.WriteAllText(stepSummary, markdown);
}
}
1 change: 1 addition & 0 deletions eng/stryker-config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"stryker-config": {
"reporters": [
"dots",
"json",
"html",
"markdown"
Expand Down