Skip to content

Test: Verify build optimization test-skipping#7207

Closed
Groenbech96 wants to merge 26 commits intomainfrom
test/build-optimization-verify
Closed

Test: Verify build optimization test-skipping#7207
Groenbech96 wants to merge 26 commits intomainfrom
test/build-optimization-verify

Conversation

@Groenbech96
Copy link
Contributor

@Groenbech96 Groenbech96 commented Mar 18, 2026

Summary

  • Trivial Shopify doc comment change to verify build optimization works
  • Only the Shopify app is changed, so build optimization should skip tests for all non-Shopify test apps
  • This PR is for testing only — do not merge

What to look for in the logs

  • BUILD OPTIMIZATION: Comparing <sha>...<sha> — confirms event payload SHAs are extracted
  • BUILD OPTIMIZATION: Changed files (N): — confirms changed files are detected
  • BUILD OPTIMIZATION: SKIPPING tests for '<app>' — confirms non-Shopify apps are skipped
  • BUILD OPTIMIZATION: RUNNING tests for 'Shopify Connector-Test' — confirms Shopify tests still run

Context

Tests PR #7111 fix for shallow clone git diff failure in Get-ChangedFilesForCI.

🤖 Generated with Claude Code

Magnus Hartvig Grønbech and others added 26 commits March 12, 2026 16:01
Introduces BuildOptimization.psm1 that builds a dependency graph from all
329 app.json files and filters appFolders/testFolders per project to only
include affected apps. This reduces build times significantly for PRs that
touch a small subset of apps (e.g., E-Document Core: 9 apps instead of ~55).

Includes a small test change in E-Document Core to verify filtering in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
git writes progress info to stderr (e.g., "From https://..."), which
PowerShell treats as a terminating error under $errorActionPreference=Stop.
Switch to Continue around git calls and pipe stderr to Out-Null for fetch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shallow checkouts in CI don't have the base commit or parent history,
so git diff fails. Use gh pr diff --name-only which queries the GitHub
API and works regardless of checkout depth.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Will revert after verifying the filtering works in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Non-src files (workflows, build scripts) no longer trigger full build
  safety fallback — only unmapped files under src/ do
- Normalize backslashes to forward slashes when matching project keys
  (AL-Go uses backslashes, our keys use forward slashes)
- Use PSObject.Properties indexer for keys with special chars
- Add grouped logging showing which apps are in scope for compile/test

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shows a clear list of which apps will be compiled and tested per project,
distinguishing between filtered and full build projects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Revert all YAML changes (off-limits, managed by AL-Go).
Add incrementalBuilds setting with mode: modifiedApps for compile filtering.
Add test skip logic in RunTestsInBcContainer.ps1 using BuildOptimization module.

- Compile filtering: AL-Go native incrementalBuilds reuses prebuilt .app files
- Test filtering: Test-ShouldSkipTestApp skips unaffected test apps with caching
- Add Get-ChangedFilesForCI for CI environment detection
- Add [OutputType] attributes to fix PSScriptAnalyzer warnings
- 31 Pester tests passing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove [SuppressMessageAttribute] that broke Pester's variable scoping
in PowerShell 7 CI environment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… builds

This is temporary — will be reverted after verifying that incrementalBuilds
and test skipping work correctly in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restore build/* pattern. incrementalBuilds can't be smoke-tested from
this PR because AL-Go forces full build when .github/*.json changes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- YAML files point to Groenbech96/AL-Go fork with ignoreSettingsChanges
- AL-Go-Settings.json: ignoreSettingsChanges=true, removed build/* from fullBuildPatterns
- Will revert after verifying incremental builds work

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Our YAML changes match the workflow patterns. Remove temporarily for smoke test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Restore YAML files to main, restore fullBuildPatterns, remove
ignoreSettingsChanges. incrementalBuilds with modifiedApps cannot help
BCApps because System Application dependency cascade rebuilds all W1
apps on any System App change. Test skipping in RunTestsInBcContainer
is the primary optimization.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Merged main (Shopify + DotNet Aliases changes now in baseline)
- Rewrote BuildOptimization.psm1: 680 → 165 lines, removed V1 dead code,
  disk cache, upstream BFS, duplicate fullBuildPatterns check
- Cleared fullBuildPatterns to allow testing (will restore)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add PSDoc help comments to all 5 functions (PSScriptAnalyzer requirement)
- Add [OutputType()] attributes to all functions
- Remove accidentally committed .claude/settings.local.json

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Production-ready: only BuildOptimization module, RunTestsInBcContainer
skip logic, incrementalBuilds setting, and tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…sts when only infrastructure files change

When files matching fullBuildPatterns (e.g., build/*) change, AL-Go forces a
full compile but the test-skip logic saw zero affected apps and skipped all
tests. Add Test-FullBuildPatternsMatch to read fullBuildPatterns from
AL-Go-Settings.json and short-circuit Test-ShouldSkipTestApp so all tests run
when a full build is triggered.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…re/build-optimization-app-level-filtering
… logging

The three-dot git diff (origin/base...HEAD) failed silently in CI because
shallow clones lack the merge base history. Now reads the GitHub event
payload ($GITHUB_EVENT_PATH) to get base/head commit SHAs and uses a
two-dot diff, matching what AL-Go itself does.

Also adds BUILD OPTIMIZATION: logging to all early return paths so
failures are visible in CI logs instead of producing complete silence.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit adds a doc comment to a Shopify enum to create a PR where
the only app change is in Shopify. The build optimization should skip
tests for all non-Shopify apps.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Groenbech96 Groenbech96 requested review from a team as code owners March 18, 2026 09:04
@github-actions github-actions bot added Build: scripts & configs Build scripts and configuration files AL: Apps (W1) Add-on apps for W1 labels Mar 18, 2026
@Groenbech96
Copy link
Contributor Author

Closing - need to base off feature branch instead of main to avoid fullBuildPatterns match on build/* files

@github-actions
Copy link

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Apps (W1) Add-on apps for W1 Build: scripts & configs Build scripts and configuration files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant