diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 55f29f3..2d244dc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -24,9 +24,12 @@ jobs:
- os: windows-latest
name: Build & test (Windows)
framework_args:
+ upload_coverage: false
- os: ubuntu-latest
name: Build & test (Ubuntu)
framework_args:
+ coverage_args: --collect:"XPlat Code Coverage"
+ upload_coverage: true
runs-on: ${{ matrix.os }}
permissions:
contents: read
@@ -41,7 +44,15 @@ jobs:
run: dotnet build ${{ env.SOLUTION }} --configuration Release --no-restore ${{ matrix.framework_args }}
- name: Test
- run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-restore --no-build ${{ matrix.framework_args }} --logger "console;verbosity=normal"
+ run: dotnet test ${{ env.SOLUTION }} --configuration Release --no-restore --no-build ${{ matrix.framework_args }} ${{ matrix.coverage_args }} --logger GitHubActions
+
+ - name: Upload coverage to Codecov
+ if: matrix.upload_coverage
+ uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # https://github.com/codecov/codecov-action/releases/tag/v7.1.1
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }} # Needed for protected branches
+ files: test/**/TestResults/**/coverage.cobertura.xml
+ fail_ci_if_error: true
pack:
name: Create NuGet package
diff --git a/.gitignore b/.gitignore
index f1e3d20..fba0832 100644
--- a/.gitignore
+++ b/.gitignore
@@ -152,6 +152,7 @@ PublishScripts/
# NuGet Packages
*.nupkg
+N.png
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
diff --git a/README.md b/README.md
index f140f63..1f8bd44 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
[](https://sonarcloud.io/summary/new_code?id=nlog.mailkit)
[](https://sonarcloud.io/summary/new_code?id=nlog.mailkit)
[](https://sonarcloud.io/project/issues?id=nlog.mailkit&resolved=false&types=CODE_SMELL)
-[](https://sonarcloud.io/component_measures?id=nlog.mailkit&metric=coverage)
+[](https://codecov.io/gh/NLog/NLog.MailKit)
Alternative Mail target for [NLog](https://github.com/NLog/NLog) using [MailKit](https://github.com/jstedfast/MailKit).
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
deleted file mode 100644
index 84c9337..0000000
--- a/azure-pipelines.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-name: '$(Rev:r)' # Build.BuildId
-trigger:
-- master
-pool:
- name: Azure Pipelines
- vmImage: 'windows-latest'
- demands:
- - msbuild
- - visualstudio
- - vstest
-
-variables:
- Solution: 'src/NLog.MailKit.sln'
- BuildPlatform: 'Any CPU'
- BuildConfiguration: 'Release'
-
-steps:
-- task: DotNetCoreCLI@2
- displayName: 'dotnet restore'
- inputs:
- command: restore
- projects: '$(Solution)'
- verbosityRestore: Minimal
-
-- task: SonarCloudPrepare@4.2.6
- displayName: 'Prepare SonarCloud analysis'
- inputs:
- SonarCloud: 'Sonarcloud'
- organization: nlog
- projectKey: nlog.mailkit
- projectName: 'NLog Mailkit'
-
-- task: VSBuild@1
- displayName: 'Build'
- inputs:
- solution: '$(Solution)'
- msbuildArgs: '-v:m -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:ContinuousIntegrationBuild=true -p:EmbedUntrackedSources=true'
- platform: '$(BuildPlatform)'
- configuration: '$(BuildConfiguration)'
- maximumCpuCount: true
- logProjectEvents: false
-
-- task: VSTest@3
- displayName: 'Run Tests'
- inputs:
- testAssemblyVer2: |
- **\*.tests.dll
- !**\obj\**
- !**\ref\**
- codeCoverageEnabled: true
- platform: '$(BuildPlatform)'
- configuration: '$(BuildConfiguration)'
- rerunFailedTests: true
-
-- task: SonarCloudAnalyze@4.2.6
- displayName: 'Run SonarCloud Analysis'
-
-- task: SonarCloudPublish@4.2.6
- displayName: 'Publish SonarCloud Quality Gate'
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 0000000..2cd6145
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,10 @@
+coverage:
+ range: 60..70
+ status:
+ project:
+ default:
+ target: 70%
+ patch:
+ default:
+ target: auto
+ threshold: 1%
\ No newline at end of file
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
new file mode 100644
index 0000000..552d14f
--- /dev/null
+++ b/src/Directory.Build.props
@@ -0,0 +1,8 @@
+
+
+ true
+ all
+ low
+ $(WarningsAsErrors);NU1900;NU1901;NU1902;NU1903;NU1904
+
+
\ No newline at end of file
diff --git a/src/NLog.MailKit.sln b/src/NLog.MailKit.sln
index 7860ac6..b2e9130 100644
--- a/src/NLog.MailKit.sln
+++ b/src/NLog.MailKit.sln
@@ -9,8 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.MailKit.Tests", "..\te
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C5050808-B92D-44C2-9EA4-24E4533325C9}"
ProjectSection(SolutionItems) = preProject
- ..\azure-pipelines.yml = ..\azure-pipelines.yml
- ..\.github\workflows\build-and-test.yml = ..\.github\workflows\build-and-test.yml
+ ..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml
+ ..\codecov.yml = ..\codecov.yml
EndProjectSection
EndProject
Global
diff --git a/src/NLog.MailKit/NLog.MailKit.csproj b/src/NLog.MailKit/NLog.MailKit.csproj
index 0628765..a3a1b40 100644
--- a/src/NLog.MailKit/NLog.MailKit.csproj
+++ b/src/NLog.MailKit/NLog.MailKit.csproj
@@ -54,7 +54,7 @@ See https://github.com/NLog/NLog.MailKit/releases
-
+
diff --git a/test/NLog.MailKit.Tests/NLog.MailKit.Tests.csproj b/test/NLog.MailKit.Tests/NLog.MailKit.Tests.csproj
index 731815e..e513dd5 100644
--- a/test/NLog.MailKit.Tests/NLog.MailKit.Tests.csproj
+++ b/test/NLog.MailKit.Tests/NLog.MailKit.Tests.csproj
@@ -9,6 +9,8 @@
+
+