Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix iOS artifacts issue in Microsoft.ML.OnnxRuntime Nuget Package #19311

Merged
merged 10 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"build_osx_archs": {
"iphoneos": [
"arm64"
],
"iphonesimulator": [
"arm64",
"x86_64"
]
},
"build_params": {
"base": [
"--parallel",
"--use_xcode",
"--build_apple_framework",
"--use_coreml",
"--use_xnnpack",
"--skip_tests",
"--cmake_extra_defines=onnxruntime_BUILD_UNIT_TESTS=OFF"
],
"iphoneos": [
"--ios",
"--apple_deploy_target=12.0"
],
"iphonesimulator": [
"--ios",
"--apple_deploy_target=12.0"
]
}
}
9 changes: 8 additions & 1 deletion tools/ci_build/github/apple/test_apple_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def _test_apple_packages(args):
cwd=target_proj_path,
)

if PackageVariant[args.variant] != PackageVariant.Mobile:
if PackageVariant[args.variant] != PackageVariant.Mobile and not args.skip_macos_test:
subprocess.run(
[
"xcrun",
Expand Down Expand Up @@ -206,6 +206,13 @@ def parse_args():
help="Prepare the test project only, without running the tests",
)

parser.add_argument(
"--skip_macos_test",
action="store_true",
help="Skip macos platform tests. Specify this argument when build targets only contain ios archs. "
"(Currently only applies to the build using default_full_ios_framework_build_settings.json config.)",
YUNQIUGUO marked this conversation as resolved.
Show resolved Hide resolved
)

return parser.parse_args()


Expand Down
23 changes: 12 additions & 11 deletions tools/ci_build/github/azure-pipelines/templates/c-api-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,31 +119,32 @@ stages:
- script: |
set -e -x
python3 tools/ci_build/github/apple/build_apple_framework.py \
--build_dir "$(Build.BinariesDirectory)/apple_framework" \
--build_dir "$(Build.BinariesDirectory)/ios_framework" \
--path_to_protoc_exe $(Build.BinariesDirectory)/protobuf_install/bin/protoc \
tools/ci_build/github/apple/default_full_apple_framework_build_settings.json
tools/ci_build/github/apple/default_full_ios_framework_build_settings.json
YUNQIUGUO marked this conversation as resolved.
Show resolved Hide resolved
mkdir $(Build.BinariesDirectory)/artifacts
mkdir -p $(Build.BinariesDirectory)/artifacts_staging/onnxruntime-apple-xcframework-$(OnnxRuntimeVersion)
cp -R $(Build.BinariesDirectory)/apple_framework/framework_out/onnxruntime.xcframework \
$(Build.BinariesDirectory)/artifacts_staging/onnxruntime-apple-xcframework-$(OnnxRuntimeVersion)
mkdir -p $(Build.BinariesDirectory)/artifacts_staging/onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
cp -R $(Build.BinariesDirectory)/ios_framework/framework_out/onnxruntime.xcframework \
$(Build.BinariesDirectory)/artifacts_staging/onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
pushd $(Build.BinariesDirectory)/artifacts_staging
zip -vr $(Build.BinariesDirectory)/artifacts/onnxruntime_xcframework.zip \
onnxruntime-apple-xcframework-$(OnnxRuntimeVersion)
onnxruntime-ios-xcframework-$(OnnxRuntimeVersion)
popd
displayName: "Build Apple xcframework"

- script: |
python3 tools/ci_build/github/apple/test_apple_packages.py \
--fail_if_cocoapods_missing \
--framework_info_file "$(Build.BinariesDirectory)/apple_framework/xcframework_info.json" \
--c_framework_dir "$(Build.BinariesDirectory)/apple_framework/framework_out" \
--variant Full
--framework_info_file "$(Build.BinariesDirectory)/ios_framework/xcframework_info.json" \
--c_framework_dir "$(Build.BinariesDirectory)/ios_framework/framework_out" \
--variant Full \
--skip_macos_test
displayName: "Test Apple framework"

- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.BinariesDirectory)/artifacts'
artifactName: 'onnxruntime-apple-full-xcframework'
artifactName: 'onnxruntime-ios-full-xcframework'

- template: component-governance-component-detection-steps.yml
parameters:
Expand Down Expand Up @@ -350,7 +351,7 @@ stages:
- template: flex-downloadPipelineArtifact.yml
parameters:
StepName: 'Download iOS Pipeline Artifact'
ArtifactName: 'onnxruntime-apple-full-xcframework'
ArtifactName: 'onnxruntime-ios-full-xcframework'
TargetPath: '$(Build.BinariesDirectory)/nuget-artifact'
SpecificArtifact: ${{ parameters.specificArtifact }}
BuildId: ${{ parameters.BuildId }}
Expand Down
Loading