[Packaging] Packaging onnxruntime-node for macOS x86-64#29502
Open
hariharans29 wants to merge 8 commits into
Open
[Packaging] Packaging onnxruntime-node for macOS x86-64#29502hariharans29 wants to merge 8 commits into
hariharans29 wants to merge 8 commits into
Conversation
Switch macOS x86_64 CI runner from deprecated macos-13 to macos-15-intel, standardize Xcode to 16, run x86_64 CoreML/WebGPU matrix jobs natively, and add a MacOS_C_API_Packaging_CPU_x86_64 packaging job so onnxruntime-node ships darwin/x64 binaries again (closes #27961).
Contributor
There was a problem hiding this comment.
Pull request overview
This PR restores macOS x86_64 (darwin/x64) packaging coverage—especially for onnxruntime-node—by adding an x86_64 macOS packaging job in the Azure packaging pipeline and updating GitHub Actions macOS CI to run x86_64 CoreML/WebGPU builds natively on macos-15-intel with Xcode 16.
Changes:
- Add macOS x86_64 outputs to Java JAR packaging inputs and Node.js NPM packaging artifact collection.
- Parameterize the macOS CPU packaging job to run for both
x86_64andarm64, and update the publish stage to prepare a universal binary viaprepare_macos_package.py. - Update GitHub Actions mac workflows to use
macos-15-intelfor x86_64 and standardize Xcode selection to 16.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/ci_build/github/windows/jar_packaging.py | Adds macOS x86_64 Java artifact directory to CPU JAR packaging inputs. |
| tools/ci_build/github/azure-pipelines/templates/mac-cpu-packing-jobs.yml | Parameterizes macOS packaging job by arch and adds x86_64 build branch. |
| tools/ci_build/github/azure-pipelines/templates/mac-cpu-packaging-steps.yml | Makes arch explicit and maps x86_64 → Node x64 for node artifact publishing. |
| tools/ci_build/github/azure-pipelines/templates/mac-cpu-packaging-pipeline.yml | Runs both arch packaging jobs and uses Python to prepare + zip for signing/universal creation. |
| tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml | Downloads the new macOS x86_64 Java artifact for JAR packaging. |
| tools/ci_build/github/azure-pipelines/stages/nodejs-npm-packaging-stage.yml | Downloads and stages darwin/x64 node artifacts into the NPM packaging layout. |
| .github/workflows/macos-ci-build-and-test-workflow.yml | Switches x86_64 runs to macos-15-intel and standardizes Xcode to 16. |
| .github/workflows/mac.yml | Updates CoreML/WebGPU matrices to run x86_64 builds on x86_64 runners (no arm64→x86_64 cross-build). |
PR #29502 replicates upstream #27968 which adds onnxruntime-java-osx-x86_64 to run_packaging's CPU platform list. Update jar_packaging_test.py's CPU fixture to create the corresponding artifact directory and libcustom_op_library.dylib, and extend the post-run cleanup assertion so the test verifies the file is consumed from the osx-x86_64 slot (archive_lib=True) like linux-x64 and osx-arm64. GPU fixture is unchanged since GPU's package_definitions still only touches onnxruntime-java-linux-x64. Addresses Copilot review comment on PR #29502.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
tools/ci_build/github/windows/jar_packaging_test.py:71
- The CPU fixture for the new macOS artifacts uses native subdirectories
ai/onnxruntime/native/osx-x86_64and.../osx-arm64, but the Java packaging script normalizes macOS arch names to Java conventions (osx-x64andosx-aarch64) for.dylibbuilds (see tools/ci_build/linux_java_copy_strip_binary.py:103-108). This mismatch makes the test fixture diverge from real artifact layout and can hide regressions in jar path handling for macOS.
osx_x86_64_dir = java_artifact_dir / "onnxruntime-java-osx-x86_64"
osx_x86_64_native_dir = osx_x86_64_dir / "ai" / "onnxruntime" / "native" / "osx-x86_64"
osx_x86_64_native_dir.mkdir(parents=True, exist_ok=True)
create_empty_file(osx_x86_64_dir / "libcustom_op_library.dylib")
osx_arm64_dir = java_artifact_dir / "onnxruntime-java-osx-arm64"
osx_arm64_native_dir = osx_arm64_dir / "ai" / "onnxruntime" / "native" / "osx-arm64"
osx_arm64_native_dir.mkdir(parents=True, exist_ok=True)
create_empty_file(osx_arm64_dir / "libcustom_op_library.dylib")
edgchen1
reviewed
Jul 2, 2026
Addresses Copilot review feedback on PR #29502. The CPU fixture previously used the CI arch tag (osx-x86_64 / osx-arm64) for the inner ai/onnxruntime/native/<arch> path, but linux_java_copy_strip_binary.py renames those to the Java convention (osx-x64 / osx-aarch64) for .dylib builds before run_packaging reads them, so the fixture no longer reflected reality. Also add libonnxruntime.dylib + libonnxruntime4j_jni.dylib to the fixture and assert those files land in the main JAR under osx-x64 / osx-aarch64, and assert the pre-rename paths do NOT appear -- so a regression in the archive step or the arch-name convention would be caught. Locally validated: test_cpu_packaging PASSED both parameterizations with 7-Zip installed.
# Conflicts: # .github/workflows/macos-ci-build-and-test-workflow.yml
Address Copilot review comment: with both osx-x86_64 and osx-arm64 set to archive_lib: True, add_file_to_archive writes both dylibs by file name into testing.jar, so the second call silently overwrites the first. Follow the Linux pattern (only x64 archived) and archive only arm64. Extend jar_packaging_test.py to give each osx dylib distinct bytes and assert the arm64 marker wins with a single entry.
Address Copilot review comment: the CPU fixture created the linux-aarch64 native directory but no libs inside it, so test_cpu_packaging couldn't catch regressions dropping linux-aarch64 native libs from the packaged JAR. Add libonnxruntime.so and libonnxruntime4j_jni.so to the fixture and assert both appear under ai/onnxruntime/native/linux-aarch64/ in the main JAR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Switch macOS x86_64 CI runner from deprecated macos-13 to macos-15-intel, standardize Xcode to 16, run x86_64 CoreML/WebGPU matrix jobs natively, and add a MacOS_C_API_Packaging_CPU_x86_64 packaging job so onnxruntime-node ships darwin/x64 binaries again
NOTE: Internal dupe of #27968. Contribution credit to @JellyBrick
Motivation and Context
Closes #27961