Build All Targets #80
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| onnxruntime-version: | |
| type: string | |
| description: "ONNX Runtime version (e.g. 1.18.0)" | |
| required: true | |
| env: | |
| XCODE_VERSION: '14.3.1' | |
| MACOSX_DEPLOYMENT_TARGET: '13.4' | |
| IPHONEOS_DEPLOYMENT_TARGET: '15.1' # See: https://github.com/microsoft/onnxruntime/releases/tag/v1.21.0 | |
| ANDROID_API: '24' # See: https://github.com/microsoft/onnxruntime/releases/tag/v1.21.0 | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ${{ matrix.runs-on }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: aarch64-unknown-linux-gnu | |
| args: "-t -A aarch64 --xnnpack -N" | |
| static: true | |
| feature-set: train | |
| runs-on: ubuntu-24.04 | |
| - target: x86_64-unknown-linux-gnu | |
| args: "-t --xnnpack -N" | |
| static: true | |
| feature-set: train | |
| runs-on: ubuntu-24.04 | |
| - target: x86_64-unknown-linux-gnu | |
| args: "-t --cuda --trt -N" | |
| static: true | |
| feature-set: train,cu12 | |
| cuda-version: '12.8.1' | |
| runs-on: ubuntu-24.04 | |
| - target: aarch64-apple-darwin | |
| args: "-t --coreml -A aarch64 --xnnpack -N" | |
| static: true | |
| feature-set: train | |
| runs-on: macos-15 | |
| - target: x86_64-pc-windows-msvc | |
| args: "-t --directml --cuda --trt --xnnpack -N" | |
| static: true | |
| feature-set: train,cu12 | |
| cuda-version: '12.8.1' | |
| runs-on: windows-2022 | |
| - target: aarch64-pc-windows-msvc | |
| args: "-t -A aarch64 --directml" | |
| static: true | |
| feature-set: train | |
| runs-on: windows-2022 | |
| - target: x86_64-pc-windows-msvc | |
| args: "-t --directml --xnnpack" | |
| static: true | |
| feature-set: train | |
| runs-on: windows-2022 | |
| - target: aarch64-unknown-linux-gnu | |
| args: "-A aarch64 --xnnpack -N" | |
| static: true | |
| feature-set: none | |
| runs-on: ubuntu-24.04 | |
| - target: x86_64-unknown-linux-gnu | |
| args: "--xnnpack -N" | |
| static: true | |
| feature-set: none | |
| runs-on: ubuntu-24.04 | |
| - target: x86_64-unknown-linux-gnu | |
| args: "--cuda --trt -N" | |
| static: true | |
| feature-set: cu12 | |
| cuda-version: '12.8.1' | |
| runs-on: ubuntu-24.04 | |
| - target: x86_64-unknown-linux-gnu | |
| args: "--webgpu -N" | |
| static: true | |
| feature-set: wgpu | |
| runs-on: ubuntu-24.04 | |
| - target: aarch64-apple-darwin | |
| args: "--coreml -A aarch64 --xnnpack -N" | |
| static: true | |
| feature-set: none | |
| runs-on: macos-15 | |
| - target: x86_64-pc-windows-msvc | |
| args: "--directml --cuda --trt --xnnpack" | |
| static: true | |
| feature-set: cu12 | |
| cuda-version: '12.8.1' | |
| runs-on: windows-2022 | |
| - target: x86_64-pc-windows-msvc | |
| args: "--webgpu" | |
| static: true | |
| feature-set: wgpu | |
| runs-on: windows-2025 | |
| - target: aarch64-pc-windows-msvc | |
| args: "-A aarch64 --directml" | |
| static: true | |
| feature-set: none | |
| runs-on: windows-2022 | |
| - target: x86_64-pc-windows-msvc | |
| args: "--directml --xnnpack" | |
| static: true | |
| feature-set: none | |
| runs-on: windows-2022 | |
| - target: aarch64-apple-ios | |
| args: "-A aarch64 --iphoneos --xnnpack --coreml -N" | |
| static: true | |
| feature-set: none | |
| runs-on: macos-15 | |
| - target: aarch64-apple-ios-sim | |
| args: "-A aarch64 --iphonesimulator --xnnpack --coreml -N" | |
| static: true | |
| feature-set: none | |
| runs-on: macos-15 | |
| - target: aarch64-linux-android | |
| args: "-A aarch64 --android --xnnpack --nnapi -N" | |
| static: true | |
| feature-set: none | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Install cross-compile tools | |
| if: matrix.target == 'aarch64-unknown-linux-gnu' || matrix.target == 'aarch64-linux-android' | |
| run: | | |
| sudo apt update && sudo apt install -y gcc make gcc-14-aarch64-linux-gnu g++-14-aarch64-linux-gnu binutils-aarch64-linux-gnu | |
| - name: Remove unnecessary software | |
| if: runner.os == 'Linux' | |
| run: | | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| - name: Remove unnecessary software (non-Android) | |
| if: runner.os == 'Linux' && matrix.target != 'aarch64-linux-android' | |
| run: | | |
| sudo rm -rf /usr/local/lib/android | |
| - uses: actions/checkout@v4 | |
| - uses: seanmiddleditch/gha-setup-ninja@v6 | |
| - uses: Jimver/cuda-toolkit@v0.2.24 | |
| if: matrix.cuda-version && runner.os != 'macOS' | |
| with: | |
| cuda: ${{ matrix.cuda-version }} | |
| method: network | |
| use-github-cache: false | |
| # sub-packages: '["nvcc", "cudart", "cublas", "nvrtc"]' | |
| - uses: actions/setup-java@v4 | |
| if: matrix.target == 'aarch64-linux-android' | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - uses: nttld/setup-ndk@v1 | |
| id: setup-ndk | |
| if: matrix.target == 'aarch64-linux-android' | |
| with: | |
| add-to-path: false | |
| ndk-version: r28 | |
| - name: Pin cmake version | |
| if: ${{ matrix.target == 'aarch64-apple-darwin' || matrix.target == 'aarch64-apple-ios' || matrix.target == 'aarch64-apple-ios-sim' }} | |
| run: | | |
| brew uninstall cmake | |
| # Copied from https://github.com/actions/runner-images/pull/12791 | |
| # Pin cmake to 3.31.6 due to a backward compatibility issue | |
| # https://github.com/actions/runner-images/issues/11926 | |
| cmake_commit="b4e46db74e74a8c1650b38b1da222284ce1ec5ce" | |
| tap_name="local/pinned" | |
| echo "Creating local tap (no git)..." | |
| brew tap-new --no-git "$tap_name" >/dev/null | |
| cmake_formula_dir="$(brew --repo "$tap_name")/Formula" | |
| mkdir -p "$cmake_formula_dir" | |
| cmake_rb_link="https://raw.githubusercontent.com/Homebrew/homebrew-core/$cmake_commit/Formula/c/cmake.rb" | |
| cmake_rb_path="$cmake_formula_dir/cmake.rb" | |
| echo "Downloading cmake.rb from $cmake_rb_link" | |
| curl -fsSL "$cmake_rb_link" -o "$cmake_rb_path" | |
| echo "Installing cmake 3.31.6 from custom tap..." | |
| brew install "$tap_name/cmake" | |
| shell: bash | |
| - uses: denoland/setup-deno@v2 | |
| with: | |
| deno-version: v2.x | |
| - name: Run builder | |
| env: | |
| ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | |
| run: | |
| deno run -A src/build.ts -v ${{ inputs.onnxruntime-version }} ${{ matrix.static && '-s' || '' }} ${{ matrix.args }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ortrs_${{ matrix.static && 'static' || 'dylib' }}${{ matrix.feature-set != 'none' && format('_{0}', matrix.feature-set) || '' }}-v${{ inputs.onnxruntime-version }}-${{ matrix.target }} | |
| path: artifact | |
| if-no-files-found: error |