Support including TTS conditionally. (#699)

This commit is contained in:
Fangjun Kuang
2024-03-26 17:21:35 +08:00
committed by GitHub
parent bd66f7a7d0
commit 4e040c596e
14 changed files with 413 additions and 77 deletions

View File

@@ -32,28 +32,45 @@ concurrency:
jobs:
build_xcframework:
name: Build xcframework on ${{ matrix.os }}
name: tts-${{ matrix.with_tts }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
with_tts: [ON, OFF]
steps:
- uses: actions/checkout@v4
- name: Build iOS
if: matrix.with_tts == 'ON'
shell: bash
run: |
./build-ios.sh
- name: Build iOS (No tts)
if: matrix.with_tts == 'OFF'
shell: bash
run: |
./build-ios-no-tts.sh
- name: Display artifacts
if: matrix.with_tts == 'ON'
shell: bash
run: |
brew install tree
tree -L 2 ./build-ios
- name: Display artifacts
if: matrix.with_tts == 'OFF'
shell: bash
run: |
brew install tree
tree -L 2 ./build-ios-no-tts
- name: Package artifacts
if: matrix.with_tts == 'ON'
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
@@ -71,11 +88,37 @@ jobs:
ls -lh
- name: Package artifacts
if: matrix.with_tts == 'OFF'
shell: bash
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
echo "SHERPA_ONNX_VERSION=$SHERPA_ONNX_VERSION" >> "$GITHUB_ENV"
rm -rf build-ios-no-tts/build
rm -rf build-ios-no-tts/install
rm -rf build-ios-no-tts/ios-onnxruntime/.git
tree build-ios-no-tts
filename=sherpa-onnx-${SHERPA_ONNX_VERSION}-ios-no-tts.tar.bz2
tar cjvf $filename ./build-ios-no-tts
ls -lh
- uses: actions/upload-artifact@v4
if: matrix.with_tts == 'ON'
with:
name: sherpa-onnx-ios-libs
path: ./build-ios
- uses: actions/upload-artifact@v4
if: matrix.with_tts == 'OFF'
with:
name: sherpa-onnx-ios-libs-no-tts
path: ./build-ios-no-tts
# 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')
@@ -96,7 +139,7 @@ jobs:
cd huggingface
git lfs pull
cp -v ../sherpa-onnx-*-ios.tar.bz2 ./
cp -v ../sherpa-onnx-*.tar.bz2 ./
git status
git lfs track "*.bz2"
@@ -113,4 +156,4 @@ jobs:
with:
file_glob: true
overwrite: true
file: sherpa-onnx-*-ios.tar.bz2
file: sherpa-onnx-*.tar.bz2

View File

@@ -45,7 +45,7 @@ concurrency:
jobs:
linux:
name: ${{ matrix.build_type }} ${{ matrix.shared_lib }}
name: ${{ matrix.build_type }} shared-${{ matrix.shared_lib }} tts-${{ matrix.with_tts }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -53,6 +53,7 @@ jobs:
os: [ubuntu-latest]
build_type: [Release, Debug]
shared_lib: [ON, OFF]
with_tts: [ON, OFF]
steps:
- uses: actions/checkout@v4
@@ -93,7 +94,7 @@ jobs:
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install ..
cmake -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install ..
make -j2
make install
@@ -120,7 +121,7 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: release-${{ matrix.build_type }}-${{ matrix.shared_lib }}
name: release-${{ matrix.build_type }}-with-shared-lib-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }}
path: build/bin/*
- name: Test spoken language identification (C API)
@@ -175,6 +176,7 @@ jobs:
.github/scripts/test-offline-ctc.sh
- name: Test offline TTS
if: matrix.with_tts == 'ON'
shell: bash
run: |
export PATH=$PWD/build/bin:$PATH
@@ -226,7 +228,11 @@ jobs:
suffix=static
fi
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-x64-$suffix
if [[ ${{ matrix.with_tts }} ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-x64-$suffix
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-x64-$suffix-no-tts
fi
mkdir $dst
cp -a build/install/bin $dst/
@@ -278,6 +284,6 @@ jobs:
- uses: actions/upload-artifact@v4
with:
name: tts-generated-test-files-${{ matrix.build_type }}-${{ matrix.shared_lib }}
name: tts-generated-test-files-${{ matrix.build_type }}-${{ matrix.shared_lib }}-with-tts-${{ matrix.with_tts }}
path: tts

View File

@@ -45,13 +45,14 @@ concurrency:
jobs:
macos:
runs-on: ${{ matrix.os }}
name: ${{ matrix.build_type }} ${{ matrix.lib_type }}
name: ${{ matrix.build_type }} ${{ matrix.lib_type }} tts-${{ matrix.with_tts }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
build_type: [Release, Debug]
lib_type: [static, shared]
with_tts: [ON, OFF]
steps:
- uses: actions/checkout@v4
@@ -61,7 +62,7 @@ jobs:
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.lib_type }}
key: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.lib_type }}-tts-${{ matrix.with_tts }}
- name: Configure CMake
shell: bash
@@ -79,7 +80,7 @@ jobs:
BUILD_SHARED_LIBS=ON
fi
cmake -D BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_INSTALL_PREFIX=./install ..
cmake -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_INSTALL_PREFIX=./install ..
- name: Build sherpa-onnx for macos
shell: bash
@@ -135,6 +136,7 @@ jobs:
.github/scripts/test-online-ctc.sh
- name: Test offline TTS
if: matrix.with_tts == 'ON'
shell: bash
run: |
export PATH=$PWD/build/bin:$PATH
@@ -196,7 +198,11 @@ jobs:
run: |
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-osx-universal2-${{ matrix.lib_type }}
if [[ ${{ matrix.with_tts }} ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-osx-universal2-${{ matrix.lib_type }}
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-osx-universal2-${{ matrix.lib_type }}-no-tts
fi
mkdir $dst
cp -a build/install/bin $dst/

View File

@@ -40,13 +40,14 @@ concurrency:
jobs:
windows_x64:
name: ${{ matrix.shared_lib }}
name: shared-${{ matrix.shared_lib }} tts-${{ matrix.with_tts }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
shared_lib: [ON, OFF]
with_tts: [ON, OFF]
steps:
- uses: actions/checkout@v4
@@ -58,7 +59,8 @@ jobs:
run: |
mkdir build
cd build
cmake -A x64 -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install ..
cmake -A x64 -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install ..
- name: Build sherpa-onnx for windows
shell: bash
run: |
@@ -93,6 +95,7 @@ jobs:
.github/scripts/test-online-ctc.sh
- name: Test offline TTS
if: matrix.with_tts == 'ON'
shell: bash
run: |
export PATH=$PWD/build/bin/Release:$PATH
@@ -155,9 +158,15 @@ jobs:
shared_lib=${{ matrix.shared_lib }}
if [[ $shared_lib == "ON" ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-shared
suffix=shared
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-static
suffix=static
fi
if [[ ${{ matrix.with_tts }} ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64-$suffix-no-tts
fi
mkdir $dst

View File

@@ -40,13 +40,14 @@ concurrency:
jobs:
windows_x86:
name: Windows x86
name: shared-${{ matrix.shared_lib }} tts-${{ matrix.with_tts }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
shared_lib: [ON, OFF]
with_tts: [ON, OFF]
steps:
- uses: actions/checkout@v4
@@ -58,7 +59,7 @@ jobs:
run: |
mkdir build
cd build
cmake -A Win32 -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -D CMAKE_INSTALL_PREFIX=./install ..
cmake -A Win32 -DSHERPA_ONNX_ENABLE_TTS=${{ matrix.with_tts }} -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -D CMAKE_INSTALL_PREFIX=./install ..
- name: Build sherpa-onnx for windows
shell: bash
@@ -94,6 +95,7 @@ jobs:
.github/scripts/test-online-ctc.sh
- name: Test offline TTS
if: matrix.with_tts == 'ON'
shell: bash
run: |
export PATH=$PWD/build/bin/Release:$PATH
@@ -157,10 +159,17 @@ jobs:
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86
shared_lib=${{ matrix.shared_lib }}
if [[ $shared_lib == "ON" ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-shared
suffix=shared
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-static
suffix=static
fi
if [[ ${{ matrix.with_tts }} ]]; then
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix
else
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86-$suffix-no-tts
fi
mkdir $dst