Skip to content

Fix failing GitHub Actions jobs in maui-build workflow#1

Merged
ayersdecker merged 5 commits into
mainfrom
copilot/setup-native-compute-framework
Jun 19, 2026
Merged

Fix failing GitHub Actions jobs in maui-build workflow#1
ayersdecker merged 5 commits into
mainfrom
copilot/setup-native-compute-framework

Conversation

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Fixes two related CI failures in .github/workflows/maui-build.yml caused by dotnet workload install maui not being supported on Linux.

Root Cause

The maui workload requires macOS (it includes iOS tooling) and cannot be installed on Linux runners. This caused the Framework (ubuntu-24.04) job to fail immediately, and would also have caused the MAUI Android build job to fail for the same reason.

Changes Made

  • framework job matrix: Removed ubuntu-24.04, keeping only macos-15. The Framework library build requires MAUI workloads to compile all TFMs (net9.0-ios, net9.0-android), which is only supported on macOS. Linux framework builds are already covered by codegen-tests.yml using FerrumSkipMobile=true.
  • android-maui job: Replaced dotnet workload install maui with dotnet workload install android. The android workload is supported on Linux and is sufficient for building net9.0-android targets.
Original prompt

You are scaffolding a new repository for a reusable native-compute framework for .NET MAUI. This repo is the framework only — no flagship app, no domain-specific consumer logic. Set up the repo structure, native build pipeline, and starter code described below. Where a decision isn't specified, propose the option and ask before committing to it — don't guess silently on architecture-level choices.

Vision

A framework that lets .NET MAUI apps run genuinely high-performance native code (real-time signal processing, DSP, ML inference, anything CPU-heavy) without each developer hand-rolling P/Invoke plumbing and cross-platform native build scripts from scratch. The framework should be domain-agnostic — it doesn't know or care what the native core it's binding actually does.

Architecture

Core target: any C or C++17 static library supplied by the consuming app — the framework doesn't ship one itself.
Frontend: .NET MAUI (C#), targeting iOS and Android first (Windows/macOS optional, flag as open question).
Interop: P/Invoke via [LibraryImport] (source-generated, AOT-compatible) — not [DllImport]. iOS builds must stay NativeAOT-compatible: no reflection-heavy dependencies anywhere in the generated interop layer.
Buffers: zero-copy where possible — pinned Span/Memory crossing into native code, blittable structs only at the boundary.

Build order

Repo skeleton — CMake project structure that can build an arbitrary static lib/XCFramework for iOS and a .so per ABI for Android, parameterized by a path to the consumer's C/C++ source.
One hand-wired [LibraryImport] function against a trivial test library (e.g. an add(int,int) stub), proving the toolchain works end to end on both platforms.
Interop codegen tool v0 — parses a C header, emits [LibraryImport] bindings and blittable struct definitions, automating what step 2 did by hand.
Zero-copy buffer abstraction (NativeBuffer or similar) wrapping the pinning/Span dance.
CI matrix validating the full pipeline (native build + codegen + MAUI build) on a sample project.
A minimal sample app (not a real product — just enough to demonstrate calling into a native core end to end) and a getting-started doc.

Hard constraints — do not deviate from these

No domain-specific logic belongs in this repo. If a contributor starts adding feature code that depends on what the native core does, flag it as scope creep.
Every component must stay NativeAOT-compatible on iOS — no runtime codegen, no reflection-based serialization, anywhere in the generated or hand-written interop code.
The codegen tool must fail loudly, not silently, on header constructs it can't safely bind (non-blittable types, function pointers, etc.) rather than emitting incorrect bindings.

Suggested repo structure

/native/ CMake templates + iOS/Android toolchain files (no app-specific source)
/tools/codegen/ Header-to-LibraryImport binding generator
/src/Framework/ C# library — generated-binding support, buffer abstraction
/samples/MinimalDemo/ Trivial end-to-end example, not a real app
/docs/ Architecture notes, getting-started guide
.github/workflows/ CI matrix: native build (iOS/Android) + MAUI build

Open questions to surface, not resolve unilaterally

Package/distribution model: NuGet package, source template, or both.
Whether Windows/macOS desktop MAUI targets are in scope for v1.
License (MIT or Apache-2.0 are reasonable defaults to propose).
Project name.

Copilot AI changed the title [WIP] Set up repository structure and native build pipeline Scaffold Ferrum: domain-agnostic native-compute framework for .NET MAUI Jun 19, 2026
Copilot AI requested a review from ayersdecker June 19, 2026 09:10
…matrix, use android workload for Android job
Copilot AI changed the title Scaffold Ferrum: domain-agnostic native-compute framework for .NET MAUI Fix failing GitHub Actions jobs in maui-build workflow Jun 19, 2026
@ayersdecker ayersdecker marked this pull request as ready for review June 19, 2026 09:32
Copilot AI review requested due to automatic review settings June 19, 2026 09:32
@ayersdecker ayersdecker merged commit 79da5f9 into main Jun 19, 2026
18 of 22 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

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 introduces a full initial Ferrum scaffold (framework library, codegen tool, native build pipeline, docs, samples) and updates CI workflows—despite the PR title/description focusing only on fixing MAUI workload installation failures in maui-build.yml.

Changes:

  • Added a ferrum-codegen .NET tool (regex-based header parser + [LibraryImport] emitter) with unit tests and a smoke-test workflow.
  • Added Ferrum.Framework (including NativeBuffer<T> and interop constants) plus a minimal MAUI demo app.
  • Added native CMake + scripts for building iOS XCFramework and Android .so artifacts, along with GitHub Actions workflows to build them.

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
tools/codegen/Program.cs CLI entrypoint for header→bindings generation.
tools/codegen/Parser/HeaderParser.cs Regex-based C header parser for functions/structs.
tools/codegen/Parser/CTypeMapping.cs C primitive→blittable C# type mapping with loud failures.
tools/codegen/Models/ParsedDeclarations.cs Parsed declaration models used by parser/emitter.
tools/codegen/Ferrum.Codegen.csproj Codegen tool project + pack-as-tool metadata.
tools/codegen/Emitter/BindingEmitter.cs Emits [LibraryImport] bindings and blittable structs.
tools/codegen/CodegenException.cs Exception type for “fail loudly” codegen behavior.
src/Framework/Interop/InteropConstants.cs Centralized library-name constant for [LibraryImport].
src/Framework/Ferrum.Framework.csproj Multi-targeted framework library packaging metadata.
src/Framework/Buffers/NativeBuffer.cs Pinned zero-copy managed buffer abstraction.
src/Framework.Tests/Ferrum.Framework.Tests.csproj Test project wiring + skip-mobile build properties.
src/Framework.Tests/Codegen/HeaderParserTests.cs Unit tests for header parsing/type mapping behavior.
src/Framework.Tests/Buffers/NativeBufferTests.cs Unit tests for NativeBuffer<T> semantics.
samples/MinimalDemo/Platforms/iOS/AppDelegate.cs iOS platform bootstrap for demo app.
samples/MinimalDemo/Platforms/Android/MainActivity.cs Android platform bootstrap for demo app.
samples/MinimalDemo/MinimalDemo.csproj MAUI demo project targeting iOS + Android.
samples/MinimalDemo/MauiProgram.cs MAUI app builder for demo.
samples/MinimalDemo/MainPage.xaml.cs Demo UI logic calling native stub + buffer demo.
samples/MinimalDemo/MainPage.xaml Demo UI layout.
samples/MinimalDemo/Interop/AddInterop.cs Demo [LibraryImport] binding for ferrum_add.
samples/MinimalDemo/App.xaml.cs Demo app root initialization.
samples/MinimalDemo/App.xaml Demo app resources.
README.md Expanded repo overview, quick start, layout, constraints.
native/test_stub/src/add.c Trivial native implementation for end-to-end smoke testing.
native/test_stub/include/add.h Header for native stub (codegen input).
native/test_stub/CMakeLists.txt Builds/install rules for the native stub lib.
native/scripts/build_ios.sh Builds slices + assembles XCFramework on macOS.
native/scripts/build_android.sh Builds .so per ABI via NDK toolchain.
native/CMakeLists.txt Top-level native build entrypoint + option for test stub.
native/cmake/ios.toolchain.cmake Minimal iOS CMake toolchain configuration.
native/cmake/ferrum_helpers.cmake Shared CMake helper macros for Ferrum-style libs.
Ferrum.sln Solution wiring for framework, tool, tests, sample.
docs/open-questions.md Captures unresolved architecture/product decisions.
docs/getting-started.md End-to-end integration walkthrough for consumers.
docs/architecture.md High-level architecture + supported type mapping.
Directory.Build.props Repo-wide MSBuild defaults (incl. warnings-as-errors).
.github/workflows/native-build.yml CI to build iOS slices/XCFramework + Android .so artifacts.
.github/workflows/maui-build.yml CI to build framework + MAUI sample (macOS + ubuntu).
.github/workflows/codegen-tests.yml Linux CI for tool/framework tests + codegen smoke run.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

private static readonly Regex BlockCommentRe = new(@"/\*.*?\*/", RegexOptions.Compiled | RegexOptions.Singleline);
private static readonly Regex PreprocessorRe = new(@"^\s*#[^\n]*", RegexOptions.Compiled | RegexOptions.Multiline);
private static readonly Regex ExternCBlockRe = new(@"extern\s+""C""\s*\{", RegexOptions.Compiled);
private static readonly Regex WhitespaceNormRe = new(@"\s+", RegexOptions.Compiled);
Comment on lines +100 to +104
private static string StripComments(string src)
{
string noBlock = BlockCommentRe.Replace(src, " ");
return LineCommentRe.Replace(noBlock, "");
}
Comment on lines +54 to +57
// ── Function-pointer detection (fail loudly)
private static readonly Regex FuncPtrRe = new(
@"\(\s*\*",
RegexOptions.Compiled);
Comment on lines +1 to +2
using System.Buffers;
using System.Runtime.InteropServices;
@@ -0,0 +1,40 @@
using System.Runtime.InteropServices;
Comment on lines +12 to +16
<!--
Publish as a dotnet global/local tool.
Install: dotnet tool install -g Ferrum.Codegen
Invoke: ferrum-codegen -input add.h -output AddBindings.cs
-->
Comment thread docs/getting-started.md
| Tool | Minimum version |
|---|---|
| .NET SDK | 9.0 |
| .NET MAUI workload | 9.0 (`dotnet workload install maui`) |
Comment on lines +96 to +97
- name: Install Android workload
run: dotnet workload install android
@@ -0,0 +1,106 @@
name: MAUI Build
Comment on lines +24 to +28
target_compile_options(${TARGET_NAME} PRIVATE
-fvisibility=hidden
-fno-exceptions # Keep the ABI surface minimal
$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
)
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.

3 participants