Skip to content

Build and validate generated samples in isolated test workspaces - #5308

Merged
mattleibow merged 33 commits into
mainfrom
mattleibow-samples-foundation-extraction
Oct 12, 2026
Merged

mattleibow merged 33 commits into
mainfrom
mattleibow-samples-foundation-extraction

Conversation

@mattleibow

@mattleibow mattleibow commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Make generated sample validation an ordinary .NET test suite that can run in CI, from the command line, or in an IDE. This replaces the imperative sample-build orchestration in samples.cake with discoverable tests, while keeping sample generation as an explicit prerequisite.

The suite validates the applications we distribute against one producing build's NuGet packages—not repository project references. Each test copies only its selected sample and required configuration into an isolated workspace, with private caches and SDK/import boundaries. Diagnostics survive cleanup, and cleanup touches only resources owned by the test.

What to review

  • Host-eligible Basic and Gallery builds, without changing their target frameworks. Gallery, WASM, and Blazor receive build-only coverage.
  • Console/Web execution on the host and in the two existing Docker samples: exit codes, HTTP responses, and platform-specific PNG comparisons. Docker checks visibly skip when Docker is unavailable; actual sample failures and incorrect container mode still fail.
  • Exact generated package references, including Uno's source/generated reference ordering; Cake/CI invocation and result publication; a solution containing the test runner's source dependencies.
  • Shared RunDotNetTest live progress/output and overridable platform/coverage defaults. TRX and hang diagnostics are retained.

The existing Integration and MSBuild suites, their entry points, device tests, and goldens remain in place. Browser execution and additional consumer SDK lanes are separate work. Dockerfiles retain their .NET 10 images; the Docker samples bundle Noto Sans so text rendering does not depend on container-installed fonts.

See Building and Validating Samples for package acquisition, generation, and local execution.

Related issues

Related to #5291 and #5297. This is the standalone samples foundation; consolidation remains in #5291, and consumer SDK lanes are in #5314.

Required skia PR

None.

Areas affected

  • Managed API (binding/)
  • Native / C API (externals/skia/src/c, include/c)
  • Generated P/Invoke bindings
  • Native dependency or Skia update (libpng, HarfBuzz, FreeType, zlib, milestone bump, …)
  • Views & integrations (MAUI, Uno, WPF, WinUI, Blazor, …)
  • Rendering output / visual behavior
  • Performance
  • Tests
  • Build, packaging, or CI
  • Documentation or samples

Changes

Public API: None; no shipped managed API or native ABI changes.

Behavior: Docker sample text uses a bundled font. Sample validation checks exact image dimensions and allows at most 0.075% changed pixels with zero channel tolerance; references are never accepted automatically. Shared Cake test runs show live progress/output and respect explicit platform/coverage property overrides. Core rendering comparisons and GPU policies are unchanged.

Testing

Full CI: Build 1630344 succeeded with all stages green at source 7ea57f453ff2, before the subsequent shared-helper changes. Its tested merge 23e50175f022 includes main 6e0e83eaa4b8 and that source head.

Samples host Passed Skipped Failed
Windows 112 0 0
macOS 107 4 0
Linux 105 0 0
Total 322 4 0

The four macOS skips were Docker availability; Windows/Linux Docker checks ran. Linux initially failed before tests on a truncated Emscripten download. A user-authorized Linux-only retry passed; Windows/macOS remained on their original successful attempts. Native, managed, packaging, core Tests, and MSBuild package stages also passed.

Latest helper changes: current head 2180818e7cb has focused actual-Cake validation, not a new full CI result. Logging defaults/explicit capture overrides were verified at 9d297e2fc4ad; platform/coverage defaults and overrides were verified at 2180818e7cb. Each probe called the real RunDotNetTest; temporary probe tasks were removed afterwards.

Local commands and results

Local sample checks used macOS ARM64 and one unchanged producing package cohort: SkiaSharp 4.156.0-pr.5308.26508.28 / HarfBuzzSharp 14.4.0.100-pr.5308.26508.28 from build 1629251.

  • dotnet cake --target=samples-generate --previewLabel=pr.5308 --buildNumber=26508.28 --verbosity=quiet — passed.
  • DEVELOPER_DIR=/Applications/Xcode-26.6.0.app/Contents/Developer dotnet test tests/SkiaSharp.Tests.Samples.slnx -c Release -p:TargetFramework=net10.0 -p:TargetFrameworks=net10.0 -- --filter-trait Category=Infrastructure --report-trx --results-directory "$PWD/output/logs/samples-solution-dependencies" — 88/88 passed, including solution dependency restore/build.
  • DEVELOPER_DIR=/Applications/Xcode-26.6.0.app/Contents/Developer dotnet test tests/SkiaSharp.Tests.Samples/SkiaSharp.Tests.Samples.csproj -c Release -- --filter-trait Category=Infrastructure Category=Docker Category=SampleRun --report-trx --results-directory "$PWD/output/logs/mac-docker-availability-positive" — 94/94 passed, including local macOS containers. Repeating with an unavailable daemon or Docker absent from PATH gave 90 passed / 4 explicit availability skips / 0 failures each.
  • In-tree Basic and Gallery Uno builds for net10.0-desktop and net10.0-browserwasm — all four passed, with existing warnings and no errors.
  • dotnet cake scripts/infra/samples/samples.cake --target=logging-helper-probe --verbosity=diagnostic and the same command with --capture=true — 1/1 passed each at 9d297e2fc4ad. Expanded commands preserved default TestingPlatformCaptureOutput=false versus explicit true; live heartbeats/output, TRX, and hang arguments were checked. No --tl:off or subprocess-streaming rewrite.
  • dotnet cake scripts/infra/samples/samples.cake --target=property-defaults-probe --coverage=true --verbosity=diagnostic, the same command with --override-properties=true, and the same target without --coverage=true — 1/1 passed each for the 2180818e7cb change. Actual commands emitted properties once, preserved explicit overrides (including a spaced output path), and omitted coverage defaults when disabled. The caller dictionary remained unchanged. This proves argument handling, not coverage instrumentation.
  • git diff --check — passed.

An earlier unfiltered local run at 6625db5af967 was interrupted by premature MSBuild child exits, without a final summary/TRX. Its last progress count is not a passing gate; the completed CI result above is the full-suite evidence.

Screenshots (before / after)
Before: empty default typeface After: bundled Noto Sans
Docker Console before Docker Console after

Checklist

  • Tests added or updated (if omitted, explain why above)
  • Changes above lists all public API and behavioral changes (or "None.")
  • New/changed public API? Added or updated accurate source /// documentation and regenerated bindings when applicable
  • Native change? Companion mono/skia PR linked above and bindings regenerated

The final two items are not applicable: no shipped API or native changes.

v and others added 5 commits October 8, 2026 21:36
Pin the preview SDK and workload set to the reviewed RC1 versions. Replace obsolete preview Emscripten 5.0.6 jobs and merger inputs with all four 6.0.2 variants, preserving stable toolchains and the existing installer contract.

Align source and packaged native references, including the missing packaged Skia net11 boundary. Port the 80 item-selection evaluations into the existing MSBuild suite without replacing its package tests or CI stage.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cbe348b8-ee2b-40c5-b889-86aaead009c0
Keep RC1 terminology on the SDK/workload pins only; the WASM mapping applies to all net11.0+ targets.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cbe348b8-ee2b-40c5-b889-86aaead009c0
Integrate the landed SDK/workload provisioning refactor. Keep this branch's RC1 preview SDK and workload pins alongside main's split Tizen manifest band/version interface.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: cbe348b8-ee2b-40c5-b889-86aaead009c0
Replace imperative sample orchestration with discoverable sample builds and owned Docker HTTP checks, keeping the existing integration and MSBuild suites separate. Use host-controlled dotnet execution, repository-native runner references, retained diagnostics, and exact generated dependency declarations.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 5308

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 5308"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-5308/packages --name skiasharp-pr-5308
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-5308

@mattleibow
mattleibow added this pull request to stack #5309 October 8, 2026 22:46
Move build orchestration into SampleTestBase and environment configuration into DotNet. Keep build logs and available binlogs on failure, use current-context file attachment extensions, and nest discovered entry types in SampleLookup.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

📊 SkiaSharp benchmarks — PR #5308

⭐ this PR (full source build) vs 🌙 nightly · Linux · Windows · macOS

Informational only — this never blocks the PR. 🟢 faster / less allocation · 🔴 slower / more allocation; moves under 5% are hidden as noise.

⏱️ Times are raw BenchmarkDotNet means, and the ⭐ PR and baseline legs run on separate CI runners, so microbenchmarks can swing run-to-run — treat small time deltas as noise. Allocations are deterministic and the reliable signal. The interactive perf-dashboard (linked below) applies smoothing for the trend view.

Highlights

⏱️ Time — 🔴 57 slower · 🟢 6 faster

  • 🔴 ColorMathBenchmark.ToColor(Colors: 4096) · Windows · 5.52 µs → 15.78 µs (+186%)
  • 🔴 MatrixMapPointsBenchmark.MapPoints(Points: 4096) · Windows · 1.18 µs → 2.76 µs (+134%)
  • 🔴 PathBoundsBenchmark.TightBounds(Points: 1024) · Windows · 9.28 µs → 20.71 µs (+123%)
  • 🔴 MatrixMapPointsBenchmark.MapPoints(Points: 256) · Windows · 93.1 ns → 199.5 ns (+114%)
  • 🔴 PathBoundsBenchmark.TightBounds(Points: 64) · Windows · 946.1 ns → 1.92 µs (+103%)
  • …and 58 more (see details below)
Full per-OS benchmark deltas

Linux

⏱️ Time (vs 🌙 nightly 4.156.0-nightly.26508.3)

Benchmark baseline this PR Δ
RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) 98.31 µs 109.24 µs 🔴 +11%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 11.40 µs 12.13 µs 🔴 +6%
RasterImageLifecycleBenchmark.CreateRasterImage(Count: 256) 259.20 µs 272.78 µs 🔴 +5%
PathBoundsBenchmark.TightBounds(Points: 1024) 10.62 µs 10.07 µs 🟢 -5%

Windows

⏱️ Time (vs 🌙 nightly 4.156.0-nightly.26508.3)

Benchmark baseline this PR Δ
ColorMathBenchmark.ToColor(Colors: 4096) 5.52 µs 15.78 µs 🔴 +186%
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 1.18 µs 2.76 µs 🔴 +134%
PathBoundsBenchmark.TightBounds(Points: 1024) 9.28 µs 20.71 µs 🔴 +123%
MatrixMapPointsBenchmark.MapPoints(Points: 256) 93.1 ns 199.5 ns 🔴 +114%
PathBoundsBenchmark.TightBounds(Points: 64) 946.1 ns 1.92 µs 🔴 +103%
CanvasDrawBenchmark.Draw(Shapes: 512) 11.98 ms 23.05 ms 🔴 +93%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) 178.93 µs 341.56 µs 🔴 +91%
RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) 67.67 µs 128.69 µs 🔴 +90%
CanvasDrawBenchmark.Draw(Shapes: 64) 1.53 ms 2.90 ms 🔴 +90%
RuntimeEffectShaderBenchmark.DrawFrame 613.05 µs 1.16 ms 🔴 +89%
ColorParseBenchmark.Parse(Iterations: 1000) 46.74 µs 85.50 µs 🔴 +83%
RasterImageLifecycleBenchmark.CreateRasterImage(Count: 256) 159.78 µs 289.81 µs 🔴 +81%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 256) 713.08 µs 1.29 ms 🔴 +81%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 256) 531.82 µs 946.19 µs 🔴 +78%
SceneRenderBenchmark.RenderFrame(Complexity: 1) 1.25 ms 2.22 ms 🔴 +78%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 64) 144.67 µs 255.18 µs 🔴 +76%
MatrixMapPointsBenchmark.MapRadius(Points: 256) 6.04 µs 10.43 µs 🔴 +73%
SceneRenderBenchmark.RenderFrame(Complexity: 4) 5.98 ms 10.21 ms 🔴 +71%
ColorMathBenchmark.PreMultiply(Colors: 4096) 7.80 µs 13.29 µs 🔴 +70%
MatrixMapPointsBenchmark.MapVector(Points: 256) 5.21 µs 8.85 µs 🔴 +70%
MatrixMapPointsBenchmark.MapRadius(Points: 4096) 97.18 µs 164.97 µs 🔴 +70%
MatrixOpsBenchmark.Concat(Count: 4096) 151.76 µs 251.77 µs 🔴 +66%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 7.42 µs 12.27 µs 🔴 +65%
MatrixMapPointsBenchmark.MapVector(Points: 4096) 85.07 µs 139.70 µs 🔴 +64%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 2048) 6.59 ms 10.40 ms 🔴 +58%
…and 9 more

macOS

⏱️ Time (vs 🌙 nightly 4.156.0-nightly.26508.3)

Benchmark baseline this PR Δ
MatrixOpsBenchmark.Invert(Count: 4096) 126.14 µs 70.70 µs 🟢 -44%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 64) 192.14 µs 270.82 µs 🔴 +41%
RasterImageLifecycleBenchmark.CreateDataWithReleaseProc(Count: 256) 66.61 µs 93.29 µs 🔴 +40%
ColorMathBenchmark.ToColor(Colors: 4096) 19.83 µs 27.55 µs 🔴 +39%
CanvasDrawBenchmark.Draw(Shapes: 64) 1.64 ms 2.26 ms 🔴 +38%
RasterImageLifecycleBenchmark.CreateRasterImage(Count: 256) 155.72 µs 211.32 µs 🔴 +36%
PathBoundsBenchmark.TightBounds(Points: 1024) 8.80 µs 11.58 µs 🔴 +32%
MatrixOpsBenchmark.Concat(Count: 4096) 168.85 µs 116.97 µs 🟢 -31%
BitmapDrawBenchmark.DrawUnscaledTiles(Tiles: 256) 572.61 µs 738.74 µs 🔴 +29%
ColorMathBenchmark.UnPreMultiply(Colors: 4096) 7.44 µs 9.57 µs 🔴 +29%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 256) 791.92 µs 1.01 ms 🔴 +27%
ColorMathBenchmark.PreMultiply(Colors: 4096) 8.26 µs 10.32 µs 🔴 +25%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 1024) 665.08 µs 828.39 µs 🔴 +25%
ColorMathBenchmark.ToColorF(Colors: 4096) 5.32 µs 6.57 µs 🔴 +23%
ColorParseBenchmark.Parse(Iterations: 1000) 66.85 µs 82.43 µs 🔴 +23%
CanvasDrawBenchmark.Draw(Shapes: 512) 12.29 ms 15.12 ms 🔴 +23%
RuntimeEffectShaderBenchmark.DrawFrame 518.53 µs 622.33 µs 🔴 +20%
BitmapDrawBenchmark.DrawScaledTiles(Tiles: 64) 231.18 µs 277.37 µs 🔴 +20%
MatrixMapPointsBenchmark.MapRadius(Points: 4096) 126.45 µs 109.22 µs 🟢 -14%
MatrixMapPointsBenchmark.MapPoints(Points: 4096) 2.12 µs 2.40 µs 🔴 +14%
LargeImageScaleBenchmark.UpscaleOpaque(Size: 2048) 2.93 ms 3.32 ms 🔴 +13%
MatrixMapPointsBenchmark.MapVector(Points: 4096) 48.61 µs 43.36 µs 🟢 -11%
SceneRenderBenchmark.RenderFrame(Complexity: 1) 1.35 ms 1.49 ms 🔴 +11%
LargeImageScaleBenchmark.UpscaleCrossfade(Size: 1024) 1.46 ms 1.56 ms 🔴 +7%
MatrixMapPointsBenchmark.MapPoint(Points: 4096) 24.99 µs 23.41 µs 🟢 -6%

📈 Full interactive perf-dashboard & run details →

v and others added 3 commits October 9, 2026 01:01
Route SDK selection and builds through DotNet.Run with workspace-local defaults and the shared dotnet process configuration.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Use one case source for build and run checks, with a single HTTP-versus-console dispatch. Require both original Docker samples and expose host settings directly through a read-only dictionary.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Keep case generators free of coverage assertions, validate Docker/Basic/Gallery cases independently, and select HTTP Docker execution by the presence of sample.http instead of a folder name.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Base automatically changed from mattleibow-rc1-wasm-extraction to main October 9, 2026 01:19
v and others added 2 commits October 9, 2026 03:20
Keep runtime expectations in explicit sample tests, share HTTP and owned app lifetime handling, and retain separate stdout and stderr diagnostics. Replace ambiguous container copying with DownloadFile and remove synthetic runner scenarios and unused configuration.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
v and others added 3 commits October 9, 2026 04:20
Include the normalized sample folder and a GUID in workspace, diagnostic, Docker context, and container names without repeating repository or test prefixes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Minimal .NET containers have no usable default fonts. Embed the existing licensed Noto Sans font, retain font/typeface diagnostics and resolved Web text, and render using the loaded typeface. Include its redistribution license in published output.

Add reviewed macOS-host and Linux-container PNG references from real sample executions; leave other platforms pending producing-CI captures rather than substituting references.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Copy Noto Sans to the output root and load it from a file. Remove explicit font-load throws, temporary font diagnostics, and the diagnostic-only test assertion; use rendered PNG comparisons as proof.
Keep short font attribution and license links in all four Noto Sans sample READMEs instead of standalone license files.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
v added 2 commits October 9, 2026 06:01
Focus on package acquisition, direct test entry points, host/consumer isolation, SDK selection, and retained diagnostics.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Keep build and runtime selection consistent for host-specific solutions and Dockerfiles while leaving each test's arguments and assertions explicit.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
v and others added 4 commits October 9, 2026 08:59
Declare the existing NoDependencies native project alongside SkiaSharp so sample generation retains an exact-cohort Linux package reference. Cover both Console and Web in the generated dependency contract; the producing Linux runtime checks previously failed before rendering because libSkiaSharp.so was absent.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Generate consumer references from the exact staged SkiaSharp and HarfBuzzSharp package identities, rather than a later job's build counter. Preserve package-free publication and reject incomplete, duplicate, or mismatched cohorts.

Provision an owned Colima/QEMU Docker daemon on macOS without nested virtualization or default-context changes. Remove only its profile after sample checks. Add reviewed Linux host references from producing build 1629334, whose four attempts rendered identical PNGs.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Use genuine Host and Nano Server Console/Web captures from producing build 1629446 at source 9a1e242. Each of four attempts passed all checks except missing references and produced byte-identical captures. Keep zero-tolerance comparisons unchanged.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Keep per-channel tolerance at zero and bound the number of differing decoded pixels using exact decimal arithmetic. Cover exact and fractional boundaries, both sample sizes, and one-level color/alpha changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Use explicit producing versions, validate actual generated projects, and keep Docker availability diagnostics in tests with CI-owned PATH setup.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
v and others added 12 commits October 9, 2026 19:37
Retry ENOTEMPTY once only when the remaining owned tree contains .DS_Store metadata and directories. Preserve failures for unrelated residue, symlinks, errors and persistent writers, and retain Windows cleanup bounds.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Keep setup, explicit package-version arguments, direct test commands and failure diagnostics. Remove CI run history and implementation detail from the guide.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Keep concise prerequisites, sample-local run commands, and a short guide to using each application. Remove implementation inventories and repository-only instructions from exported sample documentation.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Add a temporary dependency-free AcesShared diagnostic stage with checkout disabled. Report installed Docker CLI paths, context, client/server versions, and bounded daemon probes without provisioning Docker or modifying shared resources.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Use Homebrew only when Docker is unavailable, in both the quick diagnostic and actual sample job. Disable automatic Homebrew updates and cleanup, propagate installation failures, and keep daemon provisioning out of scope.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Declare macOS exclusions for Docker build and runtime tests, retaining ordinary macOS sample builds and host runtimes. Remove Homebrew Docker setup and the temporary AcesShared diagnostic stage now that Linux and Windows own container validation. Add regression coverage for the declared exclusions and update maintainer instructions.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Remove blanket macOS exclusions while retaining the existing bounded availability probe. Keep macOS CI provisioning removed, allow local container builds and runtimes, and guard against reintroducing platform-wide skips.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Declare product project references before the source-only Uno import. In-tree builds retain the helper's platform selection, while generation converts the same references into artifact-versioned packages without an Exists fallback.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Load SkiaSharp and its net10 macOS/Win32 native-assets dependencies alongside the Samples runner. Document the net10 solution invocation so the dependency projects do not build their entire shipping framework matrix.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Default TestingPlatformCaptureOutput to false while respecting caller overrides. Enable live xUnit output and plain runner formatting without changing the SDK terminal logger, TRX reporting, or hang protection.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Move the default from the unrelated device runner to RunDotNetTest. Exercised the actual Cake helper with default false and caller-supplied true; both focused runs passed and retained TRX/hang arguments.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
Route platform and optional coverage defaults through the cloned property dictionary so caller overrides are preserved and properties are emitted once.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: ac8c4892-07f6-42af-bc04-ef56eec95b1b
@mattleibow mattleibow changed the title Validate generated samples in isolated test workspaces Build and validate generated samples in isolated test workspaces Oct 10, 2026
@mattleibow
mattleibow removed this pull request from stack #5309 October 10, 2026 20:20
@mattleibow
mattleibow requested a balanced review from Copilot October 12, 2026 09:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Several rewritten sample quick-starts omit the required native bootstrap, so their commands are incomplete on a clean checkout.

4 open findings
What changed in this PR

Introduces isolated, package-based sample validation as a standard .NET test suite, with host and Docker execution integrated into Cake and CI.

Changes:

  • Adds isolated sample workspaces, build/runtime tests, package validation, and PNG comparisons.
  • Replaces imperative Cake sample orchestration with dotnet test and CI result publication.
  • Updates sample dependencies, bundled fonts, and developer documentation.
File Description
tests/​SkiaSharp.Tests.Samples/​Utils/​SampleWorkspace.cs Creates isolated consumer workspaces.
tests/​SkiaSharp.Tests.Samples/​Utils/​SampleTestBase.cs Shares sample preparation/build logic.
tests/​SkiaSharp.Tests.Samples/​Utils/​SampleLookup.cs Discovers host-eligible samples.
tests/​SkiaSharp.Tests.Samples/​Utils/​SampleImage.cs Validates PNGs and goldens.
tests/​SkiaSharp.Tests.Samples/​Utils/​SampleArtifacts.cs Publishes bounded diagnostics.
tests/​SkiaSharp.Tests.Samples/​Utils/​RunningApp.cs Manages executable sample lifecycles.
tests/​SkiaSharp.Tests.Samples/​Utils/​Repo.cs Defines repository test paths.
tests/​SkiaSharp.Tests.Samples/​Utils/​ProcessRunner.cs Runs bounded child processes.
tests/​SkiaSharp.Tests.Samples/​Utils/​DotNetRunningApp.cs Hosts running .NET samples.
tests/​SkiaSharp.Tests.Samples/​Utils/​DotNet.cs Builds and launches package consumers.
tests/​SkiaSharp.Tests.Samples/​Utils/​DockerSampleFixture.cs Builds and cleans Docker resources.
tests/​SkiaSharp.Tests.Samples/​Utils/​DockerRunningApp.cs Controls running containers.
tests/​SkiaSharp.Tests.Samples/​SkiaSharp.Tests.Samples.csproj Configures the new test runner.
tests/​SkiaSharp.Tests.Samples/​SampleInfrastructureTests.cs Tests isolation and diagnostics infrastructure.
tests/​SkiaSharp.Tests.Samples/​SampleDiscoveryTests.cs Verifies generated case coverage.
tests/​SkiaSharp.Tests.Samples/​GallerySampleTests.cs Builds generated Gallery solutions.
tests/​SkiaSharp.Tests.Samples/​DockerSampleTests.cs Exercises Docker samples.
tests/​SkiaSharp.Tests.Samples/​BasicSampleTests.cs Builds and runs Basic samples.
tests/​SkiaSharp.Tests.Samples/​AssemblyInfo.cs Serializes sample tests.
tests/​SkiaSharp.Tests.Samples/​ArtifactContractTests.cs Validates package cohorts and versions.
tests/​SkiaSharp.Tests.Samples.slnx Provides an IDE/test solution.
scripts/​infra/​tests/​test-shared.cake Adds configurable builds and live output.
scripts/​infra/​samples/​samples.cake Replaces build loops with the test suite.
scripts/​azure-templates-stages-test.yml Publishes sample results and diagnostics.
samples/​SkiaFiddle/​SkiaFiddle.csproj Enables generated SkiaSharp version stamping.
samples/​SkiaFiddle/​README.md Revises usage documentation.
samples/​SkiaFiddle/​Media/​README.md Updates media attribution text.
samples/​Gallery/​Uno/​SkiaSharpSample.Uno.csproj Adds generated-package prerequisites.
samples/​Gallery/​Uno/​README.md Simplifies Uno usage guidance.
samples/​Gallery/​README.md Revises Gallery instructions.
samples/​Gallery/​Maui/​README.md Simplifies MAUI guidance.
samples/​Basic/​Web/​SkiaSharpSample/​SkiaSharpSample.csproj Adds Linux native assets.
samples/​Basic/​UnoPlatform/​SkiaSharpSample/​SkiaSharpSample.csproj Adds Uno package prerequisites.
samples/​Basic/​UnoPlatform/​README.md Removes an obsolete cross-reference.
samples/​Basic/​DockerWebApi/​SkiaSharpSample/​SkiaSharpSample.csproj Publishes the bundled font.
samples/​Basic/​DockerWebApi/​SkiaSharpSample/​Program.cs Uses bundled Noto Sans.
samples/​Basic/​DockerWebApi/​README.md Documents font use and licensing.
samples/​Basic/​DockerConsole/​SkiaSharpSample/​SkiaSharpSample.csproj Publishes the bundled font.
samples/​Basic/​DockerConsole/​SkiaSharpSample/​Program.cs Uses bundled Noto Sans.
samples/​Basic/​DockerConsole/​README.md Documents font use and licensing.
samples/​Basic/​Console/​SkiaSharpSample/​SkiaSharpSample.csproj Adds Linux native assets.
samples/​Basic/​BlazorWebAssembly/​README.md Adds Noto Sans licensing.
samples/​Basic/​Android/​README.md Adds Noto Sans licensing.
documentation/​dev/​building-samples.md Documents the new test workflow.
build.cake Routes sample validation through tests.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread samples/Gallery/Maui/README.md Resolved
Comment thread samples/Gallery/README.md Resolved
Comment thread samples/Gallery/Uno/README.md Resolved
Comment thread samples/SkiaFiddle/README.md Resolved
@mattleibow
mattleibow marked this pull request as ready for review October 12, 2026 09:22
@mattleibow
mattleibow merged commit 82148e7 into main Oct 12, 2026
121 checks passed
@mattleibow
mattleibow deleted the mattleibow-samples-foundation-extraction branch October 12, 2026 14:01
mattleibow added a commit that referenced this pull request Oct 13, 2026
Run generated browser samples with Playwright (#5312)

Context: #5308
Context: #5291
Context: https://dev.azure.com/dnceng-public/public/_build/results?buildId=1633875

Validate package-consuming sample applications through their actual browser
UIs while keeping the test runner backed by repository source. Extend the
generated-sample foundation with browser interactions, reviewed screenshots
and explicit execution lifetimes rather than synthetic rendering apps.

Carry forward the browser slice of #5291 above the merged #5308 foundation.
Keep HTTP image checks independent of browser page checks, and retain the
separate Integration/MSBuild suites and their existing references.

~~ Exercise the generated applications, not substitute scenes ~~

Add named runtime facts for Basic Web, BrowserWebAssembly, Blazor CPU/GPU
and Drawing, and Uno CPU/Drawing. Build and launch generated copies against
the staged producing package cohort; the runner retains its SkiaSharp
ProjectReference and native import.

Add BrowserWebAssembly's native-assets project reference so generation also
supplies its SkiaSharp.NativeAssets.WebAssembly package dependency. Extend
the artifact-contract theory to check that generated reference.

Blazor Drawing selects colors and brush size, creates pointer strokes,
checks their pixels and clears them. Uno selects its declared
net10.0-browserwasm project target, waits beyond the splash screen, exercises
Drawing navigation and strokes, clears the canvas and returns to CPU
rendering. Its readiness check requires the rendered blue/purple scene,
not merely an existing canvas.

~~ Own browser lifetime and retain errors across operations ~~

BrowserRunningApp wraps the existing RunningApp rather than introducing
another server lifecycle. Callback completion disposes the browser context
and Chromium; the enclosing host callback retains process cleanup and logs.

Reuse the host's cached address and same-origin request validation for
browser navigation. Recognize BrowserWASM's "App url:" output alongside
"Now listening on:", accepting HTTP on 127.0.0.1 with a nonzero port.

Collect console errors and page exceptions across the callback. Assert
after navigation, element waits, screenshots and callback completion so
errors between operations or direct Page interactions cannot disappear.
Sentinel regressions verify multiple console errors and asynchronous page
exceptions. Retain a failure screenshot when execution fails before its
first normal capture.

~~ Distinguish stable pixel goldens from animated GPU smoke checks ~~

Capture full pages with a 1280x900 viewport, device scale 1 and light color
scheme. Add nine reviewed page references for each of Linux, macOS and
Windows, including drawn and cleared states.

Consolidate ValidateFile, SaveAndValidate and CompareGolden into file and
byte-array SampleImage.Validate overloads with SampleImageOptions. Save
supplied bytes before checking the PNG signature, then compare dimensions
and pixels. ExpectedSize preserves fixed-size HTTP and Console assertions;
omitted options retain the 0.075% differing-pixel budget with zero channel
tolerance. Missing references fail without creating replacements.

The animated Blazor GPU page instead uses a 6% mean absolute RGBA error,
normalized by pixel count, four channels and 255. This replaces, rather than
supplements, the differing-pixel criterion. It is a coarse smoke check:
uniform dark output can pass, and arbitrary animation frames are not strict
rendering goldens. Do not freeze the sample clock or infer deterministic
frame equivalence from this result.

Regression tests cover explicit pixel budgets, alpha-inclusive mean error,
the exact 6% boundary and rejection one channel step beyond the boundary.

~~ Preserve diagnostic snapshots instead of masking image failures ~~

Actual and expected captures can share a basename, and a capture may be
attached more than once. Duplicate xUnit attachment names could obscure the
real pixel mismatch with an attachment exception.

Give expected images an expected- prefix and assign repeated names numeric
suffixes in SampleArtifacts. Keep actual, expected and diff evidence
distinct while retaining the existing 8 MiB embedding limit and on-disk
artifacts. Regressions exercise same-basename mismatches and repeated
diagnostic snapshots.

~~ Select declared frameworks without retargeting dependencies ~~

Use one optional DotNetOptions record across BuildSample, DotNet.Build and
callback-based DotNet.Run; name raw command execution Execute. Options cover
configuration, framework, additional properties, working directory and
timeout, with Release remaining the sample default.

Pass framework selection through --framework rather than overriding
TargetFramework or TargetFrameworks. Protect configuration and helper-owned
restore properties from additional-property overrides. A compiling
regression selects net10.0-windows while referenced projects retain their
netstandard2.1 and net10.0 targets.

Keep inherited PATH selection and private consumer caches. Preserve
30-minute build and one-minute raw-command defaults. A run timeout controls
address and exit waits, not callback duration or browser-operation waits;
cleanup and output reads retain their one-minute bounds. Tests cover
property forwarding, working directories, argument boundaries, invalid
options and cleanup after timed-out waits.

~~ Make build coverage and runtime coverage independently visible ~~

Combine the former BasicSampleTests and GallerySampleTests compilation
theories in SampleBuildTests. Retain Console and HTTP execution in
BasicSampleRunTests, put ordinary browser execution in BrowserSampleRunTests
and isolate Uno's framework-specific startup in UnoBrowserSampleRunTests.

Split DockerSampleTests into DockerSampleBuildTests and
DockerSampleRunTests. Both retain the Docker execution group: an image build
requires a daemon even though it is compilation coverage. Browser facts and
browser-error regressions use Host; infrastructure and generated compilation
remain Build. Discovery regressions check eligible Basic/Gallery cases and
the shared Docker fixture.

~~ Separate sample preparation from Docker resource ownership ~~

Replace Utils/SampleTestBase with root-level DotNetSampleTestBase and add
DockerSampleTestBase beside the test classes. The .NET base owns its prepared
workspace; the Docker base stages a flat selected-sample context, local
packages and relative NuGet feed, then deletes that context after building.

Do not impose common inheritance on these different workspace lifetimes.
Reuse SampleWorkspace.CopyTree instead. Context tests check selected inputs,
excluded bin/obj directories, package staging and an empty-cohort failure.

DockerSampleFixture retains daemon policy, cached images, registered tags,
container callbacks and resource cleanup. Register a tag before its build
and cache it after success. Share the fixture across Docker build/run classes
so the split does not create independent image caches.

Put CLI syntax and command bounds behind named Docker operations such as
Ps, Build, Run, Port, Wait and Logs. Fixture and running-app code call those
operations rather than constructing argument arrays.

~~ Serialize shared resources without blocking unrelated collections ~~

Remove AssemblyInfo.cs's assembly-wide DisableTestParallelization setting.
BrowserSampleRunTests and UnoBrowserSampleRunTests share one serial browser
collection; Docker build/run classes share another for their mutable image
cache and resource registry.

Neither collection sets DisableParallelization=true, so unrelated collections
can run concurrently. Normal xUnit serialization within a class or collection
still applies, including SampleBuildTests theory rows. A reflection regression
checks the assembly policy, browser assignments and nonexclusive collection
definitions.

~~ Install the matching browser at the CI execution boundary ~~

Add Microsoft.Playwright 1.55.0 and a CI-only pre-test Chromium installation
target. Pass SampleRunGroup from Cake so Host and unfiltered runs install
Chromium, while Build and Docker groups do not. Keep local installation an
explicit documented prerequisite rather than a fixture or discovery download.

Preserve the canonical eight Samples jobs and existing provisioning. Build
1633875 succeeded for source ffb7ec0 through
merge 97bfa39.

Samples results were Linux Build 134, Host 14 and Docker 4; macOS Build 140
and Host 14; Windows Build 141, Host 14 and Docker 4. Those completed groups
reported zero failures and skips. Windows Host passed on its second attempt
without a source change after WebSampleReturnsImage exceeded the existing
four-second HTTP timeout. This records a successful retry, not a timeout fix
or proof that the failure cannot recur.

Co-authored-by: Matthew Leibowitz <[email protected]>
Co-authored-by: Copilot App <[email protected]>
@github-actions github-actions Bot added this to the 4.156.0-preview.1 milestone Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants