Release #9
This file contains 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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.repository.name }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
timeout-minutes: 120 | |
strategy: | |
matrix: | |
include: | |
# linux x86_64 | |
- plat: linux | |
arch: x86_64 | |
target: x86_64-unknown-linux-gnu | |
os: ubuntu-24.04 | |
# linux aarch64 | |
- plat: linux | |
arch: aarch64 | |
target: aarch64-unknown-linux-gnu | |
os: ubuntu-24.04 | |
# macos x86_64 | |
- plat: macos | |
arch: x86_64 | |
target: x86_64-apple-darwin | |
os: macos-14 | |
# macos aarch64 | |
- plat: macos | |
arch: arm64 | |
target: aarch64-apple-darwin | |
os: macos-14 | |
# windows x86_64 | |
- plat: windows | |
arch: x86_64 | |
target: x86_64-pc-windows-gnullvm | |
os: ubuntu-24.04 | |
# windows aarch64 | |
- plat: windows | |
arch: arm64 | |
target: aarch64-pc-windows-gnullvm | |
os: ubuntu-24.04 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Use Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
toolchain: nightly | |
target: ${{ matrix.target }} | |
- name: Use Node.js 22.x | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
- name: Use Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Cached pip | |
uses: actions/cache@v2 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-3_10 | |
- name: Download QNN SDK | |
if: ${{ matrix.plat == 'windows' }} | |
shell: bash | |
env: | |
QNN_VERSION: '2.26.0.240828' | |
run: | | |
curl -L -o qnn_sdk.zip https://softwarecenter.qualcomm.com/api/download/software/qualcomm_neural_processing_sdk/v${QNN_VERSION}.zip | |
unzip qnn_sdk.zip | |
rm qnn_sdk.zip | |
QNN_SDK_ROOT=$(realpath qairt/${QNN_VERSION}) | |
echo "QNN_SDK_ROOT=$QNN_SDK_ROOT" >> $GITHUB_ENV | |
- name: Install linux cross-compilation toolchain | |
if: ${{ matrix.plat == 'linux' && matrix.arch == 'aarch64' }} | |
run: | | |
echo "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/temp-repository.list | |
sudo apt-get update | |
sudo apt-get install -y gcc-13-aarch64-linux-gnu g++-13-aarch64-linux-gnu | |
sudo rm /etc/apt/sources.list.d/temp-repository.list | |
sudo apt-get update | |
- name: Install windows cross-compilation toolchain | |
if: ${{ matrix.plat == 'windows' }} | |
run: | | |
curl -L -o llvm-mingw.tar.xz https://github.com/mstorsjo/llvm-mingw/releases/download/20240917/llvm-mingw-20240917-msvcrt-ubuntu-20.04-x86_64.tar.xz | |
tar -xf llvm-mingw.tar.xz | |
rm llvm-mingw.tar.xz | |
MINGW_PATH=$(realpath llvm-mingw-*) | |
echo "PATH=$MINGW_PATH/bin:$PATH" >> $GITHUB_ENV | |
- name: Build executorch | |
shell: bash | |
env: | |
PLATFORM: ${{ matrix.plat }} | |
ARCH: ${{ matrix.arch }} | |
run: | | |
python -m venv .venv | |
source .venv/bin/activate | |
cd executorch | |
cd backends/xnnpack/third-party/cpuinfo/ | |
patch -p1 -i ${{ github.workspace }}/scripts/cpuinfo.patch | |
cd ${{ github.workspace }}/executorch | |
pip install tomli zstd setuptools wheel | |
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cpu | |
if [ ! -d cmake-out ]; then | |
./install_requirements.sh | |
EXTRA_CMAKE_ARGS="" | |
if [[ "$PLATFORM" == "windows" ]]; then | |
EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-w64-${ARCH}.clang.toolchain.cmake" | |
if [[ "$ARCH" == "aarch64" ]]; then | |
EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DEXECUTORCH_BUILD_QNN=ON" | |
fi | |
elif [[ "$PLATFORM" == "macos" ]]; then | |
if [[ "$ARCH" == "x86_64" ]]; then | |
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=x86_64" | |
else | |
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=arm64" | |
fi | |
EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DEXECUTORCH_BUILD_COREML=ON" | |
elif [[ "$PLATFORM" == "linux" ]] && [[ "$ARCH" == "aarch64" ]]; then | |
EXTRA_CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64-linux-gnu.gcc.toolchain.cmake" | |
fi | |
cmake \ | |
-S . \ | |
-B cmake-out \ | |
-DCMAKE_INSTALL_PREFIX=cmake-out \ | |
-DEXECUTORCH_BUILD_XNNPACK=ON \ | |
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \ | |
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \ | |
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \ | |
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED=ON \ | |
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \ | |
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \ | |
-DQNN_SDK_ROOT=$QNN_SDK_ROOT \ | |
-DEXECUTORCH_BUILD_CPUINFO=ON \ | |
-DEXECUTORCH_BUILD_XNNPACK=ON \ | |
-DEXECUTORCH_BUILD_PTHREADPOOL=ON \ | |
-DEXECUTORCH_BUILD_SDK=ON \ | |
$EXTRA_CMAKE_ARGS | |
cmake --build cmake-out --target install --config Release -j$(nproc) | |
fi | |
- name: Install dependencies | |
run: yarn install | |
- name: Build | |
shell: bash | |
env: | |
TARGET: ${{ matrix.target }} | |
run: yarn build --target $TARGET | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bin | |
path: bin |