Skip to content
Merged
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
19 changes: 19 additions & 0 deletions .github/workflows/New-FrameworkFilteredSolution.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
.PARAMETER Configuration
Optional MSBuild configuration used when querying TargetFrameworks. Defaults to Debug.

.PARAMETER ProjectNameFilter
Optional wildcard pattern to filter test project names (e.g., *UnitTests*, *IntegrationTests*).
When specified, only test projects whose filename matches this pattern are kept.

.PARAMETER OutputPath
Optional output path for the filtered .slnx file. If not specified, a temp file is created.

Expand All @@ -30,6 +34,10 @@
$filtered = ./eng/New-FilteredSolution.ps1 -Solution ./agent-framework-dotnet.slnx -TargetFramework net472
dotnet test --solution $filtered --no-build -f net472

.EXAMPLE
# Generate a solution with only unit test projects
./eng/New-FilteredSolution.ps1 -Solution ./agent-framework-dotnet.slnx -TargetFramework net10.0 -ProjectNameFilter "*UnitTests*" -OutputPath filtered-unit.slnx

.EXAMPLE
# Inline usage with dotnet test (PowerShell)
dotnet test --solution (./eng/New-FilteredSolution.ps1 -Solution ./agent-framework-dotnet.slnx -TargetFramework net472) --no-build -f net472
Comment on lines 34 to 43
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment-based usage examples reference ./eng/New-FilteredSolution.ps1, but this repository doesn’t contain an eng/ directory and the script’s actual path/name is .github/workflows/New-FrameworkFilteredSolution.ps1. These examples will fail if copied; update them to point at the correct script path (and the correct solution path, e.g. dotnet/agent-framework-dotnet.slnx).

Suggested change
$filtered = ./eng/New-FilteredSolution.ps1 -Solution ./agent-framework-dotnet.slnx -TargetFramework net472
dotnet test --solution $filtered --no-build -f net472
.EXAMPLE
# Generate a solution with only unit test projects
./eng/New-FilteredSolution.ps1 -Solution ./agent-framework-dotnet.slnx -TargetFramework net10.0 -ProjectNameFilter "*UnitTests*" -OutputPath filtered-unit.slnx
.EXAMPLE
# Inline usage with dotnet test (PowerShell)
dotnet test --solution (./eng/New-FilteredSolution.ps1 -Solution ./agent-framework-dotnet.slnx -TargetFramework net472) --no-build -f net472
$filtered = ./.github/workflows/New-FrameworkFilteredSolution.ps1 -Solution ./dotnet/agent-framework-dotnet.slnx -TargetFramework net472
dotnet test --solution $filtered --no-build -f net472
.EXAMPLE
# Generate a solution with only unit test projects
./.github/workflows/New-FrameworkFilteredSolution.ps1 -Solution ./dotnet/agent-framework-dotnet.slnx -TargetFramework net10.0 -ProjectNameFilter "*UnitTests*" -OutputPath filtered-unit.slnx
.EXAMPLE
# Inline usage with dotnet test (PowerShell)
dotnet test --solution (./.github/workflows/New-FrameworkFilteredSolution.ps1 -Solution ./dotnet/agent-framework-dotnet.slnx -TargetFramework net472) --no-build -f net472

Copilot uses AI. Check for mistakes.
Expand All @@ -45,6 +53,8 @@ param(

[string]$Configuration = "Debug",

[string]$ProjectNameFilter,

[string]$OutputPath
)

Expand All @@ -70,6 +80,15 @@ $kept = @()
foreach ($proj in $testProjects) {
$projRelPath = $proj.GetAttribute("Path")
$projFullPath = Join-Path $solutionDir $projRelPath
$projFileName = Split-Path $projRelPath -Leaf

# Filter by project name pattern if specified
if ($ProjectNameFilter -and ($projFileName -notlike $ProjectNameFilter)) {
Write-Verbose "Removing (name filter): $projRelPath"
$removed += $projRelPath
$proj.ParentNode.RemoveChild($proj) | Out-Null
continue
}

if (-not (Test-Path $projFullPath)) {
Write-Verbose "Project not found, keeping in solution: $projRelPath"
Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/dotnet-build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,21 @@ jobs:
popd
rm -rf "$TEMP_DIR"

- name: Generate filtered solution
- name: Generate filtered solutions
shell: pwsh
run: |
.github/workflows/New-FrameworkFilteredSolution.ps1 `
-Solution dotnet/agent-framework-dotnet.slnx `
-TargetFramework ${{ matrix.targetFramework }} `
-Configuration ${{ matrix.configuration }} `
-OutputPath dotnet/filtered.slnx `
-Verbose
$commonArgs = @{
Solution = "dotnet/agent-framework-dotnet.slnx"
TargetFramework = "${{ matrix.targetFramework }}"
Configuration = "${{ matrix.configuration }}"
Verbose = $true
}
.github/workflows/New-FrameworkFilteredSolution.ps1 @commonArgs `
-ProjectNameFilter "*UnitTests*" `
-OutputPath dotnet/filtered-unit.slnx
.github/workflows/New-FrameworkFilteredSolution.ps1 @commonArgs `
-ProjectNameFilter "*IntegrationTests*" `
-OutputPath dotnet/filtered-integration.slnx
Comment on lines +155 to +157
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second filtered solution (integration) is generated unconditionally, even on matrix entries where integration tests are never executed (and on pull_request events where the integration step is skipped). This adds extra dotnet msbuild work per test project and can noticeably slow CI; consider moving this call into its own step guarded by the same if: github.event_name != 'pull_request' && matrix.integration-tests condition as the integration test run, or generate it conditionally inside the script.

Copilot uses AI. Check for mistakes.

- name: Run Unit Tests
shell: pwsh
Expand All @@ -165,13 +171,12 @@ jobs:
)
}

dotnet test --solution ./filtered.slnx `
dotnet test --solution ./filtered-unit.slnx `
-f ${{ matrix.targetFramework }} `
-c ${{ matrix.configuration }} `
--no-build -v Normal `
--report-xunit-trx `
--ignore-exit-code 8 `
--filter-query "/*UnitTests*/*/*/*" `
@coverageArgs
env:
# Cosmos DB Emulator connection settings
Expand Down Expand Up @@ -203,13 +208,13 @@ jobs:
working-directory: dotnet
if: github.event_name != 'pull_request' && matrix.integration-tests
run: |
dotnet test --solution ./filtered.slnx `
dotnet test --solution ./filtered-integration.slnx `
-f ${{ matrix.targetFramework }} `
-c ${{ matrix.configuration }} `
--no-build -v Normal `
--report-xunit-trx `
--ignore-exit-code 8 `
--filter-query "/*IntegrationTests*/*/*/*[Category!=IntegrationDisabled]"
--filter-not-trait "Category=IntegrationDisabled"
env:
# Cosmos DB Emulator connection settings
COSMOSDB_ENDPOINT: https://localhost:8081
Expand Down