Skip to content

[Packaging] Packaging onnxruntime-node for macOS x86-64#29502

Open
hariharans29 wants to merge 8 commits into
mainfrom
hari/pr_29392_dupe
Open

[Packaging] Packaging onnxruntime-node for macOS x86-64#29502
hariharans29 wants to merge 8 commits into
mainfrom
hari/pr_29392_dupe

Conversation

@hariharans29

Copy link
Copy Markdown
Member

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

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).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 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_64 and arm64, and update the publish stage to prepare a universal binary via prepare_macos_package.py.
  • Update GitHub Actions mac workflows to use macos-15-intel for 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).

Comment thread tools/ci_build/github/windows/jar_packaging.py
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_64 and .../osx-arm64, but the Java packaging script normalizes macOS arch names to Java conventions (osx-x64 and osx-aarch64) for .dylib builds (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")

Comment thread tools/ci_build/github/windows/jar_packaging_test.py
Comment thread .github/workflows/macos-ci-build-and-test-workflow.yml Outdated
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

# Conflicts:
#	.github/workflows/macos-ci-build-and-test-workflow.yml

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment thread tools/ci_build/github/windows/jar_packaging.py
Comment thread tools/ci_build/github/windows/jar_packaging_test.py
Comment thread tools/ci_build/github/windows/jar_packaging_test.py
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

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.

[Build] onnxruntime-node no longer shipping x86-64 since 1.23.x

3 participants