Skip to content
Draft
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
7 changes: 7 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"regitlint"
],
"rollForward": false
},
"dotnet-reportgenerator-globaltool": {
"version": "5.5.0",
"commands": [
"reportgenerator"
],
"rollForward": false
}
}
}
45 changes: 15 additions & 30 deletions .github/workflows/Steeltoe.All.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@ permissions:
pull-requests: write

env:
STEELTOE_MACOS_DIAGNOSE_HOSTNAME_LOOKUP: true
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 }}/dumps
--settings coverlet.runsettings --blame-crash --blame-hang-timeout 3m
--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:
Expand All @@ -36,9 +38,9 @@ jobs:
- os: ubuntu-latest
runDockerContainers: true
- os: windows-latest
skipFilter: Category!=Integration
skipIntegrationTests: true
- os: macos-latest
skipFilter: Category!=Integration
skipIntegrationTests: true
runs-on: ${{ matrix.os }}
continue-on-error: true

Expand Down Expand Up @@ -89,38 +91,20 @@ jobs:
- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal

- name: Set skip filters for tests
shell: bash
run: |
echo SKIP_FILTER_NO_MEMORY_DUMPS="${{ matrix.skipFilter && format('{0}&Category!=MemoryDumps', matrix.skipFilter) || 'Category!=MemoryDumps' }}" >> $GITHUB_ENV
echo SKIP_FILTER_WITH_MEMORY_DUMPS="${{ matrix.skipFilter && format('{0}&Category=MemoryDumps', matrix.skipFilter) || 'Category=MemoryDumps' }}" >> $GITHUB_ENV

- name: Test (net10.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net10.0 --filter "${{ env.SKIP_FILTER_NO_MEMORY_DUMPS }}" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net10.0) (memory dumps)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net10.0 --filter "${{ env.SKIP_FILTER_WITH_MEMORY_DUMPS }}" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net9.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net9.0 --filter "${{ env.SKIP_FILTER_NO_MEMORY_DUMPS }}" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net9.0) (memory dumps)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net9.0 --filter "${{ env.SKIP_FILTER_WITH_MEMORY_DUMPS }}" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net8.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net8.0 --filter "${{ env.SKIP_FILTER_NO_MEMORY_DUMPS }}" ${{ env.COMMON_TEST_ARGS }}
- name: Test
run: dotnet test --solution ${{ env.SOLUTION_FILE }} --filter-query "${{ matrix.skipIntegrationTests == true && '/[(Category!=MemoryDumps)&(Category!=Integration)]' || '/[Category!=MemoryDumps]' }}" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net8.0) (memory dumps)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net8.0 --filter "${{ env.SKIP_FILTER_WITH_MEMORY_DUMPS }}" ${{ env.COMMON_TEST_ARGS }}
- name: Test (memory dumps)
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() }}
uses: actions/upload-artifact@v5
with:
name: FailedTestOutput-${{ matrix.os }}
path: |
${{ github.workspace }}/dumps/**/*.dmp
${{ github.workspace }}/dumps/**/Sequence_*.xml
${{ env.TEST_OUTPUT_DIRECTORY }}/*.dmp
${{ env.TEST_OUTPUT_DIRECTORY }}/Sequence_*.xml
if-no-files-found: ignore

- name: Report test results
Expand All @@ -129,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'
Expand Down
35 changes: 12 additions & 23 deletions .github/workflows/component-shared-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ permissions:
pull-requests: write

env:
STEELTOE_MACOS_DIAGNOSE_HOSTNAME_LOOKUP: true
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 }}/dumps
--settings coverlet.runsettings --blame-crash --blame-hang-timeout 3m
--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:
Expand Down Expand Up @@ -79,35 +81,21 @@ jobs:
- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal

- name: Test (net10.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net10.0 --filter "Category!=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}
- name: Test
run: dotnet test --solution ${{ env.SOLUTION_FILE }} --filter-not-trait "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net10.0) (memory dumps)
- name: Test (memory dumps)
if: ${{ inputs.component == 'Management' }}
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net10.0 --filter "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net9.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net9.0 --filter "Category!=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net9.0) (memory dumps)
if: ${{ inputs.component == 'Management' }}
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net9.0 --filter "Category=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net8.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net8.0 --filter "Category!=MemoryDumps" ${{ env.COMMON_TEST_ARGS }}

- name: Test (net8.0) (memory dumps)
if: ${{ inputs.component == 'Management' }}
run: dotnet test ${{ env.SOLUTION_FILE }} --framework net8.0 --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() }}
uses: actions/upload-artifact@v5
with:
name: FailedTestOutput-${{ inputs.OS }}-latest
path: |
${{ github.workspace }}/dumps/**/*.dmp
${{ github.workspace }}/dumps/**/Sequence_*.xml
${{ env.TEST_OUTPUT_DIRECTORY }}/*.dmp
${{ env.TEST_OUTPUT_DIRECTORY }}/Sequence_*.xml
if-no-files-found: ignore

- name: Report test results
Expand All @@ -116,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'
38 changes: 22 additions & 16 deletions .github/workflows/sonarcube.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ permissions:
pull-requests: write

env:
STEELTOE_MACOS_DIAGNOSE_HOSTNAME_LOOKUP: true
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 }}
--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.config

jobs:
analyze:
Expand Down Expand Up @@ -73,29 +75,33 @@ jobs:
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: >-
# TODO: Revert to OpenCover, see https://github.com/microsoft/testfx/issues/7104
# /d:sonar.cs.opencover.reportsPaths=**/coverage.opencover.xml
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=TestOutput/SonarQube.xml

- name: Build solution
run: dotnet build ${{ env.SOLUTION_FILE }} --no-restore --configuration Release --verbosity minimal

- name: Test (net10.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category!=MemoryDumps" --framework net10.0 ${{ env.SONAR_TEST_ARGS }}
- name: Test
run: dotnet test --solution ${{ env.SOLUTION_FILE }} --filter-not-trait "Category=MemoryDumps" ${{ env.SONAR_TEST_ARGS }}

- name: Test (net10.0) (memory dumps)
run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category=MemoryDumps" --framework net10.0 ${{ env.SONAR_TEST_ARGS }}
- name: Test (memory dumps)
run: dotnet test --project src/Management/test/Endpoint.Test/Steeltoe.Management.Endpoint.Test.csproj --filter-trait "Category=MemoryDumps" ${{ env.SONAR_TEST_ARGS }}

- name: Test (net9.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category!=MemoryDumps" --framework net9.0 ${{ env.SONAR_TEST_ARGS }}
- name: 'TEMP: List files before coverage conversion'
run: find ${{ env.TEST_OUTPUT_DIRECTORY }}

- name: Test (net9.0) (memory dumps)
run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category=MemoryDumps" --framework net9.0 ${{ env.SONAR_TEST_ARGS }}

- name: Test (net8.0)
run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category!=MemoryDumps" --framework net8.0 ${{ env.SONAR_TEST_ARGS }}
- name: Convert Cobertura to Sonar format using ReportGenerator
uses: danielpalme/[email protected]
with:
reports: '${{ env.TEST_OUTPUT_DIRECTORY }}/*cobertura.xml'
targetdir: '${{ env.TEST_OUTPUT_DIRECTORY }}'
reporttypes: 'SonarQube'
filefilters: '-*.g.cs'

- name: Test (net8.0) (memory dumps)
run: dotnet test ${{ env.SOLUTION_FILE }} --filter "Category=MemoryDumps" --framework net8.0 ${{ env.SONAR_TEST_ARGS }}
- name: 'TEMP: List files after coverage conversion'
run: find ${{ env.TEST_OUTPUT_DIRECTORY }}

- name: End Sonar .NET scanner
if: ${{ !cancelled() && steps.sonar_begin.outcome == 'success' }}
Expand Down
12 changes: 9 additions & 3 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
<Project>
<!-- Workaround for https://github.com/microsoft/testfx/issues/7045#issuecomment-3611560686 -->
<Target Name="WorkaroundMacOSDumpIssue" AfterTargets="Build"
Condition="$([MSBuild]::IsOSPlatform('OSX')) AND '$(UseAppHost)' != 'false' AND '$(OutputType)' == 'Exe' AND '$(TargetFramework)' != '' AND '$(RunCommand)' != '' AND '$(RunCommand)' != 'dotnet'">
<Exec Command="codesign --sign - --force --entitlements '$(MSBuildThisFileDirectory)macos-dump-entitlements.plist' '$(RunCommand)'" />
</Target>

<!--
Steeltoe: This file was copied from the .NET Aspire Configuration Schema generator
Steeltoe: The remainder of this file was copied from the .NET Aspire Configuration Schema generator
at https://github.com/dotnet/aspire/tree/cb7cc4d78f8dd2b4df1053a229493cdbf88f50df/src/Tools/ConfigurationSchemaGenerator.
-->

Expand Down Expand Up @@ -101,7 +107,7 @@
<Exec Command="$(GeneratorCommandLine)" />

<ItemGroup>
<FileWrites Include="$(GeneratedConfigurationSchemaOutputPath)" Condition="Exists('$(GeneratedConfigurationSchemaOutputPath)')"/>
<FileWrites Include="$(GeneratedConfigurationSchemaOutputPath)" Condition="Exists('$(GeneratedConfigurationSchemaOutputPath)')" />
</ItemGroup>
</Target>

Expand All @@ -123,7 +129,7 @@
</PropertyGroup>

<Warning Condition="'$(CurrentConfigurationSchemaFileContent)' != '$(GeneratedConfigurationSchemaFileContent)'"
Text="ConfigurationSchema.json is out of date for $(MSBuildProjectFile). Run 'dotnet build --no-incremental /p:UpdateConfigurationSchema=true' to update it." />
Text="ConfigurationSchema.json is out of date for $(MSBuildProjectFile). Run 'dotnet build --no-incremental /p:UpdateConfigurationSchema=true' to update it." />
</Target>

</Project>
29 changes: 29 additions & 0 deletions coverage.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<!--
This file format is documented at https://github.com/microsoft/codecoverage/blob/main/docs/configuration.md.
CAUTION: Microsoft Testing Platform uses different defaults, see https://learn.microsoft.com/en-us/dotnet/core/testing/microsoft-testing-platform-extensions-code-coverage.
-->
<Format>cobertura</Format>
<DeterministicReport>true</DeterministicReport>
<CodeCoverage>
<ModulePaths>
<Exclude>
<ModulePath>.*ConfigurationSchemaGenerator.*</ModulePath>
</Exclude>
</ModulePaths>
<Attributes>
<Exclude>
<Attribute>^System\.ObsoleteAttribute$</Attribute>
<Attribute>^System\.CodeDom\.Compiler\.GeneratedCodeAttribute$</Attribute>
<Attribute>^System\.Runtime\.CompilerServices\.CompilerGeneratedAttribute$</Attribute>
<Attribute>^System\.Diagnostics\.CodeAnalysis\.ExcludeFromCodeCoverageAttribute$</Attribute>
</Exclude>
</Attributes>
<Sources>
<Exclude>
<Source>.*\\test\\.*</Source>
</Exclude>
</Sources>
</CodeCoverage>
</Configuration>
16 changes: 0 additions & 16 deletions coverlet.runsettings

This file was deleted.

5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
16 changes: 16 additions & 0 deletions macos-dump-entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>
16 changes: 16 additions & 0 deletions mtp-test-entitlements.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
<key>com.apple.security.cs.debugger</key>
<true/>
<key>com.apple.security.get-task-allow</key>
<true/>
</dict>
</plist>
6 changes: 1 addition & 5 deletions nuget.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="test-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
</packageSources>
<packageSourceMapping>
<packageSource key="nuget.org">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
Loading
Loading