Skip to content

ci: cross-build PyO3 extension for linux-aarch64 and macos-x86_64#16

Merged
zackees merged 1 commit intomainfrom
test/pyo3-cross-build-verify
Apr 7, 2026
Merged

ci: cross-build PyO3 extension for linux-aarch64 and macos-x86_64#16
zackees merged 1 commit intomainfrom
test/pyo3-cross-build-verify

Conversation

@zackees
Copy link
Copy Markdown
Member

@zackees zackees commented Apr 7, 2026

Previously the PyO3 extension was skipped for the two cross-compiled targets, leaving those wheels CLI-only. FastLED's SerialMonitor (and the rest of the fbuild-python API) was unavailable on those platforms.

Build the extension for every target now:

  • linux aarch64: cargo-zigbuild --target aarch64-unknown-linux-gnu.2.17 (glibc, not musl, for manylinux_2_17 compatibility — CLI binaries remain musl for static-link portability)
  • macos x86_64: cargo rustc --target x86_64-apple-darwin with the same -undefined dynamic_lookup flag as the native macOS builds
  • PYO3_NO_PYTHON=1 + abi3-py39 lets pyo3-build-config skip host interpreter detection on cross builds

Also adds a fail-fast check so missing extensions fail the job rather than silently shipping a CLI-only wheel.

Summary by CodeRabbit

  • Chores
    • Enhanced Python extension build system to support cross-compilation for additional platform targets
    • Added artifact validation checks to ensure Python extensions are properly generated during the build process
    • Improved build reliability with streamlined error detection for missing or incomplete build outputs

Previously the PyO3 extension was skipped for the two cross-compiled
targets, leaving those wheels CLI-only. FastLED's SerialMonitor (and
the rest of the fbuild-python API) was unavailable on those platforms.

Build the extension for every target now:
- linux aarch64: cargo-zigbuild --target aarch64-unknown-linux-gnu.2.17
  (glibc, not musl, for manylinux_2_17 compatibility — CLI binaries
  remain musl for static-link portability)
- macos x86_64: cargo rustc --target x86_64-apple-darwin with the same
  -undefined dynamic_lookup flag as the native macOS builds
- PYO3_NO_PYTHON=1 + abi3-py39 lets pyo3-build-config skip host
  interpreter detection on cross builds

Also adds a fail-fast check so missing extensions fail the job rather
than silently shipping a CLI-only wheel.
@zackees zackees merged commit 30b637d into main Apr 7, 2026
65 of 82 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 7, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 64634fe3-c1ea-413d-bfc6-015f07e90ad6

📥 Commits

Reviewing files that changed from the base of the PR and between fe18255 and 698c6a0.

📒 Files selected for processing (1)
  • .github/workflows/template_native_build.yml

📝 Walkthrough

Walkthrough

The workflow now builds PyO3 Python extensions for all target configurations instead of skipping cross-compilation. The build step branches by target type, with Linux cross and macOS cross using specific tools and parameters, while native builds use existing logic. Artifact staging, validation, and stripping behavior are updated accordingly.

Changes

Cohort / File(s) Summary
Python Extension Cross-Compilation Build
.github/workflows/template_native_build.yml
Modified "Build Python extension" step to handle Linux cross (using cargo-zigbuild with glibc target), macOS cross (using cargo rustc with dynamic linking), and native builds. Updated artifact staging to handle different output paths for cross-builds. Added fail-fast validation checks for expected extension artifacts. Extended stripping behavior to Linux cross builds with llvm-strip.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Cross the border, high and low,

Extensions build for every flow,

Linux, Mac, both far and near,

Zigbuild rustles, artifacts clear! ✨

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/pyo3-cross-build-verify

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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