A programming framework for agentic AI
feat: add dotnet code coverage (#5403)
Griffin Bassmanda6f91870813
diff --git a/.github/workflows/dotnet-build.yml b/.github/workflows/dotnet-build.ymlindex bf7570239..8539502b9 100644--- a/.github/workflows/dotnet-build.yml+++ b/.github/workflows/dotnet-build.yml@@ -46,8 +46,9 @@ jobs:- name: workflows has changesrun: echo "workflows has changes"if: steps.filter.outputs.workflows == 'true'+build:- name: Dotnet Build+ name: Dotnet Build & Testneeds: paths-filterif: needs.paths-filter.outputs.hasChanges == 'true'defaults:@@ -64,35 +65,12 @@ jobs:- uses: actions/checkout@v4with:lfs: true- - name: Set up Python ${{ matrix.python-version }}- uses: actions/setup-python@v5- with:- python-version: ${{ matrix.python-version }}- - name: Install jupyter and ipykernel- run: |- python -m pip install --upgrade pip- python -m pip install jupyter- python -m pip install ipykernel- - name: list available kernels- run: |- python -m jupyter kernelspec list- - uses: astral-sh/setup-uv@v5- with:- enable-cache: true- version: "0.5.18"- - run: uv sync --locked --all-extras- working-directory: ./python- - name: Prepare python venv- run: |- source ${{ github.workspace }}/python/.venv/bin/activate- name: Setup .NET 8.0uses: actions/setup-dotnet@v4with:dotnet-version: '8.0.x'- name: Restore dependencies- run: |- # dotnet nuget add source --name dotnet-tool https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json --configfile NuGet.config- dotnet restore -bl+ run: dotnet restore -bl- name: Format checkrun: |echo "Format check"@@ -104,40 +82,43 @@ jobs:dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true- name: Unit Test V1run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV1"- - name: Unit Test V2- run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV2"-- grpc-unit-tests:- name: Dotnet Grpc unit tests- needs: paths-filter- if: needs.paths-filter.outputs.hasChanges == 'true'- defaults:- run:- working-directory: dotnet- strategy:- fail-fast: false- matrix:- os: [ ubuntu-latest ]- runs-on: ${{ matrix.os }}- timeout-minutes: 30- steps:- - uses: actions/checkout@v4+ - name: Unit Test V2 (With Coverage)+ run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV2" --collect:"XPlat Code Coverage"+ - name: Install Dev Certs for GRPC+ if: matrix.os == 'ubuntu-latest'+ run: dotnet dev-certs https --trust+ - name: GRPC Tests (With Coverage)+ if: matrix.os == 'ubuntu-latest'+ run: dotnet test --no-build -bl --configuration Release --filter "Category=GRPC" --collect:"XPlat Code Coverage"+ - name: Generate & Merge Coverage Report+ if: matrix.os == 'ubuntu-latest'+ run: |+ # Install reportgenerator+ dotnet tool install -g dotnet-reportgenerator-globaltool || dotnet tool update -g dotnet-reportgenerator-globaltool+ # Ensure output directory exists+ mkdir -p ${{ github.workspace }}/dotnet/coverage-report+ # Merge all coverage reports and generate HTML + XML+ reportgenerator \+ -reports:${{ github.workspace }}/dotnet/**/TestResults/**/coverage.cobertura.xml \+ -targetdir:${{ github.workspace }}/dotnet/coverage-report \+ -reporttypes:"Cobertura;Html"+ ls -R ${{ github.workspace }}/dotnet/coverage-report+ - name: Upload Merged Coverage Report+ if: matrix.os == 'ubuntu-latest'+ uses: actions/upload-artifact@v4with:- lfs: true- - name: Setup .NET 8.0- uses: actions/setup-dotnet@v4+ name: CodeCoverageReport+ path: ${{ github.workspace }}/dotnet/coverage-report/+ retention-days: 7+ - name: Upload Coverage to Codecov+ if: matrix.os == 'ubuntu-latest'+ uses: codecov/codecov-action@v5with:- dotnet-version: '8.0.x'- - name: Install dev certs- run: dotnet --version && dotnet dev-certs https --trust- - name: Restore dependencies- run: |- # dotnet nuget add source --name dotnet-tool https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json --configfile NuGet.config- dotnet restore -bl- - name: Build- run: dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true- - name: GRPC tests- run: dotnet test --no-build -bl --configuration Release --filter "Category=GRPC"+ files: ${{ github.workspace }}/dotnet/coverage-report/*.xml+ flags: unittests+ name: dotnet-codecov+ fail_ci_if_error: true+ token: ${{ secrets.CODECOV_TOKEN }}integration-test:strategy:diff --git a/dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/Microsoft.AutoGen.Core.Grpc.Tests.csproj b/dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/Microsoft.AutoGen.Core.Grpc.Tests.csprojindex e3573c934..4f67d9727 100644--- a/dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/Microsoft.AutoGen.Core.Grpc.Tests.csproj+++ b/dotnet/test/Microsoft.AutoGen.Core.Grpc.Tests/Microsoft.AutoGen.Core.Grpc.Tests.csproj@@ -8,6 +8,10 @@</PropertyGroup><ItemGroup>+ <PackageReference Include="coverlet.collector">+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>+ <PrivateAssets>all</PrivateAssets>+ </PackageReference><ProjectReference Include="..\..\src\Microsoft.AutoGen\Core\Microsoft.AutoGen.Core.csproj" /><ProjectReference Include="..\..\src\Microsoft.AutoGen\Core.Grpc\Microsoft.AutoGen.Core.Grpc.csproj" /><PackageReference Include="Microsoft.Extensions.Hosting" />diff --git a/dotnet/test/Microsoft.AutoGen.Core.Tests/Microsoft.AutoGen.Core.Tests.csproj b/dotnet/test/Microsoft.AutoGen.Core.Tests/Microsoft.AutoGen.Core.Tests.csprojindex 29165739b..eed47c623 100644--- a/dotnet/test/Microsoft.AutoGen.Core.Tests/Microsoft.AutoGen.Core.Tests.csproj+++ b/dotnet/test/Microsoft.AutoGen.Core.Tests/Microsoft.AutoGen.Core.Tests.csproj@@ -8,6 +8,10 @@</PropertyGroup><ItemGroup>+ <PackageReference Include="coverlet.collector">+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>+ <PrivateAssets>all</PrivateAssets>+ </PackageReference><ProjectReference Include="..\..\src\Microsoft.AutoGen\Core\Microsoft.AutoGen.Core.csproj" /><PackageReference Include="Microsoft.Extensions.Hosting" /></ItemGroup>diff --git a/dotnet/test/Microsoft.AutoGen.Runtime.Grpc.Tests/GrpcGatewayServiceTests.cs b/dotnet/test/Microsoft.AutoGen.Runtime.Grpc.Tests/GrpcGatewayServiceTests.csindex 90b6b2ddd..fcae1ec3d 100644--- a/dotnet/test/Microsoft.AutoGen.Runtime.Grpc.Tests/GrpcGatewayServiceTests.cs+++ b/dotnet/test/Microsoft.AutoGen.Runtime.Grpc.Tests/GrpcGatewayServiceTests.cs@@ -12,7 +12,7 @@ using NewMessageReceived = Tests.Events.NewMessageReceived;namespace Microsoft.AutoGen.Runtime.Grpc.Tests;[Collection(ClusterCollection.Name)]-[Trait("Category", "UnitV2")]+[Trait("Category", "GRPC")]public class GrpcGatewayServiceTests{private readonly ClusterFixture _fixture;diff --git a/dotnet/test/Microsoft.AutoGen.Runtime.Grpc.Tests/Microsoft.AutoGen.Runtime.Grpc.Tests.csproj b/dotnet/test/Microsoft.AutoGen.Runtime.Grpc.Tests/Microsoft.AutoGen.Runtime.Grpc.Tests.csprojindex ab0899c0f..c8b00ee26 100644--- a/dotnet/test/Microsoft.AutoGen.Runtime.Grpc.Tests/Microsoft.AutoGen.Runtime.Grpc.Tests.csproj+++ b/dotnet/test/Microsoft.AutoGen.Runtime.Grpc.Tests/Microsoft.AutoGen.Runtime.Grpc.Tests.csproj@@ -8,6 +8,10 @@</PropertyGroup><ItemGroup>+ <PackageReference Include="coverlet.collector">+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>+ <PrivateAssets>all</PrivateAssets>+ </PackageReference><PackageReference Include="Microsoft.AspNetCore.TestHost" /><PackageReference Include="Microsoft.Orleans.TestingHost" /></ItemGroup>