diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da7d18d..09d14d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,10 +56,6 @@ jobs: if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' run: dotnet tool update dotnet-sonarscanner --tool-path .sonar/scanner - - name: Install dotnet-coverage tool - if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' - run: dotnet tool update dotnet-coverage --global - - name: Begin SonarCloud analysis if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' run: | @@ -68,7 +64,7 @@ jobs: /o:"visus" \ /d:sonar.token="$SONAR_TOKEN" \ /d:sonar.host.url="https://sonarcloud.io" \ - /d:sonar.cs.vscoveragexml.reportsPaths="coverage.xml" \ + /d:sonar.cs.opencover.reportsPaths="coverage.opencover.xml" \ /d:sonar.cs.vstest.reportsPaths="**/TestResults/**/*.trx" - name: Build @@ -77,16 +73,14 @@ jobs: - name: Run tests run: | dotnet test -c Release --no-build --no-restore -- \ - --coverage \ - --coverage-output-format xml \ + --coverlet \ --report-trx - - name: Merge coverage reports + - name: Copy final coverage report if: github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' run: | - dotnet-coverage merge "tests/**/TestResults/*.xml" \ - --output coverage.xml \ - --output-format xml + # Find the latest coverage file and copy to solution root + find tests -name "coverage.opencover.*.xml" -type f -print0 | xargs -0 ls -t | head -1 | xargs -I {} cp {} coverage.opencover.xml - name: Upload test results if: always() diff --git a/Directory.Build.props b/Directory.Build.props index b222d5e..612d489 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,6 +9,11 @@ enable + + false + false + + true false diff --git a/Directory.Packages.props b/Directory.Packages.props index cf96f81..c6de3be 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -8,6 +8,7 @@ + @@ -47,6 +48,7 @@ all analyzers + diff --git a/tests/Visus.AddressValidation.Integration.FedEx.Tests/Visus.AddressValidation.Integration.FedEx.Tests.csproj b/tests/Visus.AddressValidation.Integration.FedEx.Tests/Visus.AddressValidation.Integration.FedEx.Tests.csproj index 891aec6..bec913b 100644 --- a/tests/Visus.AddressValidation.Integration.FedEx.Tests/Visus.AddressValidation.Integration.FedEx.Tests.csproj +++ b/tests/Visus.AddressValidation.Integration.FedEx.Tests/Visus.AddressValidation.Integration.FedEx.Tests.csproj @@ -18,6 +18,9 @@ PreserveNewest + + Always + diff --git a/tests/Visus.AddressValidation.Integration.FedEx.Tests/testconfig.json b/tests/Visus.AddressValidation.Integration.FedEx.Tests/testconfig.json new file mode 100644 index 0000000..dd6b338 --- /dev/null +++ b/tests/Visus.AddressValidation.Integration.FedEx.Tests/testconfig.json @@ -0,0 +1,11 @@ +{ + "platformOptions": { + "Coverlet": { + "format": "opencover", + "exclude": "[*.Tests]*,[coverlet.*]*,[xunit.*]*,[TUnit.*]*,[Verify.*]*", + "excludeByAttribute": "GeneratedCode,ExcludeFromCodeCoverage,ExcludeFromCodeCoverageAttribute,CompilerGeneratedAttribute", + "skipAutoProps": true, + "mergeWith": "../../../../../coverage.opencover.xml" + } + } +} diff --git a/tests/Visus.AddressValidation.Integration.Google.Tests/Visus.AddressValidation.Integration.Google.Tests.csproj b/tests/Visus.AddressValidation.Integration.Google.Tests/Visus.AddressValidation.Integration.Google.Tests.csproj index 76fcc0e..41e56ef 100644 --- a/tests/Visus.AddressValidation.Integration.Google.Tests/Visus.AddressValidation.Integration.Google.Tests.csproj +++ b/tests/Visus.AddressValidation.Integration.Google.Tests/Visus.AddressValidation.Integration.Google.Tests.csproj @@ -14,4 +14,10 @@ + + + Always + + + diff --git a/tests/Visus.AddressValidation.Integration.Google.Tests/testconfig.json b/tests/Visus.AddressValidation.Integration.Google.Tests/testconfig.json new file mode 100644 index 0000000..dd6b338 --- /dev/null +++ b/tests/Visus.AddressValidation.Integration.Google.Tests/testconfig.json @@ -0,0 +1,11 @@ +{ + "platformOptions": { + "Coverlet": { + "format": "opencover", + "exclude": "[*.Tests]*,[coverlet.*]*,[xunit.*]*,[TUnit.*]*,[Verify.*]*", + "excludeByAttribute": "GeneratedCode,ExcludeFromCodeCoverage,ExcludeFromCodeCoverageAttribute,CompilerGeneratedAttribute", + "skipAutoProps": true, + "mergeWith": "../../../../../coverage.opencover.xml" + } + } +} diff --git a/tests/Visus.AddressValidation.Integration.PitneyBowes.Tests/Visus.AddressValidation.Integration.PitneyBowes.Tests.csproj b/tests/Visus.AddressValidation.Integration.PitneyBowes.Tests/Visus.AddressValidation.Integration.PitneyBowes.Tests.csproj index 55c3243..1a9ed22 100644 --- a/tests/Visus.AddressValidation.Integration.PitneyBowes.Tests/Visus.AddressValidation.Integration.PitneyBowes.Tests.csproj +++ b/tests/Visus.AddressValidation.Integration.PitneyBowes.Tests/Visus.AddressValidation.Integration.PitneyBowes.Tests.csproj @@ -14,4 +14,10 @@ + + + Always + + + diff --git a/tests/Visus.AddressValidation.Integration.PitneyBowes.Tests/testconfig.json b/tests/Visus.AddressValidation.Integration.PitneyBowes.Tests/testconfig.json new file mode 100644 index 0000000..dd6b338 --- /dev/null +++ b/tests/Visus.AddressValidation.Integration.PitneyBowes.Tests/testconfig.json @@ -0,0 +1,11 @@ +{ + "platformOptions": { + "Coverlet": { + "format": "opencover", + "exclude": "[*.Tests]*,[coverlet.*]*,[xunit.*]*,[TUnit.*]*,[Verify.*]*", + "excludeByAttribute": "GeneratedCode,ExcludeFromCodeCoverage,ExcludeFromCodeCoverageAttribute,CompilerGeneratedAttribute", + "skipAutoProps": true, + "mergeWith": "../../../../../coverage.opencover.xml" + } + } +} diff --git a/tests/Visus.AddressValidation.Integration.Ups.Tests/Visus.AddressValidation.Integration.Ups.Tests.csproj b/tests/Visus.AddressValidation.Integration.Ups.Tests/Visus.AddressValidation.Integration.Ups.Tests.csproj index cae9b39..616f871 100644 --- a/tests/Visus.AddressValidation.Integration.Ups.Tests/Visus.AddressValidation.Integration.Ups.Tests.csproj +++ b/tests/Visus.AddressValidation.Integration.Ups.Tests/Visus.AddressValidation.Integration.Ups.Tests.csproj @@ -13,4 +13,10 @@ + + + + Always + + diff --git a/tests/Visus.AddressValidation.Integration.Ups.Tests/testconfig.json b/tests/Visus.AddressValidation.Integration.Ups.Tests/testconfig.json new file mode 100644 index 0000000..dd6b338 --- /dev/null +++ b/tests/Visus.AddressValidation.Integration.Ups.Tests/testconfig.json @@ -0,0 +1,11 @@ +{ + "platformOptions": { + "Coverlet": { + "format": "opencover", + "exclude": "[*.Tests]*,[coverlet.*]*,[xunit.*]*,[TUnit.*]*,[Verify.*]*", + "excludeByAttribute": "GeneratedCode,ExcludeFromCodeCoverage,ExcludeFromCodeCoverageAttribute,CompilerGeneratedAttribute", + "skipAutoProps": true, + "mergeWith": "../../../../../coverage.opencover.xml" + } + } +} diff --git a/tests/Visus.AddressValidation.SourceGeneration.Tests/Visus.AddressValidation.SourceGeneration.Tests.csproj b/tests/Visus.AddressValidation.SourceGeneration.Tests/Visus.AddressValidation.SourceGeneration.Tests.csproj index dfc7a44..8d3645c 100644 --- a/tests/Visus.AddressValidation.SourceGeneration.Tests/Visus.AddressValidation.SourceGeneration.Tests.csproj +++ b/tests/Visus.AddressValidation.SourceGeneration.Tests/Visus.AddressValidation.SourceGeneration.Tests.csproj @@ -17,4 +17,10 @@ + + + Always + + + diff --git a/tests/Visus.AddressValidation.SourceGeneration.Tests/testconfig.json b/tests/Visus.AddressValidation.SourceGeneration.Tests/testconfig.json new file mode 100644 index 0000000..dd6b338 --- /dev/null +++ b/tests/Visus.AddressValidation.SourceGeneration.Tests/testconfig.json @@ -0,0 +1,11 @@ +{ + "platformOptions": { + "Coverlet": { + "format": "opencover", + "exclude": "[*.Tests]*,[coverlet.*]*,[xunit.*]*,[TUnit.*]*,[Verify.*]*", + "excludeByAttribute": "GeneratedCode,ExcludeFromCodeCoverage,ExcludeFromCodeCoverageAttribute,CompilerGeneratedAttribute", + "skipAutoProps": true, + "mergeWith": "../../../../../coverage.opencover.xml" + } + } +} diff --git a/tests/Visus.AddressValidation.Tests/Visus.AddressValidation.Tests.csproj b/tests/Visus.AddressValidation.Tests/Visus.AddressValidation.Tests.csproj index 77f04c7..6b3610c 100644 --- a/tests/Visus.AddressValidation.Tests/Visus.AddressValidation.Tests.csproj +++ b/tests/Visus.AddressValidation.Tests/Visus.AddressValidation.Tests.csproj @@ -13,4 +13,10 @@ + + + Always + + + diff --git a/tests/Visus.AddressValidation.Tests/testconfig.json b/tests/Visus.AddressValidation.Tests/testconfig.json new file mode 100644 index 0000000..dd6b338 --- /dev/null +++ b/tests/Visus.AddressValidation.Tests/testconfig.json @@ -0,0 +1,11 @@ +{ + "platformOptions": { + "Coverlet": { + "format": "opencover", + "exclude": "[*.Tests]*,[coverlet.*]*,[xunit.*]*,[TUnit.*]*,[Verify.*]*", + "excludeByAttribute": "GeneratedCode,ExcludeFromCodeCoverage,ExcludeFromCodeCoverageAttribute,CompilerGeneratedAttribute", + "skipAutoProps": true, + "mergeWith": "../../../../../coverage.opencover.xml" + } + } +}