Skip to content

Commit 8c2e0e0

Browse files
committed
tets
1 parent 9256905 commit 8c2e0e0

8 files changed

Lines changed: 70 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,47 @@ jobs:
2626
with:
2727
dotnet-version: ${{ env.DOTNET_VERSION }}
2828

29+
- name: Restore local tools
30+
run: dotnet tool restore
31+
2932
- name: Restore
3033
run: dotnet restore ManagedCode.MCPGateway.slnx
3134

3235
- name: Build
3336
run: dotnet build ManagedCode.MCPGateway.slnx --configuration Release --no-restore
3437

38+
- name: Analyze
39+
run: dotnet build ManagedCode.MCPGateway.slnx --configuration Release --no-restore -p:RunAnalyzers=true
40+
41+
- name: Verify formatting
42+
run: dotnet format ManagedCode.MCPGateway.slnx --verify-no-changes
43+
44+
- name: Roslynator
45+
run: dotnet tool run roslynator analyze src/ManagedCode.MCPGateway/ManagedCode.MCPGateway.csproj tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj
46+
3547
- name: Test
3648
run: dotnet test --solution ManagedCode.MCPGateway.slnx --configuration Release --no-build --verbosity normal --report-trx --results-directory ./artifacts/test-results
3749

50+
- name: Collect coverage
51+
run: dotnet tool run coverlet tests/ManagedCode.MCPGateway.Tests/bin/Release/net10.0/ManagedCode.MCPGateway.Tests.dll --target "dotnet" --targetargs "test --solution ManagedCode.MCPGateway.slnx -c Release --no-build" --format cobertura --output artifacts/coverage/coverage.cobertura.xml
52+
53+
- name: Render coverage report
54+
run: dotnet tool run reportgenerator -reports:"artifacts/coverage/coverage.cobertura.xml" -targetdir:"artifacts/coverage-report" -reporttypes:"HtmlSummary;MarkdownSummaryGithub"
55+
3856
- name: Upload test artifacts
3957
if: always()
4058
uses: actions/upload-artifact@v4
4159
with:
4260
name: test-results
4361
path: ./artifacts/test-results/**
4462
retention-days: 5
63+
64+
- name: Upload coverage artifacts
65+
if: always()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: coverage-report
69+
path: |
70+
./artifacts/coverage/**
71+
./artifacts/coverage-report/**
72+
retention-days: 5

.github/workflows/release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ jobs:
2828
with:
2929
dotnet-version: ${{ env.DOTNET_VERSION }}
3030

31+
- name: Restore local tools
32+
run: dotnet tool restore
33+
3134
- name: Extract version from Directory.Build.props
3235
id: version
3336
shell: bash
@@ -57,6 +60,15 @@ jobs:
5760
- name: Build
5861
run: dotnet build ManagedCode.MCPGateway.slnx --configuration Release --no-restore
5962

63+
- name: Analyze
64+
run: dotnet build ManagedCode.MCPGateway.slnx --configuration Release --no-restore -p:RunAnalyzers=true
65+
66+
- name: Verify formatting
67+
run: dotnet format ManagedCode.MCPGateway.slnx --verify-no-changes
68+
69+
- name: Roslynator
70+
run: dotnet tool run roslynator analyze src/ManagedCode.MCPGateway/ManagedCode.MCPGateway.csproj tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj
71+
6072
- name: Test
6173
run: dotnet test --solution ManagedCode.MCPGateway.slnx --configuration Release --no-build --verbosity normal
6274

AGENTS.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ If no new rule is detected -> do not update the file.
8080
### Commands
8181

8282
- restore: `dotnet restore ManagedCode.MCPGateway.slnx`
83+
- tool-restore: `dotnet tool restore`
8384
- build: `dotnet build ManagedCode.MCPGateway.slnx -c Release --no-restore`
8485
- analyze: `dotnet build ManagedCode.MCPGateway.slnx -c Release --no-restore -p:RunAnalyzers=true`
8586
- test: `dotnet test --solution ManagedCode.MCPGateway.slnx -c Release --no-build`
@@ -89,7 +90,9 @@ If no new rule is detected -> do not update the file.
8990
- test-runner-help: `tests/ManagedCode.MCPGateway.Tests/bin/Release/net10.0/ManagedCode.MCPGateway.Tests --help`
9091
- format: `dotnet format ManagedCode.MCPGateway.slnx`
9192
- format-check: `dotnet format ManagedCode.MCPGateway.slnx --verify-no-changes`
92-
- coverage: `dotnet test --solution ManagedCode.MCPGateway.slnx -c Release --no-build --coverage --coverage-output-format cobertura --results-directory ./artifacts/coverage`
93+
- roslynator-analyze: `dotnet tool run roslynator analyze src/ManagedCode.MCPGateway/ManagedCode.MCPGateway.csproj tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj`
94+
- coverage: `dotnet tool run coverlet tests/ManagedCode.MCPGateway.Tests/bin/Release/net10.0/ManagedCode.MCPGateway.Tests.dll --target "dotnet" --targetargs "test --solution ManagedCode.MCPGateway.slnx -c Release --no-build" --format cobertura --output artifacts/coverage/coverage.cobertura.xml`
95+
- coverage-report: `dotnet tool run reportgenerator -reports:"artifacts/coverage/coverage.cobertura.xml" -targetdir:"artifacts/coverage-report" -reporttypes:"HtmlSummary;MarkdownSummaryGithub"`
9396

9497
### Rule Precedence
9598

@@ -109,7 +112,7 @@ If no new rule is detected -> do not update the file.
109112

110113
- Keep the standardized workflow skills first; use the extra installed inventory only when the repository actually wires that tool into commands, CI, docs, or an explicit user request.
111114
- Core .NET routing: `mcaf-dotnet`, `mcaf-dotnet-features`, `mcaf-testing`, `mcaf-dotnet-tunit`
112-
- Standardized .NET toolchain: `mcaf-dotnet-analyzer-config`, `mcaf-dotnet-code-analysis`, `mcaf-dotnet-format`, `mcaf-dotnet-roslynator`, `mcaf-dotnet-codeql`
115+
- Standardized .NET toolchain: `mcaf-dotnet-analyzer-config`, `mcaf-dotnet-code-analysis`, `mcaf-dotnet-format`, `mcaf-dotnet-roslynator`, `mcaf-dotnet-coverlet`, `mcaf-dotnet-reportgenerator`, `mcaf-dotnet-codeql`
113116
- Extended .NET catalog: `mcaf-dotnet-archunitnet`, `mcaf-dotnet-coverlet`, `mcaf-dotnet-csharpier`, `mcaf-dotnet-meziantou-analyzer`, `mcaf-dotnet-mstest`, `mcaf-dotnet-netarchtest`, `mcaf-dotnet-reportgenerator`, `mcaf-dotnet-semgrep`, `mcaf-dotnet-stryker`, `mcaf-dotnet-stylecop-analyzers`, `mcaf-dotnet-xunit`
114117
- Quality and maintainability: `mcaf-dotnet-quality-ci`, `mcaf-dotnet-complexity`, `mcaf-solid-maintainability`
115118
- Governance and docs: `mcaf-solution-governance`, `mcaf-architecture-overview`, `mcaf-adr-writing`, `mcaf-feature-spec`, `mcaf-ci-cd`
@@ -199,6 +202,7 @@ If no new rule is detected -> do not update the file.
199202
- Test framework in this repository is TUnit. Never add or keep xUnit here.
200203
- This repository uses `TUnit` on `Microsoft.Testing.Platform`; never use VSTest-only flags such as `--filter` or `--logger`, because they are not supported here.
201204
- For TUnit solution runs, always invoke `dotnet test --solution ...`; do not pass the solution path positionally.
205+
- Coverage in this repository uses the local `coverlet.console` tool against the built test assembly, then renders human-readable output with the local `reportgenerator` tool.
202206
- Every behavior change must include or update tests in `tests/ManagedCode.MCPGateway.Tests/`.
203207
- Add tests only when they close a meaningful behavior or regression gap; avoid low-signal tests that only increase count without improving confidence.
204208
- Keep tests focused on real gateway behavior:
@@ -211,7 +215,9 @@ If no new rule is detected -> do not update the file.
211215
- Do not remove tests to get green builds.
212216
- Keep `global.json` configured for `Microsoft.Testing.Platform` when TUnit is used.
213217
- At the end of implementation work, run code-size and quality verification with `cloc`, `roslynator`, and the repository's strict .NET build/test checks, then fix actionable findings so oversized files and quality drift do not accumulate.
218+
- `CSharpier` and `Stryker.NET` are installed as opt-in local tools for focused checks; they are not default formatter or default fast-path CI gates in this repository.
214219
- Run verification in this order:
220+
- tool-restore
215221
- restore
216222
- build
217223
- test

Directory.Packages.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageVersion Include="coverlet.collector" Version="8.0.0" />
76
<PackageVersion Include="DotNet.ReproducibleBuilds" Version="2.0.2" />
87
<PackageVersion Include="Microsoft.Agents.AI" Version="1.0.0-rc3" />
98
<PackageVersion Include="Microsoft.Extensions.AI" Version="10.3.0" />

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ Use these when you need design details rather than package onboarding:
494494
## Local Development
495495

496496
```bash
497+
dotnet tool restore
497498
dotnet restore ManagedCode.MCPGateway.slnx
498499
dotnet build ManagedCode.MCPGateway.slnx -c Release --no-restore
499500
dotnet test --solution ManagedCode.MCPGateway.slnx -c Release --no-build
@@ -503,4 +504,19 @@ Analyzer pass:
503504

504505
```bash
505506
dotnet build ManagedCode.MCPGateway.slnx -c Release --no-restore -p:RunAnalyzers=true
507+
dotnet tool run roslynator analyze src/ManagedCode.MCPGateway/ManagedCode.MCPGateway.csproj tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj
508+
dotnet format ManagedCode.MCPGateway.slnx --verify-no-changes
506509
```
510+
511+
Coverage and human-readable report:
512+
513+
```bash
514+
dotnet tool run coverlet tests/ManagedCode.MCPGateway.Tests/bin/Release/net10.0/ManagedCode.MCPGateway.Tests.dll --target "dotnet" --targetargs "test --solution ManagedCode.MCPGateway.slnx -c Release --no-build" --format cobertura --output artifacts/coverage/coverage.cobertura.xml
515+
dotnet tool run reportgenerator -reports:"artifacts/coverage/coverage.cobertura.xml" -targetdir:"artifacts/coverage-report" -reporttypes:"HtmlSummary;MarkdownSummaryGithub"
516+
```
517+
518+
The local tool manifest currently owns `roslynator`, `coverlet.console`, `reportgenerator`, `dotnet-stryker`, and `csharpier`.
519+
520+
- `dotnet format` remains the repository's formatter of record.
521+
- `csharpier` is installed for opt-in checks only and is not part of the default CI path.
522+
- `dotnet-stryker` is installed for focused mutation runs only and is not part of the default fast-path CI checks.

src/ManagedCode.MCPGateway/AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ For this .NET project:
4444
- `mcaf-dotnet-analyzer-config`
4545
- `mcaf-dotnet-code-analysis`
4646
- `mcaf-dotnet-codeql`
47+
- `mcaf-dotnet-coverlet`
4748
- `mcaf-dotnet-format`
4849
- `mcaf-dotnet-features`
50+
- `mcaf-dotnet-reportgenerator`
4951
- `mcaf-dotnet-roslynator`
5052
- `mcaf-testing`
5153
- `mcaf-dotnet-tunit`

tests/ManagedCode.MCPGateway.Tests/AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ Parent: `../../AGENTS.md`
2929

3030
- `build`: `dotnet build tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj -c Release --no-restore`
3131
- `test`: `dotnet test --solution ManagedCode.MCPGateway.slnx -c Release --no-build`
32+
- `coverage`: `dotnet tool run coverlet tests/ManagedCode.MCPGateway.Tests/bin/Release/net10.0/ManagedCode.MCPGateway.Tests.dll --target "dotnet" --targetargs "test --solution ManagedCode.MCPGateway.slnx -c Release --no-build" --format cobertura --output artifacts/coverage/coverage.cobertura.xml`
33+
- `coverage-report`: `dotnet tool run reportgenerator -reports:"artifacts/coverage/coverage.cobertura.xml" -targetdir:"artifacts/coverage-report" -reporttypes:"HtmlSummary;MarkdownSummaryGithub"`
3234
- `format`: `dotnet format ManagedCode.MCPGateway.slnx`
3335
- `analyze`: `dotnet build tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj -c Release --no-restore -p:RunAnalyzers=true`
3436

@@ -42,8 +44,10 @@ For this .NET project:
4244

4345
- `mcaf-dotnet-analyzer-config`
4446
- `mcaf-dotnet-code-analysis`
47+
- `mcaf-dotnet-coverlet`
4548
- `mcaf-dotnet-format`
4649
- `mcaf-testing`
50+
- `mcaf-dotnet-reportgenerator`
4751
- `mcaf-dotnet-roslynator`
4852
- `mcaf-dotnet-tunit`
4953
- `mcaf-dotnet-quality-ci`

tests/ManagedCode.MCPGateway.Tests/ManagedCode.MCPGateway.Tests.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
<ItemGroup>
1313
<PackageReference Include="Microsoft.Agents.AI" />
1414
<PackageReference Include="TUnit" />
15-
<PackageReference Include="coverlet.collector">
16-
<PrivateAssets>all</PrivateAssets>
17-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18-
</PackageReference>
1915
<PackageReference Include="Microsoft.Extensions.AI" />
2016
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
2117
<PackageReference Include="Microsoft.Extensions.Logging" />

0 commit comments

Comments
 (0)