Skip to content

Commit 441affe

Browse files
authored
Fix CI tests (k2-fsa#1061)
1 parent 9dfe88d commit 441affe

14 files changed

+214
-64
lines changed

.github/workflows/build-wheels-win64.yaml

+16-40
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,27 @@ jobs:
2222
strategy:
2323
fail-fast: false
2424
matrix:
25-
os: [windows-latest]
26-
python-version: ["cp37", "cp38", "cp39", "cp310", "cp311", "cp312"]
25+
os: [windows-2019]
26+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
2727

2828
steps:
2929
- uses: actions/checkout@v4
3030

31-
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
32-
# for a list of versions
31+
- name: Setup Python ${{ matrix.python-version }}
32+
uses: actions/setup-python@v5
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
3336
- name: Build wheels
34-
uses: pypa/cibuildwheel@v2.16.5
35-
env:
36-
CIBW_BUILD: "${{ matrix.python-version}}-* "
37-
CIBW_SKIP: "cp27-* cp35-* *-win32 pp* *-musllinux*"
38-
CIBW_BUILD_VERBOSITY: 3
37+
shell: bash
38+
run: |
39+
pip install setuptools wheel
40+
41+
python3 setup.py bdist_wheel
42+
43+
ls -lh ./dist/
44+
45+
mv dist wheelhouse
3946
4047
- name: Display wheels
4148
shell: bash
@@ -48,7 +55,6 @@ jobs:
4855
path: ./wheelhouse/*.whl
4956

5057
- name: Publish to huggingface
51-
if: matrix.python-version == 'cp38'
5258
env:
5359
HF_TOKEN: ${{ secrets.HF_TOKEN }}
5460
uses: nick-fields/retry@v3
@@ -77,36 +83,6 @@ jobs:
7783
git commit -m "add more wheels"
7884
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main
7985
80-
- name: Publish to huggingface
81-
if: matrix.python-version == 'cp38'
82-
env:
83-
HF_TOKEN: ${{ secrets.HF_TOKEN }}
84-
uses: nick-fields/retry@v2
85-
with:
86-
max_attempts: 20
87-
timeout_seconds: 200
88-
shell: bash
89-
command: |
90-
git config --global user.email "csukuangfj@gmail.com"
91-
git config --global user.name "Fangjun Kuang"
92-
93-
rm -rf huggingface
94-
export GIT_LFS_SKIP_SMUDGE=1
95-
export GIT_CLONE_PROTECTION_ACTIVE=false
96-
97-
git clone https://huggingface.co/csukuangfj/sherpa-onnx-wheels huggingface
98-
cd huggingface
99-
git fetch
100-
git pull
101-
git merge -m "merge remote" --ff origin main
102-
103-
cp -v ../wheelhouse/*.whl .
104-
105-
git status
106-
git add .
107-
git commit -m "add more wheels"
108-
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main
109-
11086
- name: Publish wheels to PyPI
11187
env:
11288
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}

.github/workflows/dot-net.yaml

+130
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,103 @@ permissions:
1111
contents: read
1212

1313
jobs:
14+
build-libs:
15+
name: ${{ matrix.os }} ${{ matrix.arch }}
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [windows-2019]
21+
arch: [x64, x86, arm64]
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Build sherpa-onnx
29+
shell: bash
30+
run: |
31+
arch=${{ matrix.arch }}
32+
opts=""
33+
if [ $arch == x86 ]; then
34+
opts="-A Win32"
35+
elif [ $arch == arm64 ]; then
36+
opts="-A ARM64"
37+
fi
38+
39+
mkdir build
40+
cd build
41+
cmake \
42+
$opts \
43+
-DBUILD_SHARED_LIBS=ON \
44+
-DCMAKE_INSTALL_PREFIX=./install \
45+
-DCMAKE_BUILD_TYPE=Release \
46+
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
47+
-DBUILD_ESPEAK_NG_EXE=OFF \
48+
-DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \
49+
-DSHERPA_ONNX_ENABLE_BINARY=ON \
50+
..
51+
52+
cmake --build . --target install --config Release
53+
rm -rf install/pkgconfig
54+
55+
- uses: actions/upload-artifact@v4
56+
with:
57+
name: windows-${{ matrix.arch }}
58+
path: ./build/install/lib/
59+
60+
- name: Create tar file
61+
shell: bash
62+
run: |
63+
arch=${{ matrix.arch }}
64+
65+
cd build
66+
67+
SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ../CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
68+
69+
dst=sherpa-onnx-$SHERPA_ONNX_VERSION-win-$arch
70+
mv install/lib $dst
71+
tar cjvf $dst.tar.bz2 $dst
72+
ls -lh *.tar.bz2
73+
mv *.tar.bz2 ../
74+
75+
# https://huggingface.co/docs/hub/spaces-github-actions
76+
- name: Publish to huggingface
77+
if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
78+
env:
79+
HF_TOKEN: ${{ secrets.HF_TOKEN }}
80+
uses: nick-fields/retry@v3
81+
with:
82+
max_attempts: 20
83+
timeout_seconds: 200
84+
shell: bash
85+
command: |
86+
git config --global user.email "csukuangfj@gmail.com"
87+
git config --global user.name "Fangjun Kuang"
88+
89+
rm -rf huggingface
90+
export GIT_CLONE_PROTECTION_ACTIVE=false
91+
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
92+
93+
cd huggingface
94+
mkdir -p windows-for-dotnet
95+
96+
cp -v ../sherpa-onnx-*.tar.bz2 ./windows-for-dotnet
97+
98+
git status
99+
git lfs track "*.bz2"
100+
101+
git add .
102+
103+
git commit -m "add more files"
104+
105+
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
106+
rm -rf huggingface
107+
14108
release-nuget-package:
15109
runs-on: ${{ matrix.os }}
110+
needs: [build-libs]
16111
strategy:
17112
fail-fast: false
18113
matrix:
@@ -30,9 +125,44 @@ jobs:
30125
6.0.x
31126
7.0.x
32127
128+
- name: Install Python dependencies
129+
shell: bash
130+
run: |
131+
python3 -m pip install --upgrade pip Jinja2
132+
133+
- name: Retrieve artifact from windows x64
134+
uses: actions/download-artifact@v4
135+
with:
136+
name: windows-x64
137+
path: /tmp/windows-x64
138+
139+
- name: Retrieve artifact from windows x86
140+
uses: actions/download-artifact@v4
141+
with:
142+
name: windows-x86
143+
path: /tmp/windows-x86
144+
145+
- name: Retrieve artifact from windows arm64
146+
uses: actions/download-artifact@v4
147+
with:
148+
name: windows-arm64
149+
path: /tmp/windows-arm64
150+
33151
- name: Check dotnet
34152
run: dotnet --info
35153

154+
- name: Build
155+
shell: bash
156+
run: |
157+
sudo apt-get install -y tree
158+
ls -lh /tmp/
159+
160+
tree /tmp/windows*
161+
echo "----"
162+
163+
rm -v /tmp/windows*/*.lib
164+
tree /tmp/windows*
165+
36166
- name: Build
37167
shell: bash
38168
run: |

.github/workflows/run-python-test-macos.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ jobs:
4444
- os: macos-11
4545
python-version: "3.7"
4646

47-
- os: macos-12
47+
- os: macos-13
4848
python-version: "3.8"
4949

5050
- os: macos-13
5151
python-version: "3.9"
52-
- os: macos-13
52+
- os: macos-14
5353
python-version: "3.10"
54-
- os: macos-13
54+
- os: macos-14
5555
python-version: "3.11"
5656

57-
- os: macos-14
57+
- os: macos-latest
5858
python-version: "3.12"
5959

6060
steps:
@@ -90,7 +90,7 @@ jobs:
9090
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
9191
cmake --version
9292
93-
python3 -m pip install --verbose .
93+
python3 setup.py install
9494
9595
- name: Test sherpa-onnx
9696
shell: bash

.github/workflows/test-python-offline-websocket-server.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
6767
cmake --version
6868
69-
python3 -m pip install --no-deps --verbose .
69+
python3 setup.py install
7070
python3 -m pip install websockets
7171
7272
- name: Start server for transducer models

.github/workflows/test-python-online-websocket-server.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
6767
cmake --version
6868
69-
python3 -m pip install --no-deps --verbose .
69+
python3 setup.py install
7070
python3 -m pip install websockets
7171
7272
- name: Start server for zipformer2 CTC models

.github/workflows/windows-x64.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,16 @@ jobs:
6969
shell: bash
7070
run: |
7171
cd build
72-
cmake --build . --config Release -- -m:2
72+
cmake --build . --config Release -- -m:2
7373
cmake --build . --config Release --target install -- -m:2
7474
7575
ls -lh ./bin/Release/sherpa-onnx.exe
7676
77+
- uses: actions/upload-artifact@v4
78+
with:
79+
name: release-windows-x64-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
80+
path: build/install/*
81+
7782
- name: Test offline punctuation
7883
shell: bash
7984
run: |

.github/workflows/windows-x86.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ jobs:
7474
7575
ls -lh ./bin/Release/sherpa-onnx.exe
7676
77+
- uses: actions/upload-artifact@v4
78+
with:
79+
name: release-windows-x86-${{ matrix.shared_lib }}-${{ matrix.with_tts }}
80+
path: build/install/*
81+
7782
- name: Test offline punctuation
7883
shell: bash
7984
run: |

CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ project(sherpa-onnx)
88
# ./nodejs-addon-examples
99
# ./dart-api-examples/
1010
# ./sherpa-onnx/flutter/CHANGELOG.md
11-
set(SHERPA_ONNX_VERSION "1.10.2")
11+
set(SHERPA_ONNX_VERSION "1.10.5")
1212

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

4142
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
4243
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
@@ -127,6 +128,7 @@ message(STATUS "SHERPA_ONNX_ENABLE_TTS ${SHERPA_ONNX_ENABLE_TTS}")
127128
message(STATUS "SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY ${SHERPA_ONNX_LINK_LIBSTDCPP_STATICALLY}")
128129
message(STATUS "SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE ${SHERPA_ONNX_USE_PRE_INSTALLED_ONNXRUNTIME_IF_AVAILABLE}")
129130
message(STATUS "SHERPA_ONNX_ENABLE_SANITIZER: ${SHERPA_ONNX_ENABLE_SANITIZER}")
131+
message(STATUS "SHERPA_ONNX_BUILD_C_API_EXAMPLES: ${SHERPA_ONNX_BUILD_C_API_EXAMPLES}")
130132

131133
if(SHERPA_ONNX_ENABLE_TTS)
132134
message(STATUS "TTS is enabled")
@@ -302,7 +304,7 @@ endif()
302304

303305
add_subdirectory(sherpa-onnx)
304306

305-
if(SHERPA_ONNX_ENABLE_C_API AND SHERPA_ONNX_ENABLE_BINARY)
307+
if(SHERPA_ONNX_ENABLE_C_API AND SHERPA_ONNX_ENABLE_BINARY AND SHERPA_ONNX_BUILD_C_API_EXAMPLES)
306308
set(SHERPA_ONNX_PKG_WITH_CARGS "-lcargs")
307309
add_subdirectory(c-api-examples)
308310
endif()

cmake/cmake_extension.py

+1
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def build_extension(self, ext: setuptools.extension.Extension):
146146
extra_cmake_args += " -DBUILD_ESPEAK_NG_EXE=OFF "
147147
extra_cmake_args += " -DBUILD_ESPEAK_NG_TESTS=OFF "
148148

149+
extra_cmake_args += " -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF "
149150
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_CHECK=OFF "
150151
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PYTHON=ON "
151152
extra_cmake_args += " -DSHERPA_ONNX_ENABLE_PORTAUDIO=ON "

nodejs-addon-examples/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"dependencies": {
3-
"sherpa-onnx-node": "^1.10.2"
3+
"sherpa-onnx-node": "^1.10.3"
44
}
55
}

scripts/dotnet/generate.py

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ def main():
134134
process_linux(s)
135135
process_windows(s, "x64")
136136
process_windows(s, "x86")
137+
process_windows(s, "arm64")
137138

138139
s = read_proj_file("./sherpa-onnx.csproj.in")
139140
d = get_dict()

0 commit comments

Comments
 (0)