Skip to content

CI: typecheck the Apple sources on every pull request - #398

Merged
fotiDim merged 2 commits into
mainfrom
ci/apple-typecheck
Nov 23, 2026
Merged

fotiDim merged 2 commits into
mainfrom
ci/apple-typecheck

Conversation

@fotiDim

@fotiDim fotiDim commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Nothing in CI compiles darwin/ today: the pull request workflow runs Windows + Linux builds, Dart tests, Android unit tests, Chrome tests and pana, and never touches Swift. The Apple guards in #396 therefore had no automated proof behind them — only a local swiftc -typecheck.

This adds a macos-latest job with two steps.

Typecheck, per platform. The plugin sources are shared by iOS and macOS and branch on #if os(...), importing FlutterMacOS on one side and Flutter on the other. A single-platform check only proves one branch, so the job downloads both engine frameworks (flutter precache --macos --ios) and typechecks against each:

  • macOS: -target $(uname -m)-apple-macos10.15, -F …/engine/darwin-x64 (the engine framework there is universal, so it covers both runner architectures).
  • iOS: -target arm64-apple-ios13.1, -F …/engine/ios/Flutter.xcframework/ios-arm64.

Targets match the podspec (s.ios.deployment_target = '13.1', s.osx.deployment_target = '10.15'). No Pods, no codesigning, no example build — just the compiler.

The isolated helpers. darwin/universal_ble/Tests/run_write_ownership_test.sh, run_discovery_progress_test.sh and run_central_restoration_owner_test.sh each compile one source file with counted assertions and currently run nowhere in CI.

Verified locally on the same commands the job runs: both typechecks pass and the helpers report 31/31, 24/24 and 28/28.

This is deliberately a compile-level gate, not a behavioral one — the CoreBluetooth paths still need the device smoke test described in #396.

No workflow job built the darwin sources: the pull request checks are Windows,
Linux, Android, Chrome and pana, so a Swift change was only verified by whoever
ran it locally. That is how the guards added in #394 could reach review with
nothing but a local typecheck behind them.

Add a macOS job that downloads Flutter's macOS and iOS engine frameworks and
typechecks the shared plugin sources against each: the files branch with
#if os(...) and import FlutterMacOS or Flutter, so a single platform's module
only proves that platform's branch. It also runs the three isolated Apple
helpers (write ownership, discovery progress, central restoration ownership),
which compile one source file each with counted assertions.
@fotiDim
fotiDim force-pushed the ci/apple-typecheck branch 2 times, most recently from d445a83 to 8c12197 Compare November 23, 2026 11:14
The job failed twice on the runner. First the hosted SDK's engine directory
existed without the macOS framework, so precache skipped the download. Then,
once it did download, the framework turned out to be a slice inside
FlutterMacOS.xcframework rather than a bare FlutterMacOS.framework beside the
engine artifacts — and the directory is named after the host arch
(darwin-x64, darwin-arm64).

Move the typecheck into .github/scripts/typecheck_apple.sh, which locates the
macOS framework in either layout under the arch-named directory, resolves the
iOS flutter.xcframework/ios-arm64 slice, forces the precache download when
either is missing, and prints the engine listing if they still are not found.
The two workflow steps only call it, with --download-only for the fetch step.

Verified locally against both layouts: the installed SDK's bare framework and
a simulated runner tree with FlutterMacOS.xcframework/macos-arm64_x86_64.
@fotiDim
fotiDim merged commit e4d1853 into main Nov 23, 2026
4 checks passed
@fotiDim
fotiDim deleted the ci/apple-typecheck branch November 23, 2026 11:27
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.

1 participant