Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1df1486
ci: Add size benchmarks
jeromelaban Nov 1, 2025
f1636df
chore: Use PR triggers
jeromelaban Nov 1, 2025
20c6d47
ci: Adjust project search
jeromelaban Nov 1, 2025
d3d8992
chore: Adjust powershell syntax
jeromelaban Nov 1, 2025
d8f1787
ci: Adjust template creation
jeromelaban Nov 1, 2025
ddc2051
ci: Adjust cancellation
jeromelaban Nov 1, 2025
bafc8b1
ci: Adjust template creation
jeromelaban Nov 1, 2025
cb2443c
ci: Adjust ios build
jeromelaban Nov 1, 2025
a3dcbc7
ci: Adjust ios signing
jeromelaban Nov 1, 2025
78338e6
ci: Adjust apple provisioning commit
jeromelaban Nov 1, 2025
0d98997
ci: Adjust commit
jeromelaban Nov 1, 2025
26199d7
ci: Adjust provisioning secrets
jeromelaban Nov 1, 2025
719cb8c
ci: Adjust cert invocation
jeromelaban Nov 1, 2025
64940ef
ci: Adjust certificate env
jeromelaban Nov 1, 2025
6dd6ef9
ci: Adjust inputs
jeromelaban Nov 1, 2025
8fbfe56
ci: Adjust for manual signing
jeromelaban Nov 1, 2025
4c31d44
ci: Adjust codesign key
jeromelaban Nov 1, 2025
269b043
ci: Adjust azure props
jeromelaban Nov 1, 2025
1a7915e
ci: remove unused variables
jeromelaban Nov 1, 2025
5c64a04
ci: Move to managed identity
jeromelaban Nov 2, 2025
7b5a40f
ci: Adjust size counting
jeromelaban Nov 2, 2025
263f986
chore: Add desktop AOT variant
jeromelaban Nov 2, 2025
9e396d9
chore: Fixed mappings
jeromelaban Nov 2, 2025
41cd0db
chore: Adjust desktop assembly counting
jeromelaban Nov 2, 2025
3d9a8c2
chore: Adjust ios/android package size computation
jeromelaban Nov 2, 2025
9bbf6f6
chore: Adjust time formatter
jeromelaban Nov 2, 2025
7d58074
chore: Restore original files
jeromelaban Nov 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/actions/manual-ios-signing/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Manual iOS Signing
description: Sets up keychain, imports certificate and provisioning profile, exports PROVISIONING_UUID and CODESIGN_KEY.
author: unoplatform

inputs:
certificate-base64:
description: Base64 encoded P12 certificate
required: true
certificate-password:
description: Password for the P12 certificate
required: true
provisioning-profile-base64:
description: Base64 encoded iOS provisioning profile (.mobileprovision)
required: true
codesign-key:
description: Codesign identity to use (e.g. Apple Development)
required: false
default: Apple Development

outputs:
provisioning-uuid:
description: Extracted UUID of the imported provisioning profile
value: ${{ steps.signing.outputs.provisioning-uuid }}

runs:
using: composite
steps:
- name: Decode certificate and provisioning profile
id: signing
shell: bash
run: |
set -euo pipefail
certInput='${{ inputs.certificate-base64 }}'
passInput='${{ inputs.certificate-password }}'
provInput='${{ inputs.provisioning-profile-base64 }}'
keyInput='${{ inputs.codesign-key }}'

if [ -z "$certInput" ] || [ -z "$passInput" ] || [ -z "$provInput" ]; then
echo "Missing required inputs" >&2
exit 1
fi

certPath="$RUNNER_TEMP/ios_cert.p12"
provPath="$RUNNER_TEMP/ios_profile.mobileprovision"
echo "$certInput" | base64 --decode > "$certPath"
echo "$provInput" | base64 --decode > "$provPath"

security create-keychain -p temp ios-signing.keychain
security import "$certPath" -k ios-signing.keychain -P "$passInput" -T /usr/bin/codesign
security list-keychains -s ios-signing.keychain
security unlock-keychain -p temp ios-signing.keychain
security set-keychain-settings -t 3600 -l ~/Library/Keychains/ios-signing.keychain
security set-key-partition-list -S apple-tool:,apple: -s -k temp ios-signing.keychain

provPlist="$RUNNER_TEMP/profile.plist"
security cms -D -i "$provPath" > "$provPlist"
uuid=$( /usr/libexec/PlistBuddy -c 'Print :UUID' "$provPlist" )
echo "Provisioning Profile UUID: $uuid"
echo "PROVISIONING_UUID=$uuid" >> "$GITHUB_ENV"
echo "CODESIGN_KEY=$keyInput" >> "$GITHUB_ENV"
echo "provisioning-uuid=$uuid" >> "$GITHUB_OUTPUT"

mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
cp "$provPath" "$HOME/Library/MobileDevice/Provisioning Profiles/$uuid.mobileprovision"

- name: Output summary
shell: bash
run: |
echo "Manual iOS signing configured. UUID=$PROVISIONING_UUID" >> "$GITHUB_STEP_SUMMARY"
222 changes: 222 additions & 0 deletions .github/scripts/template-size-tracking/compare-and-alert.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Compares current metrics with previous day and generates alerts.

.PARAMETER CurrentMetricsPath
Path to current metrics directory.

.PARAMETER PreviousMetricsPath
Path to previous metrics directory.

.PARAMETER AlertThreshold
Percentage threshold for alerts (default: 10).

.PARAMETER FailureThreshold
Percentage threshold for critical failures (default: 20).
#>

param(
[Parameter(Mandatory=$true)]
[string]$CurrentMetricsPath,

[Parameter(Mandatory=$true)]
[string]$PreviousMetricsPath,

[Parameter(Mandatory=$false)]
[decimal]$AlertThreshold = 10,

[Parameter(Mandatory=$false)]
[decimal]$FailureThreshold = 20
)

$ErrorActionPreference = "Stop"

Write-Host "=== Comparing Metrics ===" -ForegroundColor Cyan
Write-Host "Alert Threshold: $AlertThreshold%"
Write-Host "Failure Threshold: $FailureThreshold%"

# Load current metrics
$currentMetrics = @()
$currentFiles = Get-ChildItem -Path $CurrentMetricsPath -Filter "*.json" -Recurse

foreach ($file in $currentFiles) {
$content = Get-Content $file.FullName -Raw | ConvertFrom-Json
$currentMetrics += $content
}

Write-Host "Loaded $($currentMetrics.Count) current metrics"

# Load previous metrics if they exist
$previousMetrics = @()
if (Test-Path $PreviousMetricsPath) {
$previousFiles = Get-ChildItem -Path $PreviousMetricsPath -Filter "*.json" -Recurse

foreach ($file in $previousFiles) {
try {
$content = Get-Content $file.FullName -Raw | ConvertFrom-Json
$previousMetrics += $content
} catch {
Write-Warning "Could not parse previous metric file: $($file.Name)"
}
}

Write-Host "Loaded $($previousMetrics.Count) previous metrics"
} else {
Write-Host "No previous metrics found - this appears to be the first run"
}

# Compare metrics
$comparisons = @()
$alerts = @()
$criticalAlerts = @()

foreach ($current in $currentMetrics) {
# Find matching previous metric
$previous = $previousMetrics | Where-Object {
$_.dotnetVersion -eq $current.dotnetVersion -and
$_.template -eq $current.template -and
$_.platform -eq $current.platform
} | Select-Object -First 1

$comparison = @{
dotnetVersion = $current.dotnetVersion
template = $current.template
platform = $current.platform
currentSize = $current.packageSize
currentBuildTime = $current.buildTimeSeconds
previousSize = if ($previous) { $previous.packageSize } else { 0 }
previousBuildTime = if ($previous) { $previous.buildTimeSeconds } else { 0 }
sizeChange = 0
sizeChangePercent = 0
buildTimeChange = 0
buildTimeChangePercent = 0
status = "new"
}

if ($previous) {
if ($previous.packageSize -gt 0) {
$comparison.sizeChange = $current.packageSize - $previous.packageSize
$comparison.sizeChangePercent = [math]::Round(($comparison.sizeChange / $previous.packageSize) * 100, 2)
}

if ($previous.buildTimeSeconds -gt 0) {
$comparison.buildTimeChange = $current.buildTimeSeconds - $previous.buildTimeSeconds
$comparison.buildTimeChangePercent = [math]::Round(($comparison.buildTimeChange / $previous.buildTimeSeconds) * 100, 2)
}

# Determine status
if ($comparison.sizeChangePercent -ge $FailureThreshold) {
$comparison.status = "critical"
$criticalAlerts += $comparison
} elseif ($comparison.sizeChangePercent -ge $AlertThreshold) {
$comparison.status = "alert"
$alerts += $comparison
} elseif ($comparison.sizeChangePercent -gt 0) {
$comparison.status = "increased"
} elseif ($comparison.sizeChangePercent -lt 0) {
$comparison.status = "decreased"
} else {
$comparison.status = "unchanged"
}
}

$comparisons += $comparison
}

# Save comparison results
$comparisons | ConvertTo-Json -Depth 10 | Out-File -FilePath "comparison.json" -Encoding UTF8

# Generate alert report if needed
if ($alerts.Count -gt 0 -or $criticalAlerts.Count -gt 0) {
Write-Host "`n⚠️ ALERTS DETECTED!" -ForegroundColor Red

$alertReport = @"
# ⚠️ Template Size Alert - $(Get-Date -Format "yyyy-MM-dd")

Significant size increases detected in Uno Platform templates.

"@

if ($criticalAlerts.Count -gt 0) {
$alertReport += @"

## 🔴 Critical Increases (>$FailureThreshold%)

| Template | Platform | .NET | Previous | Current | Change |
|----------|----------|------|----------|---------|--------|

"@

foreach ($alert in $criticalAlerts) {
$prevMB = [math]::Round($alert.previousSize / 1MB, 2)
$currMB = [math]::Round($alert.currentSize / 1MB, 2)
$change = "+$($alert.sizeChangePercent)%"

$alertReport += "| $($alert.template) | $($alert.platform) | $($alert.dotnetVersion) | $prevMB MB | $currMB MB | $change 🔴 |`n"
}
}

if ($alerts.Count -gt 0) {
$alertReport += @"

## 🟡 Notable Increases (>$AlertThreshold%)

| Template | Platform | .NET | Previous | Current | Change |
|----------|----------|------|----------|---------|--------|

"@

foreach ($alert in $alerts) {
$prevMB = [math]::Round($alert.previousSize / 1MB, 2)
$currMB = [math]::Round($alert.currentSize / 1MB, 2)
$change = "+$($alert.sizeChangePercent)%"

$alertReport += "| $($alert.template) | $($alert.platform) | $($alert.dotnetVersion) | $prevMB MB | $currMB MB | $change 🟡 |`n"
}
}

$storageAccount = $env:AZURE_STORAGE_ACCOUNT
$date = Get-Date
$year = $date.ToString("yyyy")
$dateTime = $date.ToString("MM-dd-HH-mm")

$alertReport += @"

## Details

- **Workflow Run**: [View Details]($($env:GITHUB_SERVER_URL)/$($env:GITHUB_REPOSITORY)/actions/runs/$($env:GITHUB_RUN_ID))
- **Azure Storage**: [View Metrics](https://${storageAccount}.blob.core.windows.net/template-size-tracking/$year/$dateTime/)
- **Alert Threshold**: $AlertThreshold%
- **Failure Threshold**: $FailureThreshold%

---
*This issue was automatically generated by the daily template size tracking workflow.*
"@

$alertReport | Out-File -FilePath "alert-report.md" -Encoding UTF8

# Set output for GitHub Actions
Add-Content -Path $env:GITHUB_OUTPUT -Value "alert=true"

if ($criticalAlerts.Count -gt 0) {
Add-Content -Path $env:GITHUB_OUTPUT -Value "critical=true"
Write-Host "Critical alerts: $($criticalAlerts.Count)" -ForegroundColor Red
} else {
Add-Content -Path $env:GITHUB_OUTPUT -Value "critical=false"
}
} else {
Write-Host "`n✓ No significant size increases detected" -ForegroundColor Green
Add-Content -Path $env:GITHUB_OUTPUT -Value "alert=false"
Add-Content -Path $env:GITHUB_OUTPUT -Value "critical=false"
}

# Output summary
Write-Host "`n=== Comparison Summary ===" -ForegroundColor Cyan
Write-Host "Total comparisons: $($comparisons.Count)"
Write-Host "New entries: $(($comparisons | Where-Object { $_.status -eq 'new' }).Count)"
Write-Host "Decreased: $(($comparisons | Where-Object { $_.status -eq 'decreased' }).Count)"
Write-Host "Unchanged: $(($comparisons | Where-Object { $_.status -eq 'unchanged' }).Count)"
Write-Host "Increased: $(($comparisons | Where-Object { $_.status -eq 'increased' }).Count)"
Write-Host "Alerts: $($alerts.Count)" -ForegroundColor Yellow
Write-Host "Critical: $($criticalAlerts.Count)" -ForegroundColor Red
Loading
Loading