Skip to content

Add daily template size tracking workflow#34140

Merged
mattleibow merged 15 commits intomainfrom
feature/daily-template-size-tracking
Feb 20, 2026
Merged

Add daily template size tracking workflow#34140
mattleibow merged 15 commits intomainfrom
feature/daily-template-size-tracking

Conversation

@mattleibow
Copy link
Member

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description

Adds a GitHub Actions workflow that tracks .NET MAUI template package sizes daily across all platforms. This is adapted from the Uno Platform performance workflow but tailored for .NET MAUI.

What it does

  1. Creates apps from maui and maui-blazor templates
  2. Publishes for each platform (Android, iOS, MacCatalyst, Windows packaged/unpackaged) with AOT variants
  3. Measures package sizes (AAB, .app bundles, MSIX, publish folders)
  4. Compares against historical data (1, 2, 3, 4, 5, 7, 30 days ago)
  5. Alerts via GitHub Issues when size increases exceed thresholds (10% warning, 20% critical)
  6. Generates summary reports in GitHub Actions workflow summary

Architecture

prepare-matrix → build-and-measure (parallel matrix) → analyze-and-report

Platform Matrix

Platform Output AOT Variant
Android .aab ✅ (.NET 10+)
iOS .app (unsigned)
MacCatalyst .app (unsigned)
Windows Packaged .msix (unsigned)
Windows Unpackaged publish folder

Key Design Decisions

  • No secrets required: iOS/MacCatalyst use _RequireCodeSigning=false, Windows uses AppxPackageSigningEnabled=false
  • GitHub Actions Cache for historical metrics (no Azure Blob Storage needed)
  • Zero external infrastructure dependencies
  • Templates installed from NuGet (Microsoft.Maui.Templates)

Files Added

  • .github/workflows/daily-template-size-tracking.yml — Main workflow
  • .github/scripts/template-size-tracking/measure-package-size.ps1 — Size measurement
  • .github/scripts/template-size-tracking/compare-and-alert.ps1 — Comparison & alerting
  • .github/scripts/template-size-tracking/generate-summary.ps1 — Summary report

Track .NET MAUI template package sizes daily across all platforms
(Android, iOS, MacCatalyst, Windows packaged/unpackaged) with AOT
variants. Uses GitHub Actions Cache for historical comparison and
alerts on significant size regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 19, 2026 16:01
Copy link
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 adds a comprehensive daily template size tracking workflow for .NET MAUI templates, adapted from the Uno Platform performance workflow. The workflow creates apps from maui and maui-blazor templates, publishes them for all platforms (Android, iOS, MacCatalyst, Windows) with AOT variants, measures package sizes, and alerts on significant size increases.

Changes:

  • Adds automated daily tracking workflow with parallel matrix builds across platforms and .NET versions (9.0, 10.0)
  • Implements historical metrics caching with GitHub Actions cache for trend analysis over 1-35 days
  • Creates automated alerting via GitHub Issues when size increases exceed configurable thresholds (10% warning, 20% critical)

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 11 comments.

File Description
.github/workflows/daily-template-size-tracking.yml Main workflow orchestrating matrix preparation, parallel builds across platforms, and analysis/reporting with issue creation on alerts
.github/scripts/template-size-tracking/measure-package-size.ps1 PowerShell script measuring package sizes for different platform outputs (AAB, IPA, MSIX, app bundles, publish folders)
.github/scripts/template-size-tracking/compare-and-alert.ps1 Comparison logic analyzing current metrics against historical data with threshold-based alerting
.github/scripts/template-size-tracking/generate-summary.ps1 GitHub Actions summary report generation with tables showing size trends and historical comparisons

mattleibow and others added 14 commits February 19, 2026 21:09
The dotnet/maui repo only allows GitHub-owned actions and specific
patterns. maxim-lobanov/setup-xcode is not in the allowed list,
causing startup_failure.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MAUI templates are published as separate NuGet packages per .NET
major version (e.g., Microsoft.Maui.Templates.net9,
Microsoft.Maui.Templates.net10). Also add --nuget-source to avoid
the repo NuGet.config private feeds which don't host the templates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Install all platform workloads needed for multi-TFM restore:
  Linux: maui-android; macOS: android+ios+maccatalyst; Windows: full maui
- Add --force to template install to handle pre-installed versions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
win10-x64 is not a recognized RID in modern .NET SDK.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…conflicts

When multiple .NET SDKs are installed (e.g., 9.0 + 10.0), the highest
SDK resolves workload manifests that may conflict with older TFMs.
Pin the SDK to match the target .NET version.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…tance

Two critical fixes:
1. Create projects in $HOME/template-builds/ to avoid inheriting the
   repo's Directory.Build.props (which imports Microsoft.DotNet.Arcade.Sdk)
2. Restrict TargetFrameworks to only the platform being built, avoiding
   NETSDK1178 errors when not all platform workloads are installed

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…kaged builds

- Add ValidateXcodeVersion=false for iOS/MacCatalyst (runner Xcode may
  differ from SDK-required version; we only measure size, not run apps)
- Add WindowsPackageType=MSIX for packaged builds (template defaults to
  None which conflicts with GenerateAppxPackageOnBuild=true)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use iossimulator-arm64 RID (no code signing required for simulator)
- Use hyphens in project names (MSIX identity requires [-.A-Za-z0-9])
- Add dotnet-public NuGet feed for .NET 10 Mono runtime packages

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…-dependent win

- iOS: Use dotnet build instead of publish (publish requires code signing)
  Copy .app from bin/ to publish/ for consistent measurement
- Shorten project names to stay within MSIX 50-char identity limit
- Move NuGet.config to parent dir (prevents bundling into macOS .app)
- Windows unpackaged non-AOT: framework-dependent (Mono.win-x64 unavailable)
- Restore ios-arm64 RID (build doesn't have simulator restriction)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…on-AOT

iOS: Use dotnet publish with CodesignKey='-' (ad-hoc signing) and
BuildIpa=false to produce .app without Apple certificates.

Windows unpackaged non-AOT: Drop -r win-x64 flag which forces
self-contained and needs Mono.win-x64 (unavailable for .NET 10 GA).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With BuildIpa=false, dotnet publish doesn't copy the .app to -o path.
The .app stays in bin/Release/{framework}/{rid}/. Copy it to publish/
so measure-package-size.ps1 can find and measure it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…PR feedback

- Remove template installation (templates come with workload)
- Simplify workload install to 2 steps: maui-android on Linux, maui on macOS/Windows
- Extract 4 new scripts: prepare-matrix.ps1, create-project.ps1, build-and-publish.ps1, prepare-historical-data.ps1
- Fix project naming: use $template -replace '-', '' instead of if/else
- Remove nuget.org from NuGet.config (keep only dotnet-public)
- Change metrics artifact retention to 31 days
- Fix iOS compressed size: .app is not a compressed archive
- Fix default HistoricalMetricsPath in compare-and-alert.ps1
- Add null check for mauiVersion in generate-summary.ps1
- Fix IsAot ValidateSet in measure-package-size.ps1
- Add comment explaining immutable cache key pattern
- Remove maui_template_version workflow input
- Workflow YAML reduced from 671 to 236 lines

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
PowerShell variable names are case-insensitive, so $dotnetVersions
and $DotNetVersions (the [string] parameter) are the same variable.
Assigning an array to a [string]-typed variable coerces it back to a
space-separated string, causing all matrix entries to merge.

Fix: use [array]$versions and [array]$templateList as distinct names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add 'maui-sample' as a synthetic template name that maps to
'dotnet new maui --sample-content'. This tracks the full sample app
template which includes CommunityToolkit, SQLite, and Syncfusion
dependencies (~5 extra NuGet packages, ~60+ source files).

Matrix grows from 34 to 51 entries (17 new for maui-sample).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow merged commit 48dae02 into main Feb 20, 2026
55 of 56 checks passed
@mattleibow mattleibow deleted the feature/daily-template-size-tracking branch February 20, 2026 00:00
TamilarasanSF4853 pushed a commit to TamilarasanSF4853/maui that referenced this pull request Mar 2, 2026
Track .NET MAUI template package sizes across all platforms daily using GitHub Actions.

## What it does
- Builds maui, maui-blazor, and maui-sample (--sample-content) templates for every platform
- Platforms: Android, iOS, MacCatalyst, Windows (packaged + unpackaged), with AOT variants
- Measures package size, compressed size, file count, assembly count, and build time
- Stores metrics in GitHub Actions Cache with 31-day retention
- Compares against historical data and alerts on regressions (>10% warning, >20% critical)
- Generates a summary report with trend analysis (1-day through 1-month comparisons)

## Structure
- `.github/workflows/daily-template-size-tracking.yml` — Workflow with 3 jobs: prepare-matrix → build-and-measure (51 matrix jobs) → analyze-and-report
- `.github/scripts/template-size-tracking/` — 7 PowerShell scripts for matrix generation, project creation, building, measurement, comparison, alerting, and summary generation

## Key technical decisions
- Projects created in $HOME to avoid Arcade SDK inheritance from repo
- SDK pinned via global.json to prevent cross-version workload manifest conflicts
- iOS uses ad-hoc signing (CodesignKey=-) to skip Apple certificates
- Windows unpackaged non-AOT uses framework-dependent publish (no RID) to avoid missing Mono runtime
- NuGet.config placed in parent directory to prevent macOS bundling it into .app packages

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants