Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: VOICEVOX/onnxruntime-builder
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.13.1
Choose a base ref
...
head repository: VOICEVOX/onnxruntime-builder
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.14.0
Choose a head ref
  • 7 commits
  • 2 files changed
  • 3 contributors

Commits on Mar 19, 2023

  1. ubuntu-18.04 ubuntu-20.04 (#8)

    qryxip authored Mar 19, 2023

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6a9d308 View commit details

Commits on Mar 27, 2023

  1. Copy the full SHA
    a931b6f View commit details

Commits on Mar 28, 2023

  1. Copy the full SHA
    cff8b8a View commit details
  2. Copy the full SHA
    7d1a14f View commit details

Commits on Apr 9, 2023

  1. Copy the full SHA
    5d697ef View commit details

Commits on Apr 10, 2023

  1. Copy the full SHA
    b1049ed View commit details
  2. Copy the full SHA
    f302390 View commit details
Showing with 105 additions and 67 deletions.
  1. +97 −67 .github/workflows/build.yml
  2. +8 −0 README.md
164 changes: 97 additions & 67 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -8,32 +8,63 @@ on:
types:
- published
workflow_dispatch:
inputs:
version:
description: "バージョン情報(A.BB.C / A.BB.C-preview.D)"
required: true
release:
description: "リリースするかどうか"
type: boolean

env:
ONNXRUNTIME_VERSION:
|- # releaseタグ名か、workflow_dispatchでのバージョン名が入る。無指定なら適当なバージョン
${{ github.event.release.tag_name || github.event.inputs.version || '1.14.0' }}
RELEASE:
|- # releaseタグ名か、workflow_dispatchでのreleaseフラグがあればリリースする
${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }}

jobs:
build-onnxruntime:
strategy:
fail-fast: false
matrix:
include:
- artifact_name: onnxruntime-linux-armhf-cpu
os: ubuntu-18.04
cc_version: '8'
cxx_version: '8'
- artifact_name: onnxruntime-linux-armhf
os: ubuntu-20.04
cc_version: "8"
cxx_version: "8"
arch: arm-linux-gnueabihf
ld_symlink_name: ld-linux-armhf.so.3
symlink_workaround: true
build_opts: --arm --cmake_extra_defines CMAKE_SYSTEM_NAME=Linux CMAKE_SYSTEM_PROCESSOR=armv7l --config Release --parallel --update --build --build_shared_lib
result_dir: build/Linux/Release
- artifact_name: onnxruntime-linux-arm64-cpu
os: ubuntu-18.04
cc_version: '8'
cxx_version: '8'
result_dir: build/Linux
release_config: Release
- artifact_name: onnxruntime-linux-arm64
os: ubuntu-20.04
cc_version: "8"
cxx_version: "8"
arch: aarch64-linux-gnu
ld_symlink_name: ld-linux-aarch64.so.1
symlink_workaround: true
build_opts: --arm64 --cmake_extra_defines CMAKE_SYSTEM_NAME=Linux CMAKE_SYSTEM_PROCESSOR=aarch64 --config Release --parallel --update --build --build_shared_lib
result_dir: build/Linux/Release
result_dir: build/Linux
release_config: Release
- artifact_name: onnxruntime-ios-arm64
os: macos-12
build_opts: --config Release --parallel --update --build --build_shared_lib --skip_tests --use_xcode --ios --ios_sysroot iphoneos --osx_arch arm64 --apple_deploy_target 16.0
result_dir: build/iOS/Release
release_config: Release-iphoneos
- artifact_name: onnxruntime-ios-sim-arm64
os: macos-12
build_opts: --config Release --parallel --update --build --build_shared_lib --skip_tests --use_xcode --ios --ios_sysroot iphonesimulator --osx_arch arm64 --apple_deploy_target 16.0
result_dir: build/iOS/Release
release_config: Release-iphonesimulator
- artifact_name: onnxruntime-ios-sim-x86_64
os: macos-12
build_opts: --config Release --parallel --update --build --build_shared_lib --skip_tests --use_xcode --ios --ios_sysroot iphonesimulator --osx_arch x86_64 --apple_deploy_target 16.0
result_dir: build/iOS/Release
release_config: Release-iphonesimulator

env:
ONNXRUNTIME_VERSION: v1.13.1
# prefix usage: "", "arm-linux-gnueabihf-" => "gcc-8", "arm-linux-gnueabihf-gcc-8" (command name)
# suffix usage: "", "-arm-linux-gnueabihf" => "gcc-8", "gcc-8-arm-linux-gnueabihf" (package name)
ARCH_PREFIX: "${{ (matrix.arch != '' && matrix.arch) || '' }}${{ (matrix.arch != '' && '-') || '' }}"
@@ -42,12 +73,23 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Version check (semver)
shell: bash
run: |
VERSION="${{ env.ONNXRUNTIME_VERSION }}"
if [[ $VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$ ]]; then
echo "Version: $VERSION"
else
echo "$VERSION is not a valid semver."
exit 1
fi
- name: Checkout
uses: actions/checkout@v2
with:
repository: microsoft/onnxruntime
submodules: true
ref: ${{ env.ONNXRUNTIME_VERSION }}
ref: v${{ env.ONNXRUNTIME_VERSION }}

- name: Dump matrix context
env:
@@ -59,10 +101,10 @@ jobs:
uses: actions/cache@v2
with:
path: build/
key: ${{ matrix.artifact_name }}-${{ env.ONNXRUNTIME_VERSION }}-cache-v1-${{ hashFiles('matrix.json') }}
key: ${{ matrix.artifact_name }}-v${{ env.ONNXRUNTIME_VERSION }}-cache-v1-${{ hashFiles('matrix.json') }}

- name: Install build dependencies
if: steps.cache-build-result.outputs.cache-hit != 'true'
if: steps.cache-build-result.outputs.cache-hit != 'true' && startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y \
@@ -73,78 +115,66 @@ jobs:
gcc-${{ matrix.cc_version }}${{ env.ARCH_SUFFIX }} \
g++-${{ matrix.cxx_version }}${{ env.ARCH_SUFFIX }} \
python3
# ONNX Runtime v1.9.0 requires CMake 3.18 or higher.
# ONNX Runtime v1.14.1 requires CMake 3.24 or higher.
- name: Install CMake
if: steps.cache-build-result.outputs.cache-hit != 'true'
if: steps.cache-build-result.outputs.cache-hit != 'true' && startsWith(matrix.os, 'ubuntu')
env:
CMAKE_VERSION: 3.22.0-rc2
CMAKE_VERSION: 3.24.4
run: |
wget -O cmake.sh "https://github.com/Kitware/CMake/releases/download/v${{ env.CMAKE_VERSION }}/cmake-${{ env.CMAKE_VERSION }}-linux-x86_64.sh"
sudo bash cmake.sh --skip-license --prefix=/usr/local
- name: Configure build environment
if: steps.cache-build-result.outputs.cache-hit != 'true'
if: steps.cache-build-result.outputs.cache-hit != 'true' && startsWith(matrix.os, 'ubuntu')
run: |
# Required for arm build
# https://github.com/microsoft/onnxruntime/issues/4189#issuecomment-642528278
echo 'string(APPEND CMAKE_C_FLAGS " -latomic")' >> cmake/CMakeLists.txt
echo 'string(APPEND CMAKE_CXX_FLAGS " -latomic")' >> cmake/CMakeLists.txt
# Prevent Exec Format Error during cross-compiling
if [ -n "${{ matrix.ld_symlink_name }}" ]; then
sudo ln -s /usr/${{ matrix.arch }}/lib /lib/${{ matrix.arch }}
sudo ln -s /lib/${{ matrix.arch }}/ld-*.so /lib/${{ matrix.ld_symlink_name }}
if ${{ matrix.symlink_workaround }}; then
find /usr/${{ matrix.arch }}/lib -name '*.so*' -exec sudo ln -s {} /usr/lib/${{ matrix.arch }}/ ';'
sudo ln -s /usr/${{ matrix.arch }}/lib/ld-linux-*.so* /usr/lib/
fi
# Set environment variable CC / CXX
echo "CC=${{ env.ARCH_PREFIX }}gcc-${{ matrix.cc_version }}" >> "$GITHUB_ENV"
echo "CXX=${{ env.ARCH_PREFIX }}g++-${{ matrix.cxx_version }}" >> "$GITHUB_ENV"
- name: Build ONNX Runtime
if: steps.cache-build-result.outputs.cache-hit != 'true'
env:
CC: ${{ env.ARCH_PREFIX }}gcc-${{ matrix.cc_version }}
CXX: ${{ env.ARCH_PREFIX }}g++-${{ matrix.cxx_version }}
run: |
# add --arm for gcc-8: https://github.com/microsoft/onnxruntime/issues/4189
# skip test: https://github.com/microsoft/onnxruntime/issues/2436
# ONNX Runtime v1.9.0 requires CMAKE_SYSTEM_PROCESSOR, https://github.com/microsoft/onnxruntime/releases/tag/v1.9.0
# Both CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_PROCESSOR are required.
bash ./build.sh ${{ matrix.build_opts }}
- name: Organize artifact
shell: bash
run: |
mkdir artifact
# copy shared lib
mkdir artifact/lib
NAME=$(basename ${{ matrix.result_dir }}/libonnxruntime.so.*)
cp "${{ matrix.result_dir }}/${NAME}" artifact/lib/
ln -s "${NAME}" artifact/lib/libonnxruntime.so
# copy header files
mkdir artifact/include
readarray -t HEADERS <<EOF
onnxruntime/core/session/onnxruntime_c_api.h
onnxruntime/core/session/onnxruntime_cxx_api.h
onnxruntime/core/session/onnxruntime_cxx_inline.h
onnxruntime/core/providers/cpu/cpu_provider_factory.h
onnxruntime/core/session/onnxruntime_session_options_config_keys.h
onnxruntime/core/session/onnxruntime_run_options_config_keys.h
onnxruntime/core/framework/provider_options.h
EOF
for path in "${HEADERS[@]}"; do
cp "include/${path}" ./artifact/include/
done
# copy docs & license
cp VERSION_NUMBER ./artifact/
cp LICENSE ./artifact/
cp ThirdPartyNotices.txt ./artifact/
cp docs/Privacy.md ./artifact/
cp README.md ./artifact/
echo "$(git rev-parse HEAD)" >> ./artifact/GIT_COMMIT_ID
# コピー先artifactを予め削除しておく
rm -rf ${{ matrix.result_dir }}/${{ matrix.artifact_name }}
rm -rf ./artifact
# Set library name
if [[ ${{ matrix.artifact_name }} == onnxruntime-linux-* ]]; then
ONNXRUNTIME_NAME=libonnxruntime.so.${{ env.ONNXRUNTIME_VERSION }}
elif [[ ${{ matrix.artifact_name }} == onnxruntime-ios-* ]]; then
ONNXRUNTIME_NAME=libonnxruntime.${{ env.ONNXRUNTIME_VERSION }}.dylib
else
echo "Unknown target found : ${{ matrix.artifact_name }}"
return 1
fi
./tools/ci_build/github/linux/copy_strip_binary.sh \
-r ${{ matrix.result_dir }} \
-a ${{ matrix.artifact_name }} \
-l $ONNXRUNTIME_NAME \
-c ${{ matrix.release_config }} \
-s "$(pwd)" \
-t "$(git rev-parse HEAD)"
mv ${{ matrix.result_dir }}/${{ matrix.artifact_name }} ./artifact/
- name: Upload artifact
uses: actions/upload-artifact@v2
@@ -154,20 +184,20 @@ jobs:
retention-days: 14

- name: Generate RELEASE_NAME
if: github.event.release.tag_name != '' # If release
if: env.RELEASE == 'true'
run: |
echo "RELEASE_NAME=${{ matrix.artifact_name }}-${{ env.ONNXRUNTIME_VERSION }}" >> $GITHUB_ENV
- name: Rearchive artifact
if: github.event.release.tag_name != '' # If release
if: env.RELEASE == 'true'
run: |
mv artifact/ "${{ env.RELEASE_NAME }}"
tar cfz "${{ env.RELEASE_NAME }}.tgz" "${{ env.RELEASE_NAME }}/"
- name: Upload to Release
if: github.event.release.tag_name != '' # If release
if: env.RELEASE == 'true'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }} # ==> github.event.release.tag_name
tag: ${{ env.ONNXRUNTIME_VERSION }} # ==> github.event.release.tag_name
file: ${{ env.RELEASE_NAME }}.tgz
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# onnxruntime-builder
VOICEVOX COREで利用するonnxruntimeのビルドを行うリポジトリ

## ビルド

Github Actions から workflow_dispatch を起動。

## リリース

Releases からタグを指定して Publish releases 。