Skip to content

[tests] Upload expected app size files as artifacts on test failure#25482

Merged
rolfbjarne merged 7 commits into
mainfrom
dev/rolf/fix-appsize-tests
May 25, 2026
Merged

[tests] Upload expected app size files as artifacts on test failure#25482
rolfbjarne merged 7 commits into
mainfrom
dev/rolf/fix-appsize-tests

Conversation

@rolfbjarne
Copy link
Copy Markdown
Member

@rolfbjarne rolfbjarne commented May 20, 2026

When app size tests fail in Azure DevOps, write the updated expected files to $(Build.ArtifactStagingDirectory)/updated-expected-sizes/ so they get published as a pipeline artifact. This makes it easy to download and apply the corrected files without having to reproduce the build locally.

Also add a Copilot skill that can fetch the artifacts and apply them locally.

Changes:

  • AppSizeTest.cs: When differences are detected (either app size exceeds tolerance OR the file list changed), write the updated expected file to the artifact staging directory. Falls back to a temp directory when not running in CI.
  • run-tests.yml: Add a PublishPipelineArtifact@1 step to upload the updated-expected-sizes directory after tests complete.
  • Tolerance fix: Previously, artifacts were only uploaded when the total app size exceeded tolerance. If files were added/removed from the bundle but the total size stayed within tolerance, no artifact was produced. Now both size and file-list changes trigger artifact upload.
  • Expected file updates: Update expected files to match current CI output.
  • Copilot skill (.github/skills/update-expected-app-size/): Helps download these artifacts from Azure DevOps and apply them locally.

🤖 Pull request created by Copilot

rolfbjarne and others added 2 commits May 20, 2026 10:19
It seems that the results depend on the macOS version of the machine executing
the tests.

That's unfortunate when all my macs are at 26.5 and the bots are at 26.2,
because I can't re-generate the expected app sizes locally.

So ignore these tests until I can come up with a better solution.
When WRITE_KNOWN_FAILURES is not set, instead of telling users to set
the environment variable and re-run, generate a unified diff patch file
that can be applied to update the expected files. The patch file is
stored in a temporary directory (via Cache.CreateTemporaryDirectory) and
uploaded as an Azure DevOps artifact via ##vso[artifact.upload].

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Copy Markdown
Member Author

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

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

✅ LGTM

Summary: Clean PR that improves UX when app size tests fail — uploads the corrected expected file as an artifact instead of just telling users to re-run with an env var. The Copilot skill provides good guidance for downloading and applying.

CI: Build passed ✓. Simulator tests still pending.

Positive callouts:

  • The UploadUpdatedExpectedFile helper is simple and well-focused
  • Good that AssertAssemblyReport gates the upload behind if (addedAPIs.Count > 0 || removedAPIs.Count > 0) so no artifact is uploaded when there's nothing wrong
  • Skill documentation covers both automated and manual fallback paths

0 ❌ errors · 0 ⚠️ warnings · 1 💡 suggestion

Comment thread tests/dotnet/UnitTests/AppSizeTest.cs Outdated
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

… upload

The ##vso[artifact.upload] command doesn't work inside NUnit test
runners because the test framework captures stdout. Instead, write
files to $(Build.ArtifactStagingDirectory)/updated-expected-sizes/
and add a PublishPipelineArtifact step that uploads the directory
after tests complete.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Previously, UploadUpdatedExpectedFile was only called when the total app
size exceeded the tolerance. If files were added/removed from the bundle
but the total size stayed within tolerance, no artifact was uploaded and
the test would fail with a misleading message saying the artifact was
available (when it wasn't).

Restructure AssertAppSize to:
1. Detect both size differences AND file-list differences
2. Upload the updated expected file for ANY meaningful difference
3. Produce a clear failure message distinguishing file-list changes
   from size changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Applied artifacts from all 4 platforms after the file-list tolerance
fix. Changes include:
- iOS: corrected truncated AppBundleSize + restored Info.plist entry
- tvOS: restored comment line and SizeTestApp entry + updated sizes
- MacCatalyst: added AppBundleSize header + NSComparisonResult.Same
- macOS: restored System.Web.dll entry + updated sizes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne marked this pull request as ready for review May 21, 2026 17:58
Copilot AI review requested due to automatic review settings May 21, 2026 17:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the workflow around app size (and related expected-file) test failures by writing updated “expected” outputs into Azure DevOps artifact staging so they can be published and easily downloaded/applied, and adds a GitHub Copilot skill documenting how to fetch/apply those artifacts.

Changes:

  • Update AppSizeTest.cs to write updated expected files to $(Build.ArtifactStagingDirectory)/updated-expected-sizes (or a temp dir outside CI) whenever size and/or file-list/API-set differences are detected.
  • Add an Azure DevOps pipeline step to publish the updated-expected-sizes directory as a pipeline artifact.
  • Refresh multiple expected *-size.txt baselines and add a .github/skills/ workflow doc for downloading/applying the artifacts.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/devops/automation/templates/tests/run-tests.yml Publishes a new pipeline artifact containing updated expected files.
tests/dotnet/UnitTests/AppSizeTest.cs Writes updated expected files on failure (size/file-list/API diffs) to an artifact staging directory.
tests/dotnet/UnitTests/expected/TVOS-NativeAOT-TrimmableStatic-size.txt Updates expected app bundle size output.
tests/dotnet/UnitTests/expected/TVOS-MonoVM-interpreter-size.txt Updates expected app bundle size output.
tests/dotnet/UnitTests/expected/MacOSX-CoreCLR-Interpreter-TrimmableStatic-size.txt Updates expected app bundle size output.
tests/dotnet/UnitTests/expected/MacCatalyst-MonoVM-size.txt Updates expected app bundle size output.
tests/dotnet/UnitTests/expected/iOS-NativeAOT-size.txt Updates expected app bundle size output.
tests/dotnet/UnitTests/expected/iOS-MonoVM-interpreter-size.txt Updates expected app bundle size output.
.github/skills/update-expected-app-size/SKILL.md Adds a skill guide for downloading/applying updated expected files from Azure DevOps artifacts.
Comments suppressed due to low confidence (1)

.github/skills/update-expected-app-size/SKILL.md:116

  • In the manual download section, step 4 says to place each file as tests/dotnet/UnitTests/expected/{artifactName}.txt, but artifactName here refers to the pipeline artifact name (e.g., ...updated-expected-sizes-dotnettests_ios-1), not the individual expected file names inside the artifact. This should instruct the user to keep the original filenames from the artifact (e.g., iOS-MonoVM-interpreter-size.txt) when copying into tests/dotnet/UnitTests/expected/.
If automated download fails (auth issues, etc.), provide the user with:
1. The Azure DevOps build URL
2. Instructions to navigate to the build → Summary → Artifacts section
3. Look for individual artifacts whose names match the patterns above
4. Download each file and place it as `tests/dotnet/UnitTests/expected/{artifactName}.txt`

Comment thread tools/devops/automation/templates/tests/run-tests.yml
Comment thread tests/dotnet/UnitTests/AppSizeTest.cs
Comment thread .github/skills/update-expected-app-size/SKILL.md
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #d022761] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: d022761aa80afc7d82437de63224a830ae08d337 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #d022761] Build passed (Build packages) ✅

Pipeline on Agent
Hash: d022761aa80afc7d82437de63224a830ae08d337 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: d022761aa80afc7d82437de63224a830ae08d337 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #d022761] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: d022761aa80afc7d82437de63224a830ae08d337 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🚀 [CI Build #d022761] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 183 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 18 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 18 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: d022761aa80afc7d82437de63224a830ae08d337 [PR build]

@rolfbjarne rolfbjarne merged commit 97a86d5 into main May 25, 2026
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants