diff --git a/.github/workflows/Steeltoe.All.yml b/.github/workflows/Steeltoe.All.yml index bb88a9492c..a5b65e8c0c 100644 --- a/.github/workflows/Steeltoe.All.yml +++ b/.github/workflows/Steeltoe.All.yml @@ -21,9 +21,10 @@ env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: true SOLUTION_FILE: 'src/Steeltoe.All.sln' + TEST_OUTPUT_DIRECTORY: '${{ github.workspace }}/TestOutput' COMMON_TEST_ARGS: >- - --no-build --configuration Release --collect "XPlat Code Coverage" --logger trx --results-directory ${{ github.workspace }}/TestOutput - --settings coverlet.runsettings --blame-crash --blame-hang-timeout 1m + --no-build --no-progress --configuration Release --results-directory '${{ github.workspace }}/TestOutput' + --report-trx --coverage --coverage-settings coverage.config --crashdump --hangdump --hangdump-timeout 1m jobs: analyze: @@ -91,10 +92,10 @@ jobs: run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal - name: Test - run: dotnet test ${{ env.SOLUTION_FILE }} --filter "${{ matrix.skipIntegrationTests == true && 'Category!=MemoryDumps&Category!=Integration' || 'Category!=MemoryDumps' }}" ${{ env.COMMON_TEST_ARGS }} + run: dotnet test --solution ${{ env.SOLUTION_FILE }} --filter-query "${{ matrix.skipIntegrationTests == true && '/[(Category!=MemoryDumps)&(Category!=Integration)]' || '/[Category!=MemoryDumps]' }}" ${{ env.COMMON_TEST_ARGS }} - name: Test (memory dumps) - run: dotnet test src/Management/test/Endpoint.Test --filter "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }} + run: dotnet test --project src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj --filter-trait "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }} - name: Upload crash/hang dumps (on failure) if: ${{ failure() }} @@ -102,8 +103,8 @@ jobs: with: name: FailedTestOutput-${{ matrix.os }} path: | - ${{ github.workspace }}/TestOutput/**/*.dmp - ${{ github.workspace }}/TestOutput/**/Sequence_*.xml + ${{ env.TEST_OUTPUT_DIRECTORY }}/*.dmp + ${{ env.TEST_OUTPUT_DIRECTORY }}/Sequence_*.xml if-no-files-found: ignore - name: Report test results @@ -112,14 +113,15 @@ jobs: with: name: ${{ matrix.os }} test results reporter: dotnet-trx - path: '**/*.trx' + path: '${{ env.TEST_OUTPUT_DIRECTORY }}/*.trx' + path-replace-backslashes: true fail-on-empty: 'true' fail-on-error: 'false' - name: Generate code coverage report uses: danielpalme/ReportGenerator-GitHub-Action@v5 with: - reports: '**/coverage.opencover.xml' + reports: '${{ env.TEST_OUTPUT_DIRECTORY }}/*cobertura.xml' targetdir: 'coveragereport' reporttypes: 'MarkdownAssembliesSummary;MarkdownSummaryGithub' filefilters: '-*.g.cs' diff --git a/.github/workflows/component-shared-workflow.yml b/.github/workflows/component-shared-workflow.yml index 52ca149a42..1df0267540 100644 --- a/.github/workflows/component-shared-workflow.yml +++ b/.github/workflows/component-shared-workflow.yml @@ -23,9 +23,10 @@ env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: true SOLUTION_FILE: 'src/Steeltoe.${{ inputs.component }}.slnf' + TEST_OUTPUT_DIRECTORY: '${{ github.workspace }}/TestOutput' COMMON_TEST_ARGS: >- - --no-build --configuration Release --collect "XPlat Code Coverage" --logger trx --results-directory ${{ github.workspace }}/TestOutput - --settings coverlet.runsettings --blame-crash --blame-hang-timeout 1m + --no-build --no-progress --configuration Release --results-directory '${{ github.workspace }}/TestOutput' + --report-trx --coverage --coverage-settings coverage.config --crashdump --hangdump --hangdump-timeout 1m jobs: build: @@ -81,11 +82,11 @@ jobs: run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal - name: Test - run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category!=MemoryDumps" ${{ env.COMMON_TEST_ARGS }} + run: dotnet test --solution ${{ env.SOLUTION_FILE }} --filter-not-trait "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }} - name: Test (memory dumps) if: ${{ inputs.component == 'Management' }} - run: dotnet test src/Management/test/Endpoint.Test --filter "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }} + run: dotnet test --project src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj --filter-trait "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }} - name: Upload crash/hang dumps (on failure) if: ${{ failure() }} @@ -93,8 +94,8 @@ jobs: with: name: FailedTestOutput-${{ inputs.OS }}-latest path: | - ${{ github.workspace }}/TestOutput/**/*.dmp - ${{ github.workspace }}/TestOutput/**/Sequence_*.xml + ${{ env.TEST_OUTPUT_DIRECTORY }}/*.dmp + ${{ env.TEST_OUTPUT_DIRECTORY }}/Sequence_*.xml if-no-files-found: ignore - name: Report test results @@ -103,6 +104,7 @@ jobs: with: name: ${{ inputs.OS }}-latest test results reporter: dotnet-trx - path: '**/*.trx' + path: '${{ env.TEST_OUTPUT_DIRECTORY }}/*.trx' + path-replace-backslashes: true fail-on-empty: 'true' fail-on-error: 'false' diff --git a/.github/workflows/sonarcube.yml b/.github/workflows/sonarcube.yml index c336b6e073..33bae61c5a 100644 --- a/.github/workflows/sonarcube.yml +++ b/.github/workflows/sonarcube.yml @@ -22,9 +22,10 @@ env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: true SOLUTION_FILE: 'src/Steeltoe.All.sln' + TEST_OUTPUT_DIRECTORY: '${{ github.workspace }}/TestOutput' SONAR_TEST_ARGS: >- - --no-build --configuration Release --collect "XPlat Code Coverage" --logger trx --results-directory ${{ github.workspace }}/TestOutput - --settings coverlet.runsettings -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.UseSourceLink=false + --no-build --no-progress --configuration Release --results-directory '${{ github.workspace }}/TestOutput' + --report-trx --coverage --coverage-settings coverage.sonar.config jobs: analyze: @@ -75,16 +76,24 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: >- dotnet sonarscanner begin /k:"SteeltoeOSS_steeltoe" /o:"steeltoeoss" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" - /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml + /d:sonar.host.url="https://sonarcloud.io" /d:sonar.coverageReportPaths="${{ env.TEST_OUTPUT_DIRECTORY }}/SonarQube.xml" - name: Build solution run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal - name: Test - run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category!=MemoryDumps" ${{ env.SONAR_TEST_ARGS }} + run: dotnet test --solution ${{ env.SOLUTION_FILE }} --filter-not-trait "Category=MemoryDumps" ${{ env.SONAR_TEST_ARGS }} - name: Test (memory dumps) - run: dotnet test src/Management/test/Endpoint.Test --filter "Category=MemoryDumps" ${{ env.SONAR_TEST_ARGS }} + run: dotnet test --project src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj --filter-trait "Category=MemoryDumps" ${{ env.SONAR_TEST_ARGS }} + + - name: Convert Cobertura coverage to Sonar format + uses: danielpalme/ReportGenerator-GitHub-Action@v5 + with: + reports: '${{ env.TEST_OUTPUT_DIRECTORY }}/*cobertura.xml' + targetdir: '${{ env.TEST_OUTPUT_DIRECTORY }}' + reporttypes: 'SonarQube' + filefilters: '-*.g.cs' - name: End Sonar .NET scanner if: ${{ !cancelled() && steps.sonar_begin.outcome == 'success' }} diff --git a/coverage.config b/coverage.config new file mode 100644 index 0000000000..9210688ee0 --- /dev/null +++ b/coverage.config @@ -0,0 +1,29 @@ + + + + cobertura + true + + + + .*ConfigurationSchemaGenerator.* + + + + + ^System\.ObsoleteAttribute$ + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + ^System\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$ + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + + + + + .*\\test\\.* + + + + diff --git a/coverage.sonar.config b/coverage.sonar.config new file mode 100644 index 0000000000..eb0f0fb869 --- /dev/null +++ b/coverage.sonar.config @@ -0,0 +1,32 @@ + + + + cobertura + + + + + .*ConfigurationSchemaGenerator.* + + + + + ^System\.ObsoleteAttribute$ + ^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$ + ^System\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$ + ^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$ + + + + + .*\\test\\.* + + + + diff --git a/coverlet.runsettings b/coverlet.runsettings deleted file mode 100644 index fe0adb82b8..0000000000 --- a/coverlet.runsettings +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - opencover - [ConfigurationSchemaGenerator]* - **/test/**/*.* - ObsoleteAttribute,GeneratedCodeAttribute,CompilerGeneratedAttribute - true - - - - - diff --git a/global.json b/global.json new file mode 100644 index 0000000000..3140116df3 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} diff --git a/nuget.config b/nuget.config index 128d95e590..94d8574860 100644 --- a/nuget.config +++ b/nuget.config @@ -3,10 +3,6 @@ + - - - - - diff --git a/shared-test.props b/shared-test.props index 120065dd28..58c1999cb1 100644 --- a/shared-test.props +++ b/shared-test.props @@ -5,20 +5,27 @@ $(NoWarn);S2094;S3717;SA1602;CA1062;CA1707;NU5104 + + true + + $(NoWarn);NU3018;NU3027;NU3042 + + - - + + + + - - + diff --git a/src/Connectors/test/Connectors.Test/Steeltoe.Connectors.Test.csproj b/src/Connectors/test/Connectors.Test/Steeltoe.Connectors.Test.csproj index bf2405d3f8..4002d54b0e 100644 --- a/src/Connectors/test/Connectors.Test/Steeltoe.Connectors.Test.csproj +++ b/src/Connectors/test/Connectors.Test/Steeltoe.Connectors.Test.csproj @@ -14,6 +14,7 @@ + diff --git a/src/Management/src/Endpoint/Actuators/Health/Contributors/FileSystem/NetworkShareWrapper.cs b/src/Management/src/Endpoint/Actuators/Health/Contributors/FileSystem/NetworkShareWrapper.cs index a62227d27d..c39452957d 100644 --- a/src/Management/src/Endpoint/Actuators/Health/Contributors/FileSystem/NetworkShareWrapper.cs +++ b/src/Management/src/Endpoint/Actuators/Health/Contributors/FileSystem/NetworkShareWrapper.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more information. -using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; namespace Steeltoe.Management.Endpoint.Actuators.Health.Contributors.FileSystem; @@ -27,7 +26,6 @@ private NetworkShareWrapper(ulong freeBytesAvailable, ulong totalNumberOfBytes) : null; } - [ExcludeFromCodeCoverage(Justification = "Workaround for https://github.com/coverlet-coverage/coverlet/issues/1762")] private static partial class NativeMethods { [LibraryImport("kernel32.dll", EntryPoint = "GetDiskFreeSpaceExW", StringMarshalling = StringMarshalling.Utf16, SetLastError = true)] diff --git a/src/Steeltoe.All.sln b/src/Steeltoe.All.sln index 43d8724a28..61e38a2678 100644 --- a/src/Steeltoe.All.sln +++ b/src/Steeltoe.All.sln @@ -29,7 +29,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_shared", "_shared", "{DC1B ..\.gitattributes = ..\.gitattributes ..\.gitignore = ..\.gitignore ..\cleanupcode.ps1 = ..\cleanupcode.ps1 - ..\coverlet.runsettings = ..\coverlet.runsettings + ..\coverage.config = ..\coverage.config + ..\coverage.sonar.config = ..\coverage.sonar.config ..\Directory.Build.targets = ..\Directory.Build.targets ..\nuget.config = ..\nuget.config ..\PackageReadme.md = ..\PackageReadme.md diff --git a/versions.props b/versions.props index 20d9d10375..5af6dfaca7 100644 --- a/versions.props +++ b/versions.props @@ -6,10 +6,12 @@ --> 9.0.* - 6.0.* 7.2.* 3.54.* 4.14.* + + 18.3.0-preview.25611.1 + 2.1.0-preview.25611.7 6.1.* 7.0.* 3.5.* @@ -26,9 +28,7 @@ 2.0.* 8.14.* 4.9.* - 18.0.* 3.2.* - 3.1.*