Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
941929d
feat: Add support for Coverlet.MTP and update project dependencies
Bertk Dec 6, 2025
84d8894
coverlet uses json as default whenever format is not specified
Bertk Dec 6, 2025
a6ad42f
feat: Implement Coverlet Extension for Microsoft Testing Platform
Bertk Dec 7, 2025
16e890b
fix: Update build and test scripts for improved workspace path handli…
Bertk Dec 8, 2025
6b8167c
feat: Update Coverlet version to 8.0.0 and add CI build properties fo…
Bertk Dec 8, 2025
f9b8adb
refactor: Replace GetAssemblyBuildConfiguration with GetBuildConfigur…
Bertk Dec 8, 2025
9dd030f
fix: Adjust coverage assertion to only check the return statement for…
Bertk Dec 8, 2025
24f7805
Refactor GitHub Actions workflows: codeql, release-drafter (#1790)
Bertk Dec 9, 2025
32d0b7a
feat: Add support for Coverlet.MTP and update project dependencies
Bertk Dec 6, 2025
bc95afd
coverlet uses json as default whenever format is not specified
Bertk Dec 6, 2025
848761a
feat: Implement Coverlet Extension for Microsoft Testing Platform
Bertk Dec 7, 2025
384e9ae
fix: Update build and test scripts for improved workspace path handli…
Bertk Dec 8, 2025
918072d
feat: Update Coverlet version to 8.0.0 and add CI build properties fo…
Bertk Dec 8, 2025
6948f58
refactor: Replace GetAssemblyBuildConfiguration with GetBuildConfigur…
Bertk Dec 8, 2025
06a684c
fix: Adjust coverage assertion to only check the return statement for…
Bertk Dec 8, 2025
3fad1d7
Merge branch 'coverlet-MTP' of https://github.com/Bertk/coverlet into…
Bertk Dec 9, 2025
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
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "10.0.100",
"additionalVersions": ["6.0.428", "8.0.416", "9.0.307"]
"additionalVersions": ["6.0.428", "8.0.416", "9.0.308"]
}
},

Expand Down Expand Up @@ -38,6 +38,7 @@
"ms-azure-devops.azure-pipelines",
"GitHub.copilot-chat",
"GitHub.copilot",
"github.vscode-github-actions"
"mhutchie.git-graph",
"streetsidesoftware.code-spell-checker",
"streetsidesoftware.code-spell-checker-german",
Expand Down
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
65 changes: 65 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'test bug'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependencies'
- 'documentation'


change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.

exclude-labels:
- 'skip-changelog'

version-resolver:
major:
labels:
- 'major'
minor:
labels:
- 'minor'
patch:
labels:
- 'patch'
default: patch

autolabeler:
- label: 'chore'
files:
- '*.md'
- 'Documentation/**'
- label: 'bug'
branch:
- '/fix\/.+/'
title:
- '/fix/i'
- '/bug/i'
- label: 'enhancement'
branch:
- '/feature\/.+/'
- label: 'dependencies'
files:
- 'global.json'
- 'Directory.Packages.props'
- '*.props'
- '*.targets'


template: |
# What's Changed

$CHANGES

**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION

3 changes: 0 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ on:
schedule:
- cron: '23 17 * * 1'

env:
AZURE_ARTIFACTS_FEED_URL: https://pkgs.dev.azure.com/bertk0374/_packaging/intern/nuget/v3/index.json

permissions:
contents: read

Expand Down
232 changes: 232 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

env:
BuildConfiguration: debug
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

permissions:
checks: write
pull-requests: write

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
timeout-minutes: 30
permissions:
pull-requests: write
contents: read
checks: write

steps:
- uses: actions/checkout@v6.0.1
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

- name: Setup .NET 9.0
uses: actions/setup-dotnet@v5.0.1
with:
dotnet-version: 9.0.x
# source-url: https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json
# env:
# NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_TOKEN }}

- name: Setup .NET 8.0
uses: actions/setup-dotnet@v5.0.1
with:
dotnet-version: 8.0.x
# source-url: https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json
# env:
# NUGET_AUTH_TOKEN: ${{ secrets.AZURE_DEVOPS_TOKEN }}

- name: create folders for artifacts
run: |
mkdir -p ./artifacts/bin
mkdir -p ./artifacts/package
mkdir -p ./artifacts/package/debug
mkdir -p ./artifacts/package/release
mkdir -p ./artifacts/log
mkdir -p ./artifacts/publish
mkdir -p ./artifacts/reports


- name: Restore dependencies
run: dotnet restore coverlet.sln

- name: Build
run: |
dotnet build coverlet.sln --no-restore -bl:build.binlog -c ${{env.BuildConfiguration}}
dotnet build coverlet.sln --no-restore -bl:build.binlog -c release
dotnet pack -c ${{env.BuildConfiguration}}
dotnet pack -c release

# - name: Archive production artifacts
# uses: actions/upload-artifact@v5
# with:
# name: dist-bin-and-packages
# retention-days: 5
# path: |
# artifacts/bin
# artifacts/package
# artifacts/publish
# artifacts/log
# *.binlog

# Fail if there are any failed tests
#
# We support all current LTS versions of .NET and Windows, Mac and Linux.
#
# To check for failing tests locally run `dotnet test`.

# test:
# name: Tests for .net core ${{ matrix.framework }} on ${{ matrix.os }}
# needs: build
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]
# framework: ['net9.0', 'net8.0']
# timeout-minutes: 30
# permissions:
# pull-requests: write
# steps:
# - name: Checkout
# uses: actions/checkout@v6.0.1
# with:
# fetch-depth: 0 # avoid shallow clone so nbgv can do its work.

# - name: Setup .NET 9.0
# uses: actions/setup-dotnet@v5.0.1
# with:
# dotnet-version: 9.0.x

# - name: Setup dotnet 8.0
# uses: actions/setup-dotnet@v5.0.1
# with:
# dotnet-version: '8.0.x'

# - name: Download packages and artifacts
# uses: actions/download-artifact@v5
# with:
# name: dist-bin-and-packages

- run: |
echo "Test using script"
dotnet build-server shutdown
dotnet test ./test/coverlet.core.tests/coverlet.core.tests.csproj -c ${{env.BuildConfiguration}} --no-build -bl:test.core.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" -- --results-directory "./artifacts/reports" --report-xunit-trx --report-xunit-trx-filename "coverlet.core.tests.trx" --diagnostic --diagnostic-output-directory "./artifacts/log/${{env.BuildConfiguration}}" --diagnostic-output-fileprefix "coverlet.core.tests"
dotnet build-server shutdown
dotnet test ./test/coverlet.msbuild.tasks.tests/coverlet.msbuild.tasks.tests.csproj -c ${{env.BuildConfiguration}} --no-build -bl:test.msbuild.binlog --results-directory:"./artifacts/reports" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.xunit.extensions]*%2c[coverlet.tests.projectsample]*%2c[testgen_]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"./artifacts/log/${{env.BuildConfiguration}}/coverlet.msbuild.test.diag.log;tracelevel=verbose"
dotnet build-server shutdown
dotnet test ./test/coverlet.collector.tests/coverlet.collector.tests.csproj -c ${{env.BuildConfiguration}} --no-build -bl:test.collector.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" --diag:"./artifacts/log/${{env.BuildConfiguration}}/coverlet.collector.test.diag.log;tracelevel=verbose"
dotnet build-server shutdown
dotnet test ./test/coverlet.integration.tests/coverlet.integration.tests.csproj -c ${{env.BuildConfiguration}} --no-build -bl:test.integration.binlog -- --results-directory "./artifacts/reports" --report-xunit-trx --report-xunit-trx-filename "coverlet.integration.tests.trx" --diagnostic --diagnostic-output-directory "./artifacts/log/${{env.BuildConfiguration}}" --diagnostic-output-fileprefix "coverlet.integration.tests"
name: Run unit tests with coverage
env:
MSBUILDDISABLENODEREUSE: 1

# - run: |
# echo "Test using script"
# dotnet build-server shutdown
# dotnet test ./test/coverlet.core.coverage.tests/coverlet.core.coverage.tests.csproj -c ${{env.BuildConfiguration}} --no-build -bl:test.core.coverage.binlog /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.projectsample]*" /p:ExcludeByAttribute="GeneratedCodeAttribute" -- --results-directory "./artifacts/reports" --report-xunit-trx --report-xunit-trx-filename "coverlet.core.coverage.tests.trx" --diagnostic --diagnostic-output-directory "./artifacts/log/${{env.BuildConfiguration}}" --diagnostic-output-fileprefix "coverlet.core.coverage.tests"
# name: Run unit test coverlet.core.coverage.tests
# if: success() && matrix.os == 'windows-latest'
# env:
# MSBUILDDISABLENODEREUSE: 1

- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@5.5.1
if: success() && matrix.os == 'windows-latest'
with:
reports: ./artifacts/reports/**/*.cobertura.xml
assemblyfilters: -xunit*
targetdir: ./artifacts/reports
reporttypes: HtmlInline;Cobertura;MarkdownSummaryGithub;lcov

- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2.9.4
if: success() && matrix.os == 'windows-latest' && github.event_name == 'pull_request'
with:
recreate: true
path: ./artifacts/reports/SummaryGithub.md

- name: Write to Job Summary
if: matrix.os == 'windows-latest'
run: cat ./artifacts/reports/SummaryGithub.md >> $GITHUB_STEP_SUMMARY
shell: bash

- name: Upload Test Result Files
uses: actions/upload-artifact@v5
if: always()
with:
name: test-results-${{ matrix.os }}
path: ${{ github.workspace }}/artifacts/reports/**/*
retention-days: 5

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/linux@v2
if: ${{ !cancelled() && matrix.os == 'ubuntu-latest' }}
with:
files: |
${{ github.workspace }}/artifacts/reports/**/*.trx
${{ github.workspace }}/test/**/*.trx
check_name: "Unit Tests ${{ matrix.os }}"
comment_mode: failures
compare_to_earlier_commit: false

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/macos@v2.21.0
if: ${{ !cancelled() && matrix.os == 'macos-latest' }}
with:
files: |
${{ github.workspace }}/artifacts/reports/**/*.trx
${{ github.workspace }}/test/**/*.trx
check_name: "Unit Tests ${{ matrix.os }}"
comment_mode: failures
compare_to_earlier_commit: false

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action/windows@v2.21.0
if: ${{ !cancelled() && matrix.os == 'windows-latest' }}
with:
files: |
${{ github.workspace }}/artifacts/reports/**/*.trx
${{ github.workspace }}/test/**/*.trx
check_name: "Unit Tests ${{ matrix.os }}"
comment_mode: failures
compare_to_earlier_commit: false

# - uses: bibipkins/dotnet-test-reporter@v1.6.1
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# comment-title: 'Unit Test Results ${{ matrix.os }}'
# results-path: |
# ./artifacts/reports/**/*.trx
# ./test/**/*.trx
# coverage-path: |
# ./artifacts/bin/**/*.cobertura.xml
# ./artifacts/reports/**/*.cobertura.xml
# ./test/**/*.cobertura.xml
# coverage-threshold: 80
# coverage-type: cobertura
# show-failed-tests-only: true
# show-test-output: true

# - name: Upload coverage report artifact
# if: success() && matrix.os == 'windows-latest'
# uses: actions/upload-artifact@v5
# with:
# name: CoverageReport.${{matrix.os}}.${{matrix.framework}} # Artifact name
# path: ./artifacts/CoverageReport # Directory containing files to upload
# overwrite: true
6 changes: 5 additions & 1 deletion .github/workflows/release-draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
push:
branches:
- master
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]

permissions:
contents: read
Expand All @@ -18,6 +22,6 @@ jobs:
- uses: release-drafter/release-drafter@v6
with:
prerelease: true
prerelease-identifier: beta
prerelease-identifier: preview
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ FolderProfile.pubxml
/NuGet.config
nuget.config
*.dmp
Playground*/
# extended playground
coverlet.MTP/
Playground*/
# ignore copilot agents
.github/agents/
current.diff
10 changes: 10 additions & 0 deletions BannedSymbols.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
T:System.ArgumentNullException; Use 'Guard' instead
P:System.DateTime.Now; Use 'IClock' instead
P:System.DateTime.UtcNow; Use 'IClock' instead
M:System.Threading.Tasks.Task.Run(System.Action); Use 'ITask' instead
M:System.Threading.Tasks.Task.WhenAll(System.Threading.Tasks.Task[]); Use 'ITask' instead
M:System.Threading.Tasks.Task.WhenAll(System.Collections.Generic.IEnumerable{System.Threading.Tasks.Task}); Use 'ITask' instead
M:System.String.IsNullOrEmpty(System.String); Use 'RoslynString.IsNullOrEmpty' instead
M:System.String.IsNullOrWhiteSpace(System.String); Use 'RoslynString.IsNullOrWhiteSpace' instead
M:System.Diagnostics.Debug.Assert(System.Boolean); Use 'RoslynDebug.Assert' instead
M:System.Diagnostics.Debug.Assert(System.Boolean,System.String); Use 'RoslynDebug.Assert' instead
7 changes: 6 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@
<!-- C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.DefaultOutputPaths.targets -->
<UseArtifactsOutput>true</UseArtifactsOutput>
<ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>
<CoverletVersion Condition="'$(CoverletVersion)'==''">6.0.0</CoverletVersion>
<CoverletVersion Condition="'$(CoverletVersion)'==''">8.0.0</CoverletVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<Deterministic>true</Deterministic>
</PropertyGroup>

<ItemGroup>
<VSTestLogger Include="trx%3BLogFileName=TestResults-$(TargetFramework)-$(MSBuildProjectName).trx" />
<VSTestLogger Include="html%3BLogFileName=TestResults-$(TargetFramework)-$(MSBuildProjectName).html" />
Expand Down
Loading
Loading