Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
04a8824
Separate libs and binaries from the whl file.
csukuangfj Aug 22, 2025
407d025
small fixes
csukuangfj Aug 22, 2025
6411c03
fix typos
csukuangfj Aug 22, 2025
ef2a036
add macos x64
csukuangfj Aug 22, 2025
8a79def
patch wheels for linux x64
csukuangfj Aug 22, 2025
9d4cb6c
fix macos
csukuangfj Aug 22, 2025
af8133e
fix rpath for macos
csukuangfj Aug 22, 2025
d03af4d
Fix for linux
csukuangfj Aug 22, 2025
18bca0a
Use pybind11 v3.0.0
csukuangfj Aug 22, 2025
a7200e8
Support numpy 2.0
csukuangfj Aug 22, 2025
6b46974
Support python 3.14
csukuangfj Aug 22, 2025
8441f9c
test wheels
csukuangfj Aug 22, 2025
b6981fa
small fixes
csukuangfj Aug 22, 2025
3b47c88
python 3.14 for macos x64
csukuangfj Aug 22, 2025
1cce034
minor fixes
csukuangfj Aug 22, 2025
f167342
more fixes
csukuangfj Aug 22, 2025
a105b67
Minor fixes
csukuangfj Aug 22, 2025
4d49d0f
small fixes
csukuangfj Aug 22, 2025
c4ebe26
macos universal2
csukuangfj Aug 22, 2025
755ff33
update readme
csukuangfj Aug 22, 2025
30c596e
small fixes
csukuangfj Aug 22, 2025
285f4e5
more fixes
csukuangfj Aug 22, 2025
5cd182c
fix typos
csukuangfj Aug 22, 2025
8853bde
more fixes
csukuangfj Aug 22, 2025
66b2206
fix errors
csukuangfj Aug 22, 2025
f5d9876
fix errors
csukuangfj Aug 22, 2025
ff25257
fix errors
csukuangfj Aug 22, 2025
670298c
small fixes
csukuangfj Aug 22, 2025
72aec57
small fixes
csukuangfj Aug 22, 2025
6169a60
small fixes
csukuangfj Aug 22, 2025
11c40be
small fixes
csukuangfj Aug 22, 2025
b60733c
fix linux
csukuangfj Aug 23, 2025
2fbce62
fix linux
csukuangfj Aug 23, 2025
ac7736a
Fix for Linux aarch64
csukuangfj Aug 23, 2025
f25f1a5
fix repair
csukuangfj Aug 23, 2025
06db43f
fix repair
csukuangfj Aug 23, 2025
3961d45
more fixes
csukuangfj Aug 23, 2025
d6ada46
for windows x64
csukuangfj Aug 23, 2025
054cf44
fix win x64
csukuangfj Aug 23, 2025
dd42fb4
minor fixes
csukuangfj Aug 23, 2025
3665f4c
use sscache
csukuangfj Aug 23, 2025
e9685ac
install python deps
csukuangfj Aug 23, 2025
0fe2945
install python deps
csukuangfj Aug 23, 2025
7fd9b0c
use windows-2022
csukuangfj Aug 23, 2025
796afb4
update setup.py for windows x64
csukuangfj Aug 23, 2025
48aba3c
fix windows
csukuangfj Aug 23, 2025
35f8d31
fix paths
csukuangfj Aug 23, 2025
abc5109
more fixes
csukuangfj Aug 23, 2025
711b972
for win32
csukuangfj Aug 23, 2025
886a1dc
for win32
csukuangfj Aug 23, 2025
7eb1e2f
for win32
csukuangfj Aug 23, 2025
6e8f1f4
for win32
csukuangfj Aug 23, 2025
9c9e4d3
fix instal dir
csukuangfj Aug 23, 2025
b6dc557
fix instal dir
csukuangfj Aug 23, 2025
ae35b06
remove onnxruntime.dll
csukuangfj Aug 23, 2025
7329878
fix scripts path
csukuangfj Aug 23, 2025
e614b7c
fix scripts path
csukuangfj Aug 23, 2025
6b203f3
fix scripts path
csukuangfj Aug 23, 2025
80026e6
test python 3.13 and 3.14
csukuangfj Aug 23, 2025
519a16a
fix typos
csukuangfj Aug 23, 2025
7e03054
fix typos
csukuangfj Aug 23, 2025
fd6e310
minor fixes
csukuangfj Aug 23, 2025
707faaa
fix errors
csukuangfj Aug 23, 2025
b72152b
fix windows
csukuangfj Aug 23, 2025
9101591
fix building c api
csukuangfj Aug 23, 2025
78a4421
test linux arm64
csukuangfj Aug 23, 2025
5197849
minor fixes
csukuangfj Aug 23, 2025
622f5a5
remove python 3.14 from windows
csukuangfj Aug 23, 2025
cd9cc0a
fix win32
csukuangfj Aug 23, 2025
7d150a2
fix windows
csukuangfj Aug 23, 2025
2fb378c
minor fixes
csukuangfj Aug 23, 2025
45cbf51
fix building
csukuangfj Aug 24, 2025
24a9f66
small fixes
csukuangfj Aug 24, 2025
4b63103
more fixes
csukuangfj Aug 24, 2025
8f4e99f
fix exporting piper
csukuangfj Aug 24, 2025
7d27e09
fix exporting piper
csukuangfj Aug 24, 2025
906ec9d
small fixes
csukuangfj Aug 24, 2025
6a1fd66
small fixes
csukuangfj Aug 24, 2025
b546f2d
fixes var
csukuangfj Aug 24, 2025
ae49ff9
Fix building on windows
csukuangfj Aug 24, 2025
6b7ee00
new release
csukuangfj Aug 24, 2025
9271cef
remove python 3.7 for win32
csukuangfj Aug 24, 2025
2ef9fba
Fix for windows
csukuangfj Aug 24, 2025
c63e82d
fix for win32
csukuangfj Aug 24, 2025
b850950
minor fixes
csukuangfj Aug 24, 2025
bead7c5
fix releasing go and dotnet packages
csukuangfj Aug 24, 2025
d244e9b
fix releasing dart packages
csukuangfj Aug 24, 2025
80eaef9
test pip install
csukuangfj Aug 24, 2025
6e5bcb9
test pip install
csukuangfj Aug 24, 2025
6b94505
test latest
csukuangfj Aug 24, 2025
5f8ad61
small fixes
csukuangfj Aug 24, 2025
1812745
small fixes
csukuangfj Aug 24, 2025
8c0ad83
Fix building wheels
csukuangfj Aug 24, 2025
7dd9778
fixes after review
csukuangfj Aug 24, 2025
489d9c6
fix typos
csukuangfj Aug 24, 2025
94a4b1c
fix for windows
csukuangfj Aug 24, 2025
1a2ce81
fix for windows
csukuangfj Aug 24, 2025
ee06e6b
minor fixes
csukuangfj Aug 24, 2025
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
331 changes: 310 additions & 21 deletions .github/workflows/build-wheels-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ on:
branches:
- wheel
workflow_dispatch:
inputs:
publish_sherpa_onnx_bin:
description: "Publish sherpa-onnx-bin"
required: false
default: "true"
type: boolean

env:
SHERPA_ONNX_IS_IN_GITHUB_ACTIONS: 1
Expand All @@ -14,16 +20,286 @@ concurrency:
cancel-in-progress: true

jobs:
core:
name: core
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04-arm]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Update version
shell: bash
run: |
./new-release.sh
git diff .

- name: Display PWD
shell: bash
run: |
echo "pwd: $PWD"
ls -lh
du -h -d1 .

- name: Build sherpa-onnx
uses: addnab/docker-run-action@v3
with:
image: quay.io/pypa/manylinux2014_aarch64
options: |
--volume ${{ github.workspace }}/:/home/runner/work/sherpa-onnx/sherpa-onnx
shell: bash
run: |
uname -a
gcc --version
cmake --version
cat /etc/*release
id
pwd

cd /home/runner/work/sherpa-onnx/sherpa-onnx

find /opt -name "python*"

echo "--------------------"
export PATH=/opt/_internal/cpython-3.10.18/bin:$PATH
which python3
python3 --version

python3 -m venv my

source ./my/bin/activate

python3 -m pip install setuptools wheel twine

git clone --depth 1 --branch v1.2.12 https://github.com/alsa-project/alsa-lib
pushd alsa-lib
./gitcompile
popd

export CPLUS_INCLUDE_PATH=$PWD/alsa-lib/include:$CPLUS_INCLUDE_PATH
export SHERPA_ONNX_ALSA_LIB_DIR=$PWD/alsa-lib/src/.libs

mkdir build
pushd build

cmake \
-D SHERPA_ONNX_ENABLE_TTS=ON \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS=ON \
-D SHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \
-D CMAKE_INSTALL_PREFIX=./install \
..

make -j2
make install

ls -lh lib
ls -lh bin

echo "----"
ls -lh install/lib

rm -fv install/lib/libcargs.so

echo "----"
ls -lh install/bin

echo 'sherpa-onnx-core'
mkdir -p ../scripts/wheel/sherpa-onnx-core/sherpa_onnx/lib
cp -v ./install/lib/lib*.so ../scripts/wheel/sherpa-onnx-core/sherpa_onnx/lib

mkdir -p ../scripts/wheel/sherpa-onnx-core/sherpa_onnx/include/sherpa-onnx/c-api
cp -v ./install/include/sherpa-onnx/c-api/*.h ../scripts/wheel/sherpa-onnx-core/sherpa_onnx/include/sherpa-onnx/c-api

pushd ../scripts/wheel/sherpa-onnx-core
python3 setup.py bdist_wheel --plat-name=manylinux2014_aarch64

ls -lh dist

popd

echo 'sherpa-onnx-bin'

mkdir -p ../scripts/wheel/sherpa-onnx-bin/bin
cp -v ./install/bin/sherpa-onnx* ../scripts/wheel/sherpa-onnx-bin/bin

pushd ../scripts/wheel/sherpa-onnx-bin
python3 setup.py bdist_wheel --plat-name=manylinux2014_aarch64

ls -lh dist

popd

- name: Collect wheels
shell: bash
run: |
sudo chown -R $USER ./scripts/wheel
mkdir wheelhouse
cp -v ./scripts/wheel/sherpa-onnx-core/dist/*.whl ./wheelhouse
cp -v ./scripts/wheel/sherpa-onnx-bin/dist/*.whl ./wheelhouse

- uses: actions/upload-artifact@v4
with:
name: wheels-core-linux-aarch64
path: ./wheelhouse/*.whl

- name: Show wheels
shell: bash
run: |
sudo chown -R $USER ./scripts/wheel
ls -lh ./scripts/wheel/sherpa-onnx-core/dist
ls -lh ./scripts/wheel/sherpa-onnx-bin/dist

unzip -l ./scripts/wheel/sherpa-onnx-core/dist/*.whl
echo "---"
unzip -l ./scripts/wheel/sherpa-onnx-bin/dist/*.whl

- name: Install patchelf
shell: bash
run: |
sudo apt-get update -q
sudo apt-get install -q -y patchelf
patchelf --help

- name: Patch wheels
shell: bash
run: |
mkdir ./wheels
sudo ./scripts/wheel/patch_wheel.py --in-dir ./wheelhouse --out-dir ./wheels

ls -lh ./wheels/
rm -rf ./wheelhouse
mv ./wheels ./wheelhouse

- uses: actions/upload-artifact@v4
with:
name: wheels-core-linux-aarch64-patched
path: ./wheelhouse/*.whl

test:
name: test
needs: [core]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04-arm]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Retrieve artifact from Linux x64
uses: actions/download-artifact@v4
with:
name: wheels-core-linux-aarch64-patched
path: /tmp/wheels

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Show
shell: bash
run: |
ls -lh /tmp/wheels

- name: Install
shell: bash
run: |
python3 -m pip install /tmp/wheels/*.whl

- name: Show version
shell: bash
run: |
sherpa-onnx-version

- name: Show help
shell: bash
run: |
sherpa-onnx --help

echo "---"

ls -lh $(which sherpa-onnx)
file $(which sherpa-onnx)
readelf -d $(which sherpa-onnx)

ldd $(which sherpa-onnx)

sherpa-onnx-offline --help

echo "---"

sherpa-onnx-vad --help

- name: Publish to huggingface
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "csukuangfj@gmail.com"
git config --global user.name "Fangjun Kuang"

rm -rf huggingface
export GIT_LFS_SKIP_SMUDGE=1
export GIT_CLONE_PROTECTION_ACTIVE=false

SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION"

d=cpu/$SHERPA_ONNX_VERSION

git clone https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels huggingface
cd huggingface
git fetch
git pull
git merge -m "merge remote" --ff origin main

mkdir -p $d

cp -v /tmp/wheels/*.whl $d/

git status
git add .
git commit -m "add more wheels"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main

- name: Publish wheels to PyPI ${{ github.event.inputs.publish_sherpa_onnx_bin }}
if: ${{ (github.event.inputs.publish_sherpa_onnx_bin || 'true') == 'true' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install wheel twine==5.0.0 setuptools

twine upload /tmp/wheels/*.whl


build_wheels_aarch64:
needs: [core, test]
name: ${{ matrix.manylinux }} ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# see https://github.com/pypa/cibuildwheel/issues/2257
# we don't use qemu from now on
os: [ubuntu-22.04-arm]
python-version: ["cp38", "cp39", "cp310", "cp311", "cp312", "cp313"]
os: [ubuntu-24.04-arm]
python-version: ["cp38", "cp39", "cp310", "cp311", "cp312", "cp313", "cp314"]
manylinux: [manylinux2014] #, manylinux_2_28]

steps:
Expand All @@ -38,7 +314,7 @@ jobs:
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.3
uses: pypa/cibuildwheel@v3.1.4
env:
CIBW_BEFORE_ALL: |
git clone --depth 1 --branch v1.2.12 https://github.com/alsa-project/alsa-lib
Expand All @@ -48,7 +324,15 @@ jobs:
echo "PWD"
ls -lh /project/alsa-lib/src/.libs

CIBW_ENVIRONMENT: CPLUS_INCLUDE_PATH=/project/alsa-lib/include:$CPLUS_INCLUDE_PATH SHERPA_ONNX_ALSA_LIB_DIR=/project/alsa-lib/src/.libs LD_LIBRARY_PATH=/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib:$SHERPA_ONNX_ALSA_LIB_DIR SHERPA_ONNX_MAKE_ARGS="VERBOSE=1" SHERPA_ONNX_ENABLE_ALSA=1
CIBW_ENVIRONMENT: >
SHERPA_ONNX_SPLIT_PYTHON_PACKAGE=ON
CPLUS_INCLUDE_PATH=/project/alsa-lib/include:$CPLUS_INCLUDE_PATH
SHERPA_ONNX_ALSA_LIB_DIR=/project/alsa-lib/src/.libs
LD_LIBRARY_PATH=/project/build/bdist.linux-aarch64/wheel/sherpa_onnx/lib:$SHERPA_ONNX_ALSA_LIB_DIR
SHERPA_ONNX_MAKE_ARGS="VERBOSE=1"
SHERPA_ONNX_ENABLE_ALSA=1
SHERPA_ONNX_CMAKE_ARGS="-DSHERPA_ONNX_ENABLE_BINARY=OFF -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF -DSHERPA_ONNX_ENABLE_C_API=OFF -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF"

CIBW_BUILD: "${{ matrix.python-version}}-* "
CIBW_SKIP: "cp27-* cp35-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 3
Expand All @@ -57,28 +341,38 @@ jobs:
CIBW_MANYLINUX_AARCH64_IMAGE: quay.io/pypa/${{ matrix.manylinux }}_aarch64
# From onnxruntime >= 1.17.0, it drops support for CentOS 7.0 and it supports only manylinux_2_28.
# manylinux_2_24 is no longer supported
CIBW_REPAIR_WHEEL_COMMAND: >
auditwheel repair -w {dest_dir}
--exclude libonnxruntime.so
{wheel}

- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.python-version }}-${{ matrix.manylinux }}-linux-aarch64
path: ./wheelhouse/*.whl

- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/

- name: Install patchelf
- name: Show wheels
shell: bash
run: |
sudo apt-get update -q
sudo apt-get install -q -y patchelf
patchelf --help
ls -lh wheelhouse/*.whl

- name: Patch wheels
shell: bash
run: |
mkdir ./wheels
sudo ./scripts/wheel/patch_wheel.py --in-dir ./wheelhouse --out-dir ./wheels
unzip -l wheelhouse/*.whl

ls -lh ./wheels/
rm -rf ./wheelhouse
mv ./wheels ./wheelhouse
echo "---"

mkdir t
cp wheelhouse/*.whl ./t
cd ./t
unzip ./*.whl
ls -lh
echo "---"

readelf -d sherpa_onnx/lib/*.so

- name: Publish to huggingface
env:
Expand Down Expand Up @@ -116,11 +410,6 @@ jobs:
git commit -m "add more wheels"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main

- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.python-version }}-${{ matrix.manylinux }}
path: ./wheelhouse/*.whl

- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
Loading