onnxruntime/tools/ci_build/github/apple/assemble_ios_packaging_artifacts.sh
Guoyu Wang 55278056ad
Cherry picks for release - 1.8.2, 2nd attempt (#8620)
* Add test for iOS package (#7816)

* Add test for iOS package

* Add readme

* fix pep8 warning

* Addressed CR comments, fixed CI failure

* Address CR comments

* Update readme.md

* Update package name and readme, added comments to the podspec

* Add podspec template for ios package, update build settings (#7907)

* Add podspec template for ios package

* minor formatting update

* Add spec.source_files for header files

* Update spec.public_header_files to spec.source_files

* minor update

* Add iOS packaging pipeline (#8264)

Create a pipeline to produce the iOS package artifacts.

* [iOS] Packaging pipeline improvements. (#8324)

Updates to the iOS packaging pipeline:
- Make it harder to overwrite package archives accidentally when uploading (fails if the archive already exists)
- Only upload package archives for release builds
- Some clean up

* Add metadata_props to ORT model (#8340)

* Add metadata_props to ORT model

* Minor update

* Update python binding, and increase the minimal pipeline size threshold

* Fixed a small bug in serializing ir_version

* Remove temp ort.py.fbs and add it to .gitignore

* Add iOS/macOS static framework (#8357)

* Add ability to generate ios static framework

* Fix typos

* Add pod cache clean, update some comments of previous commit

* Fix CI failure with newly added cpuinfo library

* Update test model (CoreML requires node has a name)

* Addressed CR comments

* Fix iOS packaging pipeline failure (#8433)

* Fix optimizer crash (#8274)

* Update iOS packaging script to default build static framework, disable bitcode (#8533)

* default package build to static, disable bitcode

* fix pipeline failure

* Address CR comments

* Add HardSigmoid to mobile packages. Used by PyTorch MobileNet v3 (#8552)

* bump the version number to 1.8.2

* Change Windows GPU machine pool to onnxruntime-win-cuda11-0

* [Objective-C API] Fix ORTIsCoreMLExecutionProviderAvailable link error when used from Swift. (#8350)

Co-authored-by: Edward Chen <18449977+edgchen1@users.noreply.github.com>
Co-authored-by: RandySheriffH <48490400+RandySheriffH@users.noreply.github.com>
Co-authored-by: Scott McKay <skottmckay@gmail.com>
Co-authored-by: Changming Sun <chasun@microsoft.com>
2021-08-04 19:07:27 -07:00

63 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
# Note: This script is intended to be called from the iOS packaging build or a similar context
# See tools/ci_build/github/azure-pipelines/mac-ios-packaging-pipeline.yml
set -e
set -x
USAGE_TEXT="Usage: ${0} <binaries staging directory> <artifacts staging directory> <ORT pod version> <whether to upload the package archives, 'true' or 'false'>"
abspath() {
local INPUT_PATH=${1:?"Expected path as the first argument."}
echo "$(cd "$(dirname "${INPUT_PATH}")" && pwd)/$(basename "${INPUT_PATH}")"
}
# staging directory for binaries (source)
BINARIES_STAGING_DIR=$(abspath "${1:?${USAGE_TEXT}}")
# staging directory for build artifacts (destination)
ARTIFACTS_STAGING_DIR=$(abspath "${2:?${USAGE_TEXT}}")
ORT_POD_VERSION=${3:?${USAGE_TEXT}}
SHOULD_UPLOAD_ARCHIVES=${4:?${USAGE_TEXT}}
STORAGE_ACCOUNT_NAME="onnxruntimepackages"
STORAGE_ACCOUNT_CONTAINER_NAME="ortmobilestore"
STORAGE_URL_PREFIX="https://${STORAGE_ACCOUNT_NAME}.blob.core.windows.net/${STORAGE_ACCOUNT_CONTAINER_NAME}"
assemble_and_upload_pod() {
local POD_NAME=${1:?"Expected pod name as first argument."}
local POD_ARCHIVE_BASENAME="${POD_NAME}-${ORT_POD_VERSION}.zip"
local PODSPEC_BASENAME="${POD_NAME}.podspec"
pushd ${BINARIES_STAGING_DIR}/${POD_NAME}
# assemble the files in the artifacts staging directory
zip -r ${ARTIFACTS_STAGING_DIR}/${POD_ARCHIVE_BASENAME} * --exclude ${PODSPEC_BASENAME}
cp ${PODSPEC_BASENAME} ${ARTIFACTS_STAGING_DIR}/${PODSPEC_BASENAME}
if [[ "${SHOULD_UPLOAD_ARCHIVES}" == "true" ]]; then
# upload the pod archive and set the podspec source to the pod archive URL
az storage blob upload \
--account-name ${STORAGE_ACCOUNT_NAME} --container-name ${STORAGE_ACCOUNT_CONTAINER_NAME} \
--file ${ARTIFACTS_STAGING_DIR}/${POD_ARCHIVE_BASENAME} --name ${POD_ARCHIVE_BASENAME} \
--if-none-match "*"
sed -i "" -e "s|file:///http_source_placeholder|${STORAGE_URL_PREFIX}/${POD_ARCHIVE_BASENAME}|" \
${ARTIFACTS_STAGING_DIR}/${PODSPEC_BASENAME}
fi
popd
}
assemble_and_upload_pod "onnxruntime-mobile-c"
assemble_and_upload_pod "onnxruntime-mobile-objc"
cd ${BINARIES_STAGING_DIR}/objc_api_docs
zip -r ${ARTIFACTS_STAGING_DIR}/objc_api_docs.zip *
cat > ${ARTIFACTS_STAGING_DIR}/readme.txt <<'EOM'
Release TODO:
- publish the podspecs
- publish the Objective-C API documentation
EOM