Skip to content

Release

Release #24

Workflow file for this run

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: aarch64
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 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Node modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
- 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 binutils-aarch64-linux-gnu
sudo rm /usr/bin/aarch64-linux-gnu-gcc /usr/bin/aarch64-linux-gnu-g++ || true
sudo ln -s /usr/bin/aarch64-linux-gnu-gcc-13 /usr/bin/aarch64-linux-gnu-gcc
sudo ln -s /usr/bin/aarch64-linux-gnu-g++-13 /usr/bin/aarch64-linux-gnu-g++
sudo rm /etc/apt/sources.list.d/temp-repository.list
sudo apt-get update
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- 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: Install python dependencies
run: |
python3 -m venv .venv
source .venv/bin/activate
./executorch/install_requirements.sh
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build --target ${{ matrix.target }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: bin-${{ matrix.plat }}-${{ matrix.arch }}
path: bin
npm-publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Node modules cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
- name: Download bundled files
uses: actions/download-artifact@v4
with:
path: bin
pattern: bin-*
merge-multiple: true
- name: Install dependencies
run: yarn install
- name: Publish to NPM
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}