Skip to content

ios

ios #62

Workflow file for this run

name: ios
on:
workflow_dispatch:
inputs:
version:
description: "Version information (e.g., 1.19.0)"
required: true
permissions:
contents: write
env:
ONNXRUNTIME_VERSION:
|- # Enter release tag name or version name in workflow_dispatch. Appropriate version if not specified
${{ github.event.release.tag_name || github.event.inputs.version || '1.19.0' }}
jobs:
ios_arm64:
name: arm64
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
steps:
- name: Cache build result for ${{ env.ONNXRUNTIME_VERSION }}
id: cache-build-result
uses: actions/cache@v2
with:
path: onnxruntime-ios-arm64-${{ env.ONNXRUNTIME_VERSION }}
key: onnxruntime-ios-arm64-${{ env.ONNXRUNTIME_VERSION }}-cache-v2
- name: Checkout v${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: microsoft/onnxruntime
submodules: true
ref: v${{ env.ONNXRUNTIME_VERSION }}
- name: Install dependencies on macos
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
brew install cmake
cmake --version
brew install tree
tree --version
- name: Download protoc
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
# see ./cmake/deps.txt
if [[ ${{ env.ONNXRUNTIME_VERSION }} =~ 1.14.[0-9] ]]; then
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protoc-3.20.3-osx-x86_64.zip
unzip protoc-3.20.3-osx-x86_64.zip
elif [[ ${{ env.ONNXRUNTIME_VERSION }} =~ 1.1[56789].[0-9] ]]; then
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-x86_64.zip
unzip protoc-21.12-osx-x86_64.zip
fi
rm -fv protoc*.zip
./bin/protoc --version
- name: Set environment variable
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH"
- name: Display protoc info for ${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
protoc --version
- name: Build onnxruntime ${{ env.ONNXRUNTIME_VERSION }} for arm64
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
build_dir=./build-ios/arm64
python3 ./tools/ci_build/build.py \
--build_dir $build_dir \
--config Release \
--update \
--build \
--use_xcode \
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF \
--cmake_extra_defines onnxruntime_BUILD_SHARED_LIB=OFF \
--cmake_extra_defines CMAKE_INSTALL_PREFIX=$build_dir/install/ \
--ios \
--apple_sysroot iphoneos \
--osx_arch arm64 \
--target install \
--parallel \
--skip_tests \
--build_apple_framework \
--apple_deploy_target '13.0' \
--use_coreml \
--path_to_protoc_exe $GITHUB_WORKSPACE/bin/protoc
- name: Copy results
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
version=${{ env.ONNXRUNTIME_VERSION }}
arch=arm64
ls -lh build-ios/$arch/Release/Release-iphoneos/onnxruntime.framework
file build-ios/$arch/Release/Release-iphoneos/onnxruntime.framework/onnxruntime
tree build-ios/$arch/Release/Release-iphoneos/onnxruntime.framework
ls -1 build-ios/$arch/Release/static_libraries
ls -lh build-ios/$arch/Release/static_libraries
echo "----------"
ls -1 build-ios/$arch/Release/Release-iphoneos
ls -lh build-ios/$arch/Release/Release-iphoneos
libtool -static -o build-ios/$arch/onnxruntime.a \
build-ios/$arch/Release/static_libraries/libabsl_base.a \
build-ios/$arch/Release/static_libraries/libabsl_city.a \
build-ios/$arch/Release/static_libraries/libabsl_hash.a \
build-ios/$arch/Release/static_libraries/libabsl_low_level_hash.a \
build-ios/$arch/Release/static_libraries/libabsl_raw_hash_set.a \
build-ios/$arch/Release/static_libraries/libabsl_raw_logging_internal.a \
build-ios/$arch/Release/static_libraries/libabsl_strings.a \
build-ios/$arch/Release/static_libraries/libabsl_synchronization.a \
build-ios/$arch/Release/static_libraries/libabsl_throw_delegate.a \
build-ios/$arch/Release/static_libraries/libabsl_time.a \
build-ios/$arch/Release/static_libraries/libclog.a \
build-ios/$arch/Release/static_libraries/libcpuinfo.a \
build-ios/$arch/Release/static_libraries/libflatbuffers.a \
build-ios/$arch/Release/static_libraries/libnsync_cpp.a \
build-ios/$arch/Release/static_libraries/libonnx.a \
build-ios/$arch/Release/static_libraries/libonnx_proto.a \
build-ios/$arch/Release/static_libraries/libprotobuf-lite.a \
build-ios/$arch/Release/static_libraries/libre2.a \
\
build-ios/$arch/Release/Release-iphoneos/libcoreml_proto.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_common.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_flatbuffers.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_framework.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_graph.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_mlas.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_optimizer.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_providers.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_providers_coreml.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_session.a \
build-ios/$arch/Release/Release-iphoneos/libonnxruntime_util.a
# from 1.17.3, libonnxruntime_coreml_proto.a is renamed to libcoreml_proto.a
dst=onnxruntime-ios-$arch-${{ env.ONNXRUNTIME_VERSION }}
mkdir -p $dst
cp -v build-ios/$arch/onnxruntime.a $dst
cp -v build-ios/arm64/Release/build-ios/arm64/install/bin/onnxruntime.framework/Headers/* $dst/
ls -lh $dst
- name: Upload artifact
# if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v2
with:
name: onnxruntime-ios-arm64-${{ env.ONNXRUNTIME_VERSION }}
path: onnxruntime-ios-arm64-${{ env.ONNXRUNTIME_VERSION }}
ios_simulator:
name: Simulator ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
arch: [arm64, x86_64]
steps:
- name: Cache build result for ${{ env.ONNXRUNTIME_VERSION }}
id: cache-build-result
uses: actions/cache@v2
with:
path: onnxruntime-ios-simulator-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}
key: onnxruntime-ios-simulator-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}-cache-v2
- name: Checkout v${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: microsoft/onnxruntime
submodules: true
ref: v${{ env.ONNXRUNTIME_VERSION }}
- name: Install dependencies on macos
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
brew install cmake
cmake --version
brew install tree
tree --version
- name: Download protoc
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
# see ./cmake/deps.txt
if [[ ${{ env.ONNXRUNTIME_VERSION }} =~ 1.14.[0-9] ]]; then
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protoc-3.20.3-osx-x86_64.zip
unzip protoc-3.20.3-osx-x86_64.zip
elif [[ ${{ env.ONNXRUNTIME_VERSION }} =~ 1.1[56789].[0-9] ]]; then
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-x86_64.zip
unzip protoc-21.12-osx-x86_64.zip
fi
./bin/protoc --version
- name: Set environment variable
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH"
- name: Display protoc info for ${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
protoc --version
- name: Build onnxruntime ${{ env.ONNXRUNTIME_VERSION }} for simulator ${{ matrix.arch }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
build_dir=./build-ios/simulator/${{ matrix.arch }}
python3 ./tools/ci_build/build.py \
--build_dir $build_dir \
--config Release \
--update \
--build \
--use_xcode \
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF \
--cmake_extra_defines onnxruntime_BUILD_SHARED_LIB=OFF \
--cmake_extra_defines CMAKE_INSTALL_PREFIX=$build_dir/install/ \
--ios \
--apple_sysroot iphonesimulator \
--osx_arch ${{ matrix.arch }} \
--target install \
--parallel \
--skip_tests \
--build_apple_framework \
--apple_deploy_target '13.0' \
--use_coreml \
--path_to_protoc_exe $GITHUB_WORKSPACE/bin/protoc
- name: Copy results
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
version=${{ env.ONNXRUNTIME_VERSION }}
arch=simulator/${{ matrix.arch }}
ls -1 build-ios/$arch/Release/static_libraries
ls -lh build-ios/$arch/Release/static_libraries
echo "----------"
ls -1 build-ios/$arch/Release/Release-iphonesimulator
ls -lh build-ios/$arch/Release/Release-iphonesimulator
libtool -static -o build-ios/$arch/onnxruntime.a \
build-ios/$arch/Release/static_libraries/libabsl_base.a \
build-ios/$arch/Release/static_libraries/libabsl_city.a \
build-ios/$arch/Release/static_libraries/libabsl_hash.a \
build-ios/$arch/Release/static_libraries/libabsl_low_level_hash.a \
build-ios/$arch/Release/static_libraries/libabsl_raw_hash_set.a \
build-ios/$arch/Release/static_libraries/libabsl_raw_logging_internal.a \
build-ios/$arch/Release/static_libraries/libabsl_strings.a \
build-ios/$arch/Release/static_libraries/libabsl_synchronization.a \
build-ios/$arch/Release/static_libraries/libabsl_throw_delegate.a \
build-ios/$arch/Release/static_libraries/libabsl_time.a \
build-ios/$arch/Release/static_libraries/libclog.a \
build-ios/$arch/Release/static_libraries/libcpuinfo.a \
build-ios/$arch/Release/static_libraries/libflatbuffers.a \
build-ios/$arch/Release/static_libraries/libnsync_cpp.a \
build-ios/$arch/Release/static_libraries/libonnx.a \
build-ios/$arch/Release/static_libraries/libonnx_proto.a \
build-ios/$arch/Release/static_libraries/libprotobuf-lite.a \
build-ios/$arch/Release/static_libraries/libre2.a \
\
build-ios/$arch/Release/Release-iphonesimulator/libcoreml_proto.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_common.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_flatbuffers.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_framework.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_graph.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_mlas.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_optimizer.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_providers.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_providers_coreml.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_session.a \
build-ios/$arch/Release/Release-iphonesimulator/libonnxruntime_util.a
dst=onnxruntime-ios-simulator-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}
mkdir -p $dst
cp build-ios/$arch/onnxruntime.a $dst
ls -lh $dst
- name: Upload artifact
# if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v2
with:
name: onnxruntime-ios-simulator-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}
path: onnxruntime-ios-simulator-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}
macOS:
name: macOS ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
arch: [arm64, x86_64]
steps:
- name: Cache build result for ${{ env.ONNXRUNTIME_VERSION }}
id: cache-build-result
uses: actions/cache@v2
with:
path: onnxruntime-macos-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}
key: onnxruntime-macos-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}-cache-v2
- name: Checkout v${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: microsoft/onnxruntime
submodules: true
ref: v${{ env.ONNXRUNTIME_VERSION }}
- name: Install dependencies on macos
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
brew install cmake
cmake --version
brew install tree
tree --version
- name: Download protoc
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
# see ./cmake/deps.txt
if [[ ${{ env.ONNXRUNTIME_VERSION }} =~ 1.14.[0-9] ]]; then
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protoc-3.20.3-osx-x86_64.zip
unzip protoc-3.20.3-osx-x86_64.zip
elif [[ ${{ env.ONNXRUNTIME_VERSION }} =~ 1.1[56789].[0-9] ]]; then
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-x86_64.zip
unzip protoc-21.12-osx-x86_64.zip
fi
./bin/protoc --version
- name: Set environment variable
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
echo "$GITHUB_WORKSPACE/bin" >> "$GITHUB_PATH"
- name: Display protoc info for ${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
protoc --version
- name: Build onnxruntime ${{ env.ONNXRUNTIME_VERSION }} for macOS ${{ matrix.arch }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
# For apple_sysroot, see
# /Applications/Xcode.app/Contents/Developer/Platforms
build_dir=./build-macos/${{ matrix.arch }}
python3 ./tools/ci_build/build.py \
--build_dir $build_dir \
--config Release \
--update \
--build \
--use_xcode \
--compile_no_warning_as_error \
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF \
--cmake_extra_defines onnxruntime_BUILD_SHARED_LIB=OFF \
--cmake_extra_defines CMAKE_INSTALL_PREFIX=$build_dir/install/ \
--apple_sysroot macosx \
--osx_arch ${{ matrix.arch }} \
--target install \
--parallel \
--skip_tests \
--build_apple_framework \
--apple_deploy_target '13.3' \
--use_coreml \
--path_to_protoc_exe $GITHUB_WORKSPACE/bin/protoc
- name: Copy results
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
version=${{ env.ONNXRUNTIME_VERSION }}
arch=${{ matrix.arch }}
ls -1 build-macos/$arch/Release/static_libraries
ls -lh build-macos/$arch/Release/static_libraries
echo "----------"
ls -1 build-macos/$arch/Release/Release
ls -lh build-macos/$arch/Release/Release
libtool -static -o build-macos/$arch/onnxruntime.a \
build-macos/$arch/Release/static_libraries/libabsl_base.a \
build-macos/$arch/Release/static_libraries/libabsl_city.a \
build-macos/$arch/Release/static_libraries/libabsl_hash.a \
build-macos/$arch/Release/static_libraries/libabsl_low_level_hash.a \
build-macos/$arch/Release/static_libraries/libabsl_raw_hash_set.a \
build-macos/$arch/Release/static_libraries/libabsl_raw_logging_internal.a \
build-macos/$arch/Release/static_libraries/libabsl_strings.a \
build-macos/$arch/Release/static_libraries/libabsl_synchronization.a \
build-macos/$arch/Release/static_libraries/libabsl_throw_delegate.a \
build-macos/$arch/Release/static_libraries/libabsl_time.a \
build-macos/$arch/Release/static_libraries/libclog.a \
build-macos/$arch/Release/static_libraries/libcpuinfo.a \
build-macos/$arch/Release/static_libraries/libflatbuffers.a \
build-macos/$arch/Release/static_libraries/libnsync_cpp.a \
build-macos/$arch/Release/static_libraries/libonnx.a \
build-macos/$arch/Release/static_libraries/libonnx_proto.a \
build-macos/$arch/Release/static_libraries/libprotobuf-lite.a \
build-macos/$arch/Release/static_libraries/libre2.a \
\
build-macos/$arch/Release/Release/libcoreml_proto.a \
build-macos/$arch/Release/Release/libonnxruntime_common.a \
build-macos/$arch/Release/Release/libonnxruntime_flatbuffers.a \
build-macos/$arch/Release/Release/libonnxruntime_framework.a \
build-macos/$arch/Release/Release/libonnxruntime_graph.a \
build-macos/$arch/Release/Release/libonnxruntime_mlas.a \
build-macos/$arch/Release/Release/libonnxruntime_optimizer.a \
build-macos/$arch/Release/Release/libonnxruntime_providers.a \
build-macos/$arch/Release/Release/libonnxruntime_providers_coreml.a \
build-macos/$arch/Release/Release/libonnxruntime_session.a \
build-macos/$arch/Release/Release/libonnxruntime_util.a
dst=onnxruntime-macos-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}
mkdir -p $dst
cp build-macos/$arch/onnxruntime.a $dst
ls -lh $dst
- name: Upload artifact
# if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v2
with:
name: onnxruntime-macos-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}
path: onnxruntime-macos-${{ matrix.arch }}-${{ env.ONNXRUNTIME_VERSION }}
create_xcframework:
name: Create xcframework
runs-on: macos-latest
needs: [ios_arm64, ios_simulator, macOS]
steps:
- name: Cache build result for ${{ env.ONNXRUNTIME_VERSION }}
id: cache-build-result
uses: actions/cache@v2
with:
path: onnxruntime.xcframework-${{ env.ONNXRUNTIME_VERSION }}.tar.bz2
key: onnxruntime.xcframework-${{ env.ONNXRUNTIME_VERSION }}-cache-v2
- name: Retrieve artifact for ios_arm64
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/download-artifact@v2
with:
name: onnxruntime-ios-arm64-${{ env.ONNXRUNTIME_VERSION }}
path: ./onnxruntime-ios-arm64/
- name: Retrieve artifact for simulator arm64
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/download-artifact@v2
with:
name: onnxruntime-ios-simulator-arm64-${{ env.ONNXRUNTIME_VERSION }}
path: ./onnxruntime-ios-simulator-arm64/
- name: Retrieve artifact for simulator x86_64
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/download-artifact@v2
with:
name: onnxruntime-ios-simulator-x86_64-${{ env.ONNXRUNTIME_VERSION }}
path: ./onnxruntime-ios-simulator-x86_64/
- name: Retrieve artifact for macOS arm64
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/download-artifact@v2
with:
name: onnxruntime-macos-arm64-${{ env.ONNXRUNTIME_VERSION }}
path: ./onnxruntime-macos-arm64/
- name: Retrieve artifact for macOS x86_64
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/download-artifact@v2
with:
name: onnxruntime-macos-x86_64-${{ env.ONNXRUNTIME_VERSION }}
path: ./onnxruntime-macos-x86_64/
- name: Install utilities
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
brew install tree
- name: Display artifact
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
ls -lh
ls -lh */
tree -L 2 .
- name: Create xcframework
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
mkdir ./simulator
lipo -create onnxruntime-ios-simulator-x86_64/onnxruntime.a \
onnxruntime-ios-simulator-arm64/onnxruntime.a \
-output ./simulator/onnxruntime.a
file ./simulator/onnxruntime.a
ls -lh ./simulator/onnxruntime.a
mkdir ./macos
lipo -create onnxruntime-macos-arm64/onnxruntime.a \
onnxruntime-macos-x86_64/onnxruntime.a \
-output ./macos/onnxruntime.a
file ./macos/onnxruntime.a
ls -lh ./macos/onnxruntime.a
xcodebuild -create-xcframework \
-library ./onnxruntime-ios-arm64/onnxruntime.a \
-library ./simulator/onnxruntime.a \
-library ./macos/onnxruntime.a \
-output onnxruntime.xcframework
mkdir -p onnxruntime.xcframework/Headers
cp -v onnxruntime-ios-arm64/*.h onnxruntime.xcframework/Headers
tree onnxruntime.xcframework
pushd onnxruntime.xcframework/ios-arm64
ln -s onnxruntime.a libonnxruntime.a
cd ../ios-arm64_x86_64-simulator
ln -s onnxruntime.a libonnxruntime.a
cd ../macos-arm64_x86_64
ln -s onnxruntime.a libonnxruntime.a
popd
tar cjvf onnxruntime.xcframework-${{ env.ONNXRUNTIME_VERSION }}.tar.bz2 ./onnxruntime.xcframework
ls -lh onnxruntime.xcframework-${{ env.ONNXRUNTIME_VERSION }}.tar.bz2
- name: Upload v${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
file: "./*.tar.bz2"
overwrite: true
tag: v${{ env.ONNXRUNTIME_VERSION }}
- name: Upload artifact
# if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v2
with:
name: onnxruntime.xcframework-${{ env.ONNXRUNTIME_VERSION }}
path: onnxruntime.xcframework
# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface (onnxruntime-libs)
if: github.repository_owner == 'csukuangfj' && steps.cache-build-result.outputs.cache-hit != 'true'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config --global user.email "csukuangfj@gmail.com"
git config --global user.name "Fangjun Kuang"
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/onnxruntime-libs huggingface
cd huggingface
git lfs pull
cp -v ../onnxruntime.xcframework-${{ env.ONNXRUNTIME_VERSION}}.tar.bz2 ./
git status
git lfs track "*.bz2"
git add .
git commit -m "upload onnxruntime.xcframework-${{ env.ONNXRUNTIME_VERSION}}.tar.bz2"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/onnxruntime-libs main
cd ..
rm -rf huggingface
# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface (ios-onnxruntime)
if: github.repository_owner == 'csukuangfj' && steps.cache-build-result.outputs.cache-hit != 'true'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git config --global user.email "csukuangfj@gmail.com"
git config --global user.name "Fangjun Kuang"
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/ios-onnxruntime huggingface
version=${{ env.ONNXRUNTIME_VERSION}}
cd huggingface
git lfs pull
rm -rfv $version
mkdir $version
mv -v ../onnxruntime.xcframework ${version}/
git status
git lfs track "*.a"
git add .
git commit -m "Add onnxruntime.xcframework $version"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/ios-onnxruntime main
cd ..
rm -rf huggingface