Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CI tests #1061

Merged
merged 10 commits into from
Jun 27, 2024
Merged
Show file tree
Hide file tree
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
56 changes: 16 additions & 40 deletions .github/workflows/build-wheels-win64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,27 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest]
python-version: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]
os: [windows-2019]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4

# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.5
env:
CIBW_BUILD: "${{ matrix.python-version}}-* "
CIBW_SKIP: "cp27-* cp35-* *-win32 pp* *-musllinux*"
CIBW_BUILD_VERBOSITY: 3
shell: bash
run: |
pip install setuptools wheel

python3 setup.py bdist_wheel

ls -lh ./dist/

mv dist wheelhouse

- name: Display wheels
shell: bash
Expand All @@ -48,7 +55,6 @@ jobs:
path: ./wheelhouse/*.whl

- name: Publish to huggingface
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v3
Expand Down Expand Up @@ -77,36 +83,6 @@ jobs:
git commit -m "add more wheels"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main

- name: Publish to huggingface
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
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

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

cp -v ../wheelhouse/*.whl .

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
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
130 changes: 130 additions & 0 deletions .github/workflows/dot-net.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,103 @@ permissions:
contents: read

jobs:
build-libs:
name: ${{ matrix.os }} ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2019]
arch: [x64, x86, arm64]

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

- name: Build sherpa-onnx
shell: bash
run: |
arch=${{ matrix.arch }}
opts=""
if [ $arch == x86 ]; then
opts="-A Win32"
elif [ $arch == arm64 ]; then
opts="-A ARM64"
fi

mkdir build
cd build
cmake \
$opts \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_INSTALL_PREFIX=./install \
-DCMAKE_BUILD_TYPE=Release \
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
-DBUILD_ESPEAK_NG_EXE=OFF \
-DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \
-DSHERPA_ONNX_ENABLE_BINARY=ON \
..

cmake --build . --target install --config Release
rm -rf install/pkgconfig

- uses: actions/upload-artifact@v4
with:
name: windows-${{ matrix.arch }}
path: ./build/install/lib/

- name: Create tar file
shell: bash
run: |
arch=${{ matrix.arch }}

cd build

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

dst=sherpa-onnx-$SHERPA_ONNX_VERSION-win-$arch
mv install/lib $dst
tar cjvf $dst.tar.bz2 $dst
ls -lh *.tar.bz2
mv *.tar.bz2 ../

# https://huggingface.co/docs/hub/spaces-github-actions
- name: Publish to huggingface
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
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_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface

cd huggingface
mkdir -p windows-for-dotnet

cp -v ../sherpa-onnx-*.tar.bz2 ./windows-for-dotnet

git status
git lfs track "*.bz2"

git add .

git commit -m "add more files"

git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
rm -rf huggingface

release-nuget-package:
runs-on: ${{ matrix.os }}
needs: [build-libs]
strategy:
fail-fast: false
matrix:
Expand All @@ -30,9 +125,44 @@ jobs:
6.0.x
7.0.x

- name: Install Python dependencies
shell: bash
run: |
python3 -m pip install --upgrade pip Jinja2

- name: Retrieve artifact from windows x64
uses: actions/download-artifact@v4
with:
name: windows-x64
path: /tmp/windows-x64

- name: Retrieve artifact from windows x86
uses: actions/download-artifact@v4
with:
name: windows-x86
path: /tmp/windows-x86

- name: Retrieve artifact from windows arm64
uses: actions/download-artifact@v4
with:
name: windows-arm64
path: /tmp/windows-arm64

- name: Check dotnet
run: dotnet --info

- name: Build
shell: bash
run: |
sudo apt-get install -y tree
ls -lh /tmp/

tree /tmp/windows*
echo "----"

rm -v /tmp/windows*/*.lib
tree /tmp/windows*

- name: Build
shell: bash
run: |
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run-python-test-macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ jobs:
- os: macos-11
python-version: "3.7"

- os: macos-12
- os: macos-13
python-version: "3.8"

- os: macos-13
python-version: "3.9"
- os: macos-13
- os: macos-14
python-version: "3.10"
- os: macos-13
- os: macos-14
python-version: "3.11"

- os: macos-14
- os: macos-latest
python-version: "3.12"

steps:
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --version

python3 -m pip install --verbose .
python3 setup.py install

- name: Test sherpa-onnx
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --version

python3 -m pip install --no-deps --verbose .
python3 setup.py install
python3 -m pip install websockets

- name: Start server for transducer models
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-python-online-websocket-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --version

python3 -m pip install --no-deps --verbose .
python3 setup.py install
python3 -m pip install websockets

- name: Start server for zipformer2 CTC models
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/windows-x64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,16 @@ jobs:
shell: bash
run: |
cd build
cmake --build . --config Release -- -m:2
cmake --build . --config Release -- -m:2
cmake --build . --config Release --target install -- -m:2

ls -lh ./bin/Release/sherpa-onnx.exe

- uses: actions/upload-artifact@v4
with:
name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
path: build/install/*

- name: Test offline punctuation
shell: bash
run: |
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/windows-x86.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ jobs:

ls -lh ./bin/Release/sherpa-onnx.exe

- uses: actions/upload-artifact@v4
with:
name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
path: build/install/*

- name: Test offline punctuation
shell: bash
run: |
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(sherpa-onnx)
# ./nodejs-addon-examples
# ./dart-api-examples/
# ./sherpa-onnx/flutter/CHANGELOG.md
set(SHERPA_ONNX_VERSION "1.10.2")
set(SHERPA_ONNX_VERSION "1.10.5")

# Disable warning about
#
Expand Down Expand Up @@ -37,6 +37,7 @@ option(SHERPA_ONNX_ENABLE_TTS "Whether to build TTS related code" ON)
option(SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY "True to link libstdc++ statically. Used only when BUILD_SHARED_LIBS is OFF on Linux" ON)
option(SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE "True to use pre-installed onnxruntime if available" ON)
option(SHERPA_ONNX_ENABLE_SANITIZER "Whether to enable ubsan and asan" OFF)
option(SHERPA_ONNX_BUILD_C_API_EXAMPLES "Whether to enable C API examples" ON)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
Expand Down Expand Up @@ -127,6 +128,7 @@ message(STATUS "SHERPA_ONNX_ENABLE_TTS ${SHERPA_ONNX_ENABLE_TTS}")
message(STATUS "SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY ${SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY}")
message(STATUS "SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE ${SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE}")
message(STATUS "SHERPA_ONNX_ENABLE_SANITIZER: ${SHERPA_ONNX_ENABLE_SANITIZER}")
message(STATUS "SHERPA_ONNX_BUILD_C_API_EXAMPLES: ${SHERPA_ONNX_BUILD_C_API_EXAMPLES}")

if(SHERPA_ONNX_ENABLE_TTS)
message(STATUS "TTS is enabled")
Expand Down Expand Up @@ -302,7 +304,7 @@ endif()

add_subdirectory(sherpa-onnx)

if(SHERPA_ONNX_ENABLE_C_API AND SHERPA_ONNX_ENABLE_BINARY)
if(SHERPA_ONNX_ENABLE_C_API AND SHERPA_ONNX_ENABLE_BINARY AND SHERPA_ONNX_BUILD_C_API_EXAMPLES)
set(SHERPA_ONNX_PKG_WITH_CARGS "-lcargs")
add_subdirectory(c-api-examples)
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/cmake_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def build_extension(self, ext: setuptools.extension.Extension):
extra_cmake_args += " -DBUILD_ESPEAK_NG_EXE=OFF "
extra_cmake_args += " -DBUILD_ESPEAK_NG_TESTS=OFF "

extra_cmake_args += " -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF "
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_CHECK=OFF "
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PYTHON=ON "
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PORTAUDIO=ON "
Expand Down
2 changes: 1 addition & 1 deletion nodejs-addon-examples/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dependencies": {
"sherpa-onnx-node": "^1.10.2"
"sherpa-onnx-node": "^1.10.3"
}
}
1 change: 1 addition & 0 deletions scripts/dotnet/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def main():
process_linux(s)
process_windows(s, "x64")
process_windows(s, "x86")
process_windows(s, "arm64")

s = read_proj_file("./sherpa-onnx.csproj.in")
d = get_dict()
Expand Down
Loading
Loading