Analyzing and improving PR test execution efficiency#1355
Merged
Conversation
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
aaronpowell
May 25, 2026 03:09
View session
Member
|
@copilot we probably don't need the workflow that validates the list of tests, since it was only used to ensure that the static-matrix was setup. Since we're now generating a matrix, it's not needed. |
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
Contributor
Author
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1355Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1355" |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s CI to compute and run a reduced integration-test matrix based on the files changed in a pull request, aiming to improve test execution efficiency while preserving a full-matrix fallback when impact is uncertain.
Changes:
- Added a git-diff–based affected-test selector that emits a JSON selection plus a human-readable summary.
- Updated the reusable integration-test workflow to accept a JSON list of tests and dynamically build the matrix.
- Extended the test-list generator script with
--json/--plainmodes and removed the previous workflow/list verification job.
Show a summary per file
| File | Description |
|---|---|
eng/testing/select-affected-tests.cs |
New selector app that maps changed files/package updates to impacted integration test projects and outputs selection artifacts. |
eng/testing/generate-test-list-for-workflow.sh |
Adds structured output modes (--json, --plain) to feed workflows while keeping the existing workflow-friendly output. |
.github/workflows/tests.yaml |
Resolves test matrix from provided JSON (or generated full list) and uses it to drive the matrix dynamically, with a noop path when empty. |
.github/workflows/pr-tests.yaml |
Removes the prior “Verify Test List” workflow (no longer needed with dynamic generation). |
.github/workflows/dotnet-ci.yml |
Adds an affected-tests job and wires its selected matrix into the reusable tests.yaml workflow. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 3
Comment on lines
+134
to
+139
| if (filePath == ".github/workflows/tests.yaml") | ||
| { | ||
| ignoredFiles.Add(filePath); | ||
| continue; | ||
| } | ||
|
|
| selected.UnionWith(impacted); | ||
| if (missing.Count > 0) | ||
| { | ||
| reasons.Add($"Ignored package changes for {string.Join(", ", missing.OrderBy(static packageId => packageId, StringComparer.Ordinal))} because they only affect projects already changed in this PR."); |
Comment on lines
+261
to
+311
| private static async Task<(Dictionary<string, HashSet<string>> ProjectRefs, Dictionary<string, HashSet<string>> PackageRefs, List<string> ProjectPaths)> ProjectDataAsync( | ||
| string repoRoot, | ||
| string headSha, | ||
| IReadOnlyList<string> diffFiles) | ||
| { | ||
| var projectRefs = new Dictionary<string, HashSet<string>>(StringComparer.Ordinal); | ||
| var packageRefs = new Dictionary<string, HashSet<string>>(StringComparer.Ordinal); | ||
| var projectPaths = new List<string>(); | ||
| var seenProjectPaths = new HashSet<string>(StringComparer.Ordinal); | ||
| var changedProjectFiles = new HashSet<string>( | ||
| diffFiles.Where(static filePath => filePath.EndsWith(".csproj", StringComparison.Ordinal)), | ||
| StringComparer.Ordinal); | ||
|
|
||
| foreach (var rootName in new[] { "src", "tests", "examples", "tests-app-hosts" }) | ||
| { | ||
| var rootPath = Path.Combine(repoRoot, rootName); | ||
| if (!Directory.Exists(rootPath)) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| foreach (var projectPath in Directory.EnumerateFiles(rootPath, "*.csproj", SearchOption.AllDirectories).OrderBy(static path => path, StringComparer.Ordinal)) | ||
| { | ||
| var relative = RelativePath(repoRoot, projectPath); | ||
| var document = changedProjectFiles.Contains(relative) | ||
| ? XDocument.Parse(await RunGitAsync(repoRoot, "show", $"{headSha}:{relative}")) | ||
| : XDocument.Load(projectPath); | ||
|
|
||
| AddProjectData(repoRoot, projectPath, relative, document, projectRefs, packageRefs); | ||
| projectPaths.Add(relative); | ||
| seenProjectPaths.Add(relative); | ||
| } | ||
| } | ||
|
|
||
| foreach (var projectPath in diffFiles.Where(static filePath => filePath.EndsWith(".csproj", StringComparison.Ordinal))) | ||
| { | ||
| if (seenProjectPaths.Contains(projectPath)) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| var output = await RunGitAsync(repoRoot, "show", $"{headSha}:{projectPath}"); | ||
| var document = XDocument.Parse(output); | ||
| AddProjectData(repoRoot, Path.Combine(repoRoot, projectPath), projectPath, document, projectRefs, packageRefs); | ||
| projectPaths.Add(projectPath); | ||
| seenProjectPaths.Add(projectPath); | ||
| } | ||
|
|
||
| return (projectRefs, packageRefs, projectPaths); | ||
| } | ||
|
|
Contributor
Minimum allowed line rate is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request created by AI Agent