Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [dotnet] simplify building/codecov CI #5405

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
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
17 changes: 8 additions & 9 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,29 +80,28 @@ jobs:
run: |
echo "Build AutoGen"
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: Unit Test V1
run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV1"
- name: Unit Test V2 (With Coverage)
run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV2" --collect:"XPlat Code Coverage"
- name: Non-GRPC Tests (macos)
if: matrix.os == 'macos-latest'
run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV1|Category=UnitV2"
- name: Install Dev Certs for GRPC
if: matrix.os == 'ubuntu-latest'
run: dotnet dev-certs https --trust
- name: GRPC Tests (With Coverage)
- name: All Unit Tests With Coverage (ubuntu)
if: matrix.os == 'ubuntu-latest'
run: dotnet test --no-build -bl --configuration Release --filter "Category=GRPC" --collect:"XPlat Code Coverage"
run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV1|Category=UnitV2|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
# Merge all coverage reports
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
-reporttypes:"Cobertura;Html" \
-sourcedirs:${{ github.workspace }}/dotnet/src # filter only dotnet/src
- name: Upload Merged Coverage Report
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
Expand Down
4 changes: 4 additions & 0 deletions dotnet/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@

<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<PackageReference Include="ApprovalTests" />
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
</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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
</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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

<ItemGroup>
<PackageReference Include="Aspire.Hosting.Testing" />
<PackageReference Include="coverlet.collector" />
<PackageReference Include="GitHubActionsTestLogger">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
</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>
Expand Down
Loading