Scope PR test runs to affected apps and cover .github in fullBuildPatterns - #10306
Draft
Alexander Holstrup (aholstrup1) wants to merge 2 commits into
Draft
Scope PR test runs to affected apps and cover .github in fullBuildPatterns#10306Alexander Holstrup (aholstrup1) wants to merge 2 commits into
Alexander Holstrup (aholstrup1) wants to merge 2 commits into
Conversation
Filter the per-project test-app list through Test-ShouldSkipTestApp so PR builds only run tests for apps affected by the changed files (plus their dependents). The guard is correctness-preserving: a full run is still forced for fullBuildPatterns matches, unmapped src files, non-CI, and workflow_dispatch. Also broaden the fullBuildPatterns entry to '.github/*' so changes to AL-Go-Settings.json and other .github config force a full run instead of silently skipping all tests. This subsumes the two explicit workflow entries. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 08f8114e-ab0d-4d8b-8941-f65880a64825
Alexander Holstrup (aholstrup1)
deployed
to
triage
August 17, 2026 13:22 — with
GitHub Actions
Active
Contributor
|
Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234' |
The best-effort base-commit fetch and the git diff in Get-ChangedFilesForCI suppressed stderr, so when change detection fell back to a full test run we couldn't tell why. Capture and log the fetch exit code/output and include the git diff stderr in the failure message to diagnose why the base SHA is unavailable on shallow self-hosted runners. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 08f8114e-ab0d-4d8b-8941-f65880a64825
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.
What & why
BCApps currently runs the full test suite (~316 test apps) on every PR, even when a change touches a single app. The build-optimization logic to scope test runs to only the affected apps already existed in
BuildOptimization.psm1(with unit tests), but nothing in the pipeline called it. This wires it in and fixes a related gap infullBuildPatterns.Two changes:
Wire up per-app test optimization.
Invoke-PerProjectTestRunnow filters the per-project test-app list throughTest-ShouldSkipTestApp, so a PR only runs tests for apps affected by its changed files plus their dependents. Filtering happens before dispatch, so skipped apps never occupy a tenant. This is correctness-preserving: a full run is still forced forfullBuildPatternsmatches, unmapped files undersrc/, non-CI runs, andworkflow_dispatch, so the failure mode is always "run too much," never "skip something it shouldn't."Cover
.github/*infullBuildPatterns. Previously only two specific workflow files were listed. A change to.github/AL-Go-Settings.json(which defines artifact version, analyzers, target country, and the patterns themselves) mapped to no app, produced an empty affected set, and would have skipped every test. Broadening to.github/*closes that hole and subsumes the two explicit workflow entries.On a sample of 10 recent open PRs, 6 dropped from 316 test apps to 4 or fewer; the rest correctly stayed full (base-layer or infra changes).
Linked work
Fixes #
How I validated this
What I tested and the outcome
BuildOptimization.Test.ps1Pester suite: 36/37 pass. The one failure (Get-AffectedApps ... Expected 51, but got 56) is a pre-existing hardcoded-count assertion that also fails onmainwith these changes stashed; it is dependency-graph drift from apps added since the count was written, unrelated to this change..github/AL-Go-Settings.jsonstill parses andParallelTestExecution.psm1imports cleanly.fullBuildPatterns).Test-ShouldSkipTestApp, and this change is wiring plus a settings entry.Risk & compatibility
app.jsondependency declarations being correct (already how build order is resolved). A product app with no linked test app resolves to zero affected test apps; that is correct when the app genuinely has no tests, but a follow-up guard could warn when a changed product app has no associated test app..github/*means build-irrelevant edits (e.g.PULL_REQUEST_TEMPLATE.md,CODEOWNERS) now force a full run. This is intentional and consistent with the conservative, correctness-first intent of the list.51vs56) is worth fixing separately so the suite goes green.