Skip to content
Merged
Changes from all 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
47 changes: 36 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@ 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:
Expand All @@ -17,17 +32,17 @@ jobs:
include:
- artifact_name: onnxruntime-linux-armhf
os: ubuntu-20.04
cc_version: '8'
cxx_version: '8'
cc_version: "8"
cxx_version: "8"
arch: arm-linux-gnueabihf
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_config: Release
- artifact_name: onnxruntime-linux-arm64
os: ubuntu-20.04
cc_version: '8'
cxx_version: '8'
cc_version: "8"
cxx_version: "8"
arch: aarch64-linux-gnu
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
Expand All @@ -50,7 +65,6 @@ jobs:
release_config: Release-iphonesimulator

env:
ONNXRUNTIME_VERSION: 1.14.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 != '' && '-') || '' }}"
Expand All @@ -59,6 +73,17 @@ 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:
Expand Down Expand Up @@ -90,7 +115,7 @@ jobs:
gcc-${{ matrix.cc_version }}${{ env.ARCH_SUFFIX }} \
g++-${{ matrix.cxx_version }}${{ env.ARCH_SUFFIX }} \
python3

# ONNX Runtime v1.14.1 requires CMake 3.24 or higher.
- name: Install CMake
if: steps.cache-build-result.outputs.cache-hit != 'true' && startsWith(matrix.os, 'ubuntu')
Expand All @@ -117,7 +142,7 @@ jobs:
# 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'
run: |
Expand Down Expand Up @@ -159,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