Skip to content

aarch64-shared

aarch64-shared #12

Workflow file for this run

name: aarch64-shared
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:
aarch64-shared:
name: ${{ matrix.config }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [aarch64]
# config: ['Debug', 'MinSizeRel', 'Release', 'RelWithDebInfo']
config: ['MinSizeRel', 'Release']
# config: ['Release']
steps:
- name: Cache build result for ${{ env.ONNXRUNTIME_VERSION }}
id: cache-build-result
uses: actions/cache@v2
with:
path: onnxruntime-linux-${{ matrix.arch }}-glibc2_17-${{ matrix.config }}-${{ env.ONNXRUNTIME_VERSION }}
key: onnxruntime-linux-${{ matrix.arch }}-glibc2_17-${{ matrix.config }}-${{ env.ONNXRUNTIME_VERSION }}-cache-v1
- name: Set up QEMU
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: docker/setup-qemu-action@v2
with:
platforms: all
- name: Checkout v${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: microsoft/onnxruntime
submodules: true
ref: v${{ env.ONNXRUNTIME_VERSION }}
- name: patch
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
sed -i.bak '/SOVERSION/d' ./cmake/onnxruntime.cmake
sed -i.bak '/onnxruntime PROPERTIES VERSION/d' ./cmake/onnxruntime.cmake
git diff
sudo apt-get install -y patchelf
- name: Build onnxruntime ${{ env.ONNXRUNTIME_VERSION }}
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: addnab/docker-run-action@v3
with:
image: quay.io/pypa/manylinux2014_aarch64
options: |
--volume ${{ github.workspace }}/:/shared
shell: bash
run: |
echo "config: ${{ matrix.config }}"
uname -a
which gcc
gcc --version
which python
find /opt -name "python*"
echo "--------------------"
export PATH=/opt/_internal/cpython-3.8.19/bin:$PATH
which python3
python3 --version
python3 -m pip install ninja
cd /shared
ls -lh
touch /shared/a.txt
mkdir build-shared
version=${{ env.ONNXRUNTIME_VERSION }}
which python
# v=$(cat ./VERSION_NUMBER)
# if [[ $v == "1.18.0" ]]; then
# echo $version > ./VERSION_NUMBER
# sed -i.bak s/1.18.0/$version/g ./onnxruntime/core/session/onnxruntime_c_api.cc
# fi
# echo "---$version---"
# cat ./VERSION_NUMBER
# echo "---"
which python
build_dir=/shared/build-shared
python3 tools/ci_build/build.py \
--cmake_extra_defines onnxruntime_BUILD_UNIT_TESTS=OFF \
--build_dir $build_dir \
--cmake_generator 'Ninja' \
--config ${{ matrix.config }} \
--update \
--build \
--parallel \
--skip_tests \
--compile_no_warning_as_error \
--build_shared_lib \
--skip_submodule_sync \
--enable_lto \
--allow_running_as_root
chmod a=rwx build-shared
ls -lh build-shared
ls -lh build-shared/*
- name: Collect results
if: steps.cache-build-result.outputs.cache-hit != 'true'
shell: bash
run: |
build_dir=./build-shared
sudo chown -R runner $build_dir
ls -lh $build_dir
version=${{ env.ONNXRUNTIME_VERSION }}
config=${{ matrix.config }}
artifact=onnxruntime-linux-${{ matrix.arch }}-glibc2_17-$config-$version
tag=$(git rev-parse HEAD)
echo "tag: $tag"
./tools/ci_build/github/linux/copy_strip_binary.sh \
-r $build_dir \
-a $artifact \
-c $config \
-l libonnxruntime.so \
-s $PWD/ \
-t "$(git rev-parse HEAD)"
mv $build_dir/$artifact ./
tree ./$artifact
# ldd ./$artifact/lib/libonnxruntime.so
readelf -d ./$artifact/lib/libonnxruntime.so
patchelf --set-soname libonnxruntime.so ./$artifact/lib/libonnxruntime.so
# ldd ./$artifact/lib/libonnxruntime.so
readelf -d ./$artifact/lib/libonnxruntime.so
zip -r ${artifact}.zip ./$artifact
- name: Upload artifact
if: steps.cache-build-result.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: onnxruntime-linux-${{ matrix.arch }}-glibc2_17-${{ matrix.config }}-${{ env.ONNXRUNTIME_VERSION }}
path: onnxruntime-linux-${{ matrix.arch }}-glibc2_17-${{ matrix.config }}-${{ env.ONNXRUNTIME_VERSION }}
- 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: "./*.zip"
overwrite: true
tag: v${{ env.ONNXRUNTIME_VERSION }}
# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface
if: github.repository_owner == 'csukuangfj' && steps.cache-build-result.outputs.cache-hit != 'true'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
ls -lh
version=${{ env.ONNXRUNTIME_VERSION }}
config=${{ matrix.config }}
artifact=onnxruntime-linux-${{ matrix.arch }}-glibc2_17-$config-$version
tree ./$artifact
git config --global user.email "[email protected]"
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-linux*.zip ./
git status
git lfs track "*.zip"
git add .
git commit -m "upload $artifact"
git push https://csukuangfj:[email protected]/csukuangfj/onnxruntime-libs main