Skip to content

Validate-samples skill, samples build refactor, and stale file cleanup#3616

Merged
mattleibow merged 12 commits into
mainfrom
dev/remove-stale-sample-files
Mar 31, 2026
Merged

Validate-samples skill, samples build refactor, and stale file cleanup#3616
mattleibow merged 12 commits into
mainfrom
dev/remove-stale-sample-files

Conversation

@mattleibow

@mattleibow mattleibow commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Three related improvements to the samples build and validation workflow.

1. Add validate-samples skill and documentation

New Copilot skill (.github/skills/validate-samples/SKILL.md) that automates the workflow for building samples against CI-produced NuGet packages. Includes a helper script (detect-preview-version.ps1) to detect preview labels and build numbers from downloaded packages.

New developer documentation (documentation/dev/building-samples.md) explaining:

  • How the CI artifacts feed works (wrapper packages containing real NuGets)
  • Step-by-step guide for downloading packages and building samples
  • Platform-specific details (Docker, --sample filter, Mac/Windows/Linux variants)

2. Refactor samples build tasks

Extracted all sample-related Cake tasks from build.cake into scripts/cake/samples.cake:

  • samples-generate — generates and zips the samples directory
  • samples-prepare — prepares sample directories with NuGet config
  • samples-run — builds all sample solutions with platform-aware filtering
  • Docker build support (run.ps1 detection)

This reduces build.cake by ~140 lines and keeps sample logic self-contained.

3. Remove stale sample files

The revert in 76da5e16 re-added old sample files that had been replaced during the Basic samples refactoring. Also removes other unused files found during a thorough audit of all Basic samples.

Stale files from revert (19 files):

Platform Files Replaced by
iOS ViewController.cs, .designer.cs CpuViewController, DrawingViewController, GpuGLViewController, GpuMetalViewController
macOS ViewController.cs, .designer.cs Same — storyboard uses new controllers
tvOS ViewController.cs, .designer.cs Same — storyboard uses new controllers
MAUI MainPage.xaml, .xaml.cs CpuPage/DrawingPage/GpuPage via AppShell.xaml
BlazorWebAssembly NavMenu.razor, .css, Raster.razor, bootstrap.min.css, .map MudBlazor MainLayout.razor with MudNavMenu
Web jquery.validate.unobtrusive.js, .min.js dist/ copies already exist

Additional dead files from audit (5 files):

Platform Files Reason
BlazorWebAssembly MainLayout.razor.css Empty file
MacCatalyst Resources/LaunchScreen.xib Not referenced by Info.plist or csproj
Android Resources/drawable/ic_launcher_background.xml Launcher uses @color/ic_launcher_background from values/
Web _ValidationScriptsPartial.cshtml No page references it; sample has no forms

Validation

  • All samples built successfully via dotnet cake --target=samples
  • Manually launched and tested on: iOS simulator (iPhone 17 Pro Max), tvOS simulator (Apple TV 4K), macOS (native), Mac Catalyst, MAUI iOS, MAUI Mac Catalyst, MAUI Android, Android native

PR Checklist

  • Has tests (if omitted, state reason in description) — file deletions + build refactor, validated via sample builds
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

The revert in 76da5e1 ('Revert samples, source, and global.json
changes') re-added old sample files that had been replaced during the
Basic samples refactoring. Also removes other unused files found during
a thorough audit of all Basic samples.

Stale files from revert:
- iOS/macOS/tvOS: old ViewController.cs + .designer.cs replaced by
  CpuViewController, DrawingViewController, GpuGLViewController, etc.
- MAUI: old MainPage.xaml/.cs replaced by CpuPage/DrawingPage/GpuPage
- BlazorWebAssembly: old Bootstrap NavMenu.razor/.css, Raster.razor,
  bootstrap.min.css — app uses MudBlazor now
- Web: duplicate root-level jquery-validation-unobtrusive JS files

Additional dead files found via audit:
- BlazorWebAssembly: empty MainLayout.razor.css
- Web: removed jQuery library (Bootstrap 5 doesn't need it, no jQuery
  API calls in the sample) and unused _ValidationScriptsPartial.cshtml
  + jquery-validation libraries (no forms in the sample)
- Web: removed jQuery script tag from _Layout.cshtml
- WindowsForms: empty CpuPage/DrawingPage/GpuPage.resx template files,
  unused Properties/Resources.resx + Resources.Designer.cs
- MacCatalyst: unreferenced Resources/LaunchScreen.xib (Info.plist uses
  Main.storyboard, not this xib)
- Android: stale drawable/ic_launcher_background.xml (launcher uses
  @color/ic_launcher_background from values/ instead)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@mattleibow mattleibow force-pushed the dev/remove-stale-sample-files branch from 345211b to 4f5319e Compare March 30, 2026 20:37
mattleibow and others added 11 commits March 30, 2026 22:43
Add a Copilot skill that automates building and validating sample
projects using CI-produced NuGet packages, plus a developer guide
explaining the CI artifacts feed, cake targets, and troubleshooting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the 4 samples-related cake targets (samples-generate, samples-prepare,
samples-run, samples) from build.cake into scripts/cake/samples.cake alongside
the existing CreateSamplesDirectory helper.

Key improvements:
- Split monolithic 'samples' task into prepare/run phases
- Add --sample filter argument for building specific samples
- Enable Docker sample builds (previously commented out)
- Better error reporting: collect failures and report at the end
- Cleaner classification: build vs skip with reasons logged upfront

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove non-existent validate-samples-full target from Quick Reference
- Fix --artifactsFeed to --previewFeed (correct cake argument name)
- Fix stale line references pointing to build.cake instead of samples.cake
- Replace simplified version construction with actual code including
  FEATURE_NAME handling and conditional BUILD_NUMBER append
- Fix download resolution to show actual PREVIEW_LABEL pattern
- Remove incorrect externals-download ordering advice (both targets
  clear ./output/ so neither order preserves both outputs)
- Remove externals-download from building-samples.md targets table
  and Building with Native Binaries section

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove duplicated inline bash detection logic from SKILL.md and
building-samples.md. Both now reference the detect-preview-version.sh
script, which prints values the AI agent can parse from stdout.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
SKILL.md is now a lean AI runbook: just the 4 workflow steps,
troubleshooting, and a link to docs. Version construction details,
download resolution, cake arguments reference, and samples-generate
internals now live exclusively in building-samples.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The docs no longer duplicate the workflow steps — they point to the
validate-samples skill instead, with example prompts showing how to
invoke it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace bash detect-preview-version.sh with detect-preview-version.ps1.
Convert all inline code blocks in SKILL.md and building-samples.md to
PowerShell using short aliases (rm, ls, etc.).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow changed the title Remove stale sample files re-added by revert commit Validate-samples skill, samples build refactor, and stale file cleanup Mar 31, 2026
@mattleibow mattleibow merged commit 1196943 into main Mar 31, 2026
2 of 3 checks passed
@mattleibow mattleibow deleted the dev/remove-stale-sample-files branch March 31, 2026 00:57
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.

1 participant