mirror of
https://github.com/k2-fsa/sherpa-onnx.git
synced 2026-11-10 13:04:05 +08:00
Fixes #3731 espeak-ng and piper-phonemize are no longer built into sherpa-onnx. Text frontends are now: - **lexicon** — built in, no extra dependency - **phonemize** — phonemize outside sherpa-onnx (e.g. [piper-phonemize](https://github.com/csukuangfj/piper-phonemize)) and pass the result in. That library is GPL, so it stays optional: sherpa-onnx is GPL-free after this PR. ## API - `SherpaOnnxGenerationConfig` gains `phoneme_codepoints` and `tokens` (mutually exclusive alternatives to `text`) - `data_dir` on the TTS model configs is deprecated and ignored; the ABI slot is kept - all bindings updated: C/C++, Python, Java, Kotlin, Go, Rust, C#, Swift, Pascal, Dart/Flutter, node-addon, WASM, HarmonyOS
682 lines
24 KiB
YAML
682 lines
24 KiB
YAML
name: test-flutter-punct
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- apk
|
|
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: test-flutter-punct-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
macos:
|
|
name: macOS (${{ matrix.demo }})
|
|
runs-on: macos-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
demo: [online-punctuation, offline-punctuation]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Update version
|
|
shell: bash
|
|
run: |
|
|
./new-release.sh
|
|
git diff .
|
|
|
|
- name: ccache
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
with:
|
|
key: macos-flutter-punct-${{ matrix.demo }}
|
|
|
|
- name: Setup Flutter SDK
|
|
uses: flutter-actions/setup-flutter@v4
|
|
with:
|
|
channel: stable
|
|
version: 3.44.8
|
|
|
|
- name: Display flutter info
|
|
shell: bash
|
|
run: |
|
|
which flutter
|
|
which dart
|
|
flutter --version
|
|
dart --version
|
|
flutter doctor
|
|
|
|
- name: Cache xcframework
|
|
id: cache-xcframework
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework
|
|
key: macos-xcframework-${{ hashFiles('build-macos-shared-sherpa-with-static-onnxruntime.sh', 'CMakeLists.txt') }}
|
|
restore-keys: |
|
|
macos-xcframework-
|
|
|
|
- name: Build xcframework from source
|
|
if: steps.cache-xcframework.outputs.cache-hit != 'true'
|
|
shell: bash
|
|
run: |
|
|
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
|
./build-macos-shared-sherpa-with-static-onnxruntime.sh
|
|
|
|
- name: Copy xcframework
|
|
shell: bash
|
|
run: |
|
|
cp -av build-macos-shared-sherpa-with-static-onnxruntime/sherpa-onnx.xcframework flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework
|
|
ls -lh flutter/sherpa_onnx_macos/macos/sherpa_onnx_macos/sherpa-onnx.xcframework/
|
|
|
|
- name: Use local sherpa_onnx_macos
|
|
shell: bash
|
|
run: |
|
|
cd flutter/sherpa_onnx
|
|
sed -i.bak 's| sherpa_onnx_macos: 1.13.8| # sherpa_onnx_macos: 1.13.8\n sherpa_onnx_macos:\n path: ../sherpa_onnx_macos|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
cat pubspec.yaml
|
|
|
|
- name: Remove sherpa_onnx_web dependency
|
|
shell: bash
|
|
run: |
|
|
cd flutter/sherpa_onnx
|
|
sed -i.bak 's|^ sherpa_onnx_web:.*| # sherpa_onnx_web: 1.13.8|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
|
|
- name: Download model
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/assets
|
|
rm -fv .gitkeep
|
|
if [ "${{ matrix.demo }}" = "online-punctuation" ]; then
|
|
curl -sSL -o sherpa-onnx-online-punct-en-2024-08-06.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
tar xf sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06/model.onnx
|
|
else
|
|
curl -sSL -o sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
tar xf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
fi
|
|
cd ..
|
|
./generate-asset-list.py
|
|
|
|
- name: Copy LICENSE for sherpa_onnx_macos podspec
|
|
shell: bash
|
|
run: |
|
|
cp LICENSE flutter/sherpa_onnx_macos/LICENSE
|
|
|
|
- name: Build Flutter app
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}
|
|
|
|
sed -i.bak 's|sherpa_onnx: 1.13.8|sherpa_onnx:\n path: ../../flutter/sherpa_onnx|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
flutter config --no-enable-swift-package-manager
|
|
flutter pub get
|
|
cd macos && pod install && cd ..
|
|
flutter build macos
|
|
|
|
ls -lh build/macos/Build/Products/Release/
|
|
|
|
- name: Ad-hoc sign the app
|
|
shell: bash
|
|
run: |
|
|
app_name=$(echo ${{ matrix.demo }} | tr '-' '_')
|
|
codesign --force --deep -s - flutter-examples/${{ matrix.demo }}/build/macos/Build/Products/Release/${app_name}.app
|
|
xattr -cr flutter-examples/${{ matrix.demo }}/build/macos/Build/Products/Release/${app_name}.app
|
|
|
|
- name: Zip app
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/build/macos/Build/Products/Release/
|
|
app_name=$(echo ${{ matrix.demo }} | tr '-' '_')
|
|
zip -r -y flutter-${{ matrix.demo }}-macos.zip ${app_name}.app/
|
|
ls -lh flutter-${{ matrix.demo }}-macos.zip
|
|
|
|
- name: Release
|
|
if: github.repository_owner == 'csukuangfj'
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
file_glob: true
|
|
overwrite: true
|
|
file: ./flutter-examples/${{ matrix.demo }}/build/macos/Build/Products/Release/flutter-${{ matrix.demo }}-macos.zip
|
|
repo_name: k2-fsa/sherpa-onnx
|
|
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
|
tag: flutter
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: flutter-${{ matrix.demo }}-macos
|
|
path: flutter-examples/${{ matrix.demo }}/build/macos/Build/Products/Release/flutter-${{ matrix.demo }}-macos.zip
|
|
|
|
linux:
|
|
name: Linux (${{ matrix.demo }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
demo: [online-punctuation, offline-punctuation]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Update version
|
|
shell: bash
|
|
run: |
|
|
./new-release.sh
|
|
git diff .
|
|
|
|
- name: ccache
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
with:
|
|
key: linux-flutter-punct-${{ matrix.demo }}
|
|
|
|
- name: Install dependencies
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev
|
|
|
|
- name: Setup Flutter SDK
|
|
uses: flutter-actions/setup-flutter@v4
|
|
with:
|
|
channel: stable
|
|
version: latest
|
|
|
|
- name: Display flutter info
|
|
shell: bash
|
|
run: |
|
|
which flutter
|
|
which dart
|
|
flutter --version
|
|
dart --version
|
|
flutter doctor
|
|
|
|
- name: Build sherpa-onnx from source
|
|
shell: bash
|
|
run: |
|
|
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
|
mkdir build
|
|
cd build
|
|
cmake \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
|
|
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
|
|
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
|
|
-DCMAKE_INSTALL_PREFIX=./install \
|
|
..
|
|
cmake --build . --target install --config Release
|
|
|
|
- name: Copy libs
|
|
shell: bash
|
|
run: |
|
|
if [[ $(uname -m) == "aarch64" ]]; then
|
|
arch=aarch64
|
|
else
|
|
arch=x64
|
|
fi
|
|
cp -fv build/install/lib/lib* ./flutter/sherpa_onnx_linux/linux/$arch
|
|
ls -lh ./flutter/sherpa_onnx_linux/linux/$arch
|
|
|
|
- name: Use local sherpa_onnx_linux
|
|
shell: bash
|
|
run: |
|
|
cd flutter/sherpa_onnx
|
|
sed -i.bak 's| sherpa_onnx_linux: 1.13.8| # sherpa_onnx_linux: 1.13.8\n sherpa_onnx_linux:\n path: ../sherpa_onnx_linux|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
cat pubspec.yaml
|
|
|
|
- name: Remove sherpa_onnx_web dependency
|
|
shell: bash
|
|
run: |
|
|
cd flutter/sherpa_onnx
|
|
sed -i.bak 's|^ sherpa_onnx_web:.*| # sherpa_onnx_web: 1.13.8|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
|
|
- name: Download model
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/assets
|
|
rm -fv .gitkeep
|
|
if [ "${{ matrix.demo }}" = "online-punctuation" ]; then
|
|
curl -sSL -o sherpa-onnx-online-punct-en-2024-08-06.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
tar xf sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06/model.onnx
|
|
else
|
|
curl -sSL -o sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
tar xf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
fi
|
|
cd ..
|
|
./generate-asset-list.py
|
|
|
|
- name: Build Flutter app
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}
|
|
|
|
sed -i.bak 's|sherpa_onnx: 1.13.8|sherpa_onnx:\n path: ../../flutter/sherpa_onnx|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
flutter pub get
|
|
flutter build linux
|
|
|
|
ls -lh build/linux/*/release/bundle/
|
|
|
|
- name: Zip app
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/build/linux/*/release/
|
|
zip -r -y flutter-${{ matrix.demo }}-linux-x64.zip bundle/
|
|
ls -lh flutter-${{ matrix.demo }}-linux-x64.zip
|
|
|
|
- name: Release
|
|
if: github.repository_owner == 'csukuangfj'
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
file_glob: true
|
|
overwrite: true
|
|
file: ./flutter-examples/${{ matrix.demo }}/build/linux/*/release/flutter-${{ matrix.demo }}-linux-x64.zip
|
|
repo_name: k2-fsa/sherpa-onnx
|
|
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
|
tag: flutter
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: flutter-${{ matrix.demo }}-linux-x64
|
|
path: flutter-examples/${{ matrix.demo }}/build/linux/*/release/flutter-${{ matrix.demo }}-linux-x64.zip
|
|
|
|
windows:
|
|
name: Windows (${{ matrix.demo }})
|
|
runs-on: windows-2022
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
demo: [online-punctuation, offline-punctuation]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Update version
|
|
shell: bash
|
|
run: |
|
|
./new-release.sh
|
|
git diff .
|
|
|
|
- name: Setup Flutter SDK
|
|
uses: flutter-actions/setup-flutter@v4
|
|
with:
|
|
channel: stable
|
|
version: latest
|
|
|
|
- name: Display flutter info
|
|
shell: bash
|
|
run: |
|
|
which flutter
|
|
which dart
|
|
flutter --version
|
|
dart --version
|
|
flutter doctor
|
|
|
|
- name: Build sherpa-onnx from source
|
|
shell: bash
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
cmake \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
|
|
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
|
|
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
|
|
-DCMAKE_INSTALL_PREFIX=./install \
|
|
..
|
|
cmake --build . --target install --config Release
|
|
|
|
- name: Copy libs
|
|
shell: bash
|
|
run: |
|
|
cp -fv build/install/lib/*.dll ./flutter/sherpa_onnx_windows/windows/x64/
|
|
ls -lh ./flutter/sherpa_onnx_windows/windows/x64/
|
|
|
|
- name: Use local sherpa_onnx_windows
|
|
shell: bash
|
|
run: |
|
|
cd flutter/sherpa_onnx
|
|
sed -i.bak 's| sherpa_onnx_windows: 1.13.8| # sherpa_onnx_windows: 1.13.8\n sherpa_onnx_windows:\n path: ../sherpa_onnx_windows|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
cat pubspec.yaml
|
|
|
|
- name: Remove sherpa_onnx_web dependency
|
|
shell: bash
|
|
run: |
|
|
cd flutter/sherpa_onnx
|
|
sed -i.bak 's|^ sherpa_onnx_web:.*| # sherpa_onnx_web: 1.13.8|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
- name: Download model
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/assets
|
|
rm -fv .gitkeep
|
|
if [ "${{ matrix.demo }}" = "online-punctuation" ]; then
|
|
curl -sSL -o sherpa-onnx-online-punct-en-2024-08-06.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
tar xf sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06/model.onnx
|
|
else
|
|
curl -sSL -o sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
tar xf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
fi
|
|
cd ..
|
|
./generate-asset-list.py
|
|
|
|
- name: Build Flutter app
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}
|
|
|
|
sed -i.bak 's|sherpa_onnx: 1.13.8|sherpa_onnx:\n path: ../../flutter/sherpa_onnx|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
flutter pub get
|
|
flutter build windows
|
|
|
|
ls -lh build/windows/x64/runner/Release/
|
|
|
|
- name: Zip app
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/build/windows/x64/runner/
|
|
powershell -Command "Compress-Archive -Path Release -DestinationPath flutter-${{ matrix.demo }}-win-x64.zip"
|
|
ls -lh flutter-${{ matrix.demo }}-win-x64.zip
|
|
|
|
- name: Release
|
|
if: github.repository_owner == 'csukuangfj'
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
file_glob: true
|
|
overwrite: true
|
|
file: ./flutter-examples/${{ matrix.demo }}/build/windows/x64/runner/flutter-${{ matrix.demo }}-win-x64.zip
|
|
repo_name: k2-fsa/sherpa-onnx
|
|
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
|
tag: flutter
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: flutter-${{ matrix.demo }}-win-x64
|
|
path: flutter-examples/${{ matrix.demo }}/build/windows/x64/runner/flutter-${{ matrix.demo }}-win-x64.zip
|
|
|
|
android:
|
|
name: Android (${{ matrix.demo }}, ${{ matrix.abi }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
demo: [online-punctuation, offline-punctuation]
|
|
abi: [arm64-v8a, armeabi-v7a, x86_64]
|
|
include:
|
|
- abi: arm64-v8a
|
|
target_platform: android-arm64
|
|
build_script: build-android-arm64-v8a.sh
|
|
build_dir: build-android-arm64-v8a
|
|
plugin: sherpa_onnx_android_arm64
|
|
plugin_key: sherpa_onnx_android_arm64
|
|
- abi: armeabi-v7a
|
|
target_platform: android-arm
|
|
build_script: build-android-armv7-eabi.sh
|
|
build_dir: build-android-armv7-eabi
|
|
plugin: sherpa_onnx_android_armeabi
|
|
plugin_key: sherpa_onnx_android_armeabi
|
|
- abi: x86_64
|
|
target_platform: android-x64
|
|
build_script: build-android-x86-64.sh
|
|
build_dir: build-android-x86-64
|
|
plugin: sherpa_onnx_android_x86_64
|
|
plugin_key: sherpa_onnx_android_x86_64
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Update version
|
|
shell: bash
|
|
run: |
|
|
./new-release.sh
|
|
git diff .
|
|
|
|
- name: ccache
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
with:
|
|
key: android-flutter-punct-${{ matrix.demo }}-${{ matrix.abi }}
|
|
|
|
- name: Setup Flutter SDK
|
|
uses: flutter-actions/setup-flutter@v4
|
|
with:
|
|
channel: stable
|
|
version: latest
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: 'temurin'
|
|
java-version: '17'
|
|
|
|
- name: Display flutter info
|
|
shell: bash
|
|
run: |
|
|
which flutter
|
|
which dart
|
|
flutter --version
|
|
dart --version
|
|
flutter doctor
|
|
|
|
- name: Build ${{ matrix.abi }} from source
|
|
shell: bash
|
|
run: |
|
|
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
|
export SHERPA_ONNX_ENABLE_C_API=ON
|
|
export SHERPA_ONNX_ENABLE_JNI=OFF
|
|
export SHERPA_ONNX_ENABLE_BINARY=OFF
|
|
./${{ matrix.build_script }}
|
|
|
|
- name: Copy libs
|
|
shell: bash
|
|
run: |
|
|
cp -fv ${{ matrix.build_dir }}/install/lib/lib*.so flutter/${{ matrix.plugin }}/android/src/main/jniLibs/${{ matrix.abi }}/
|
|
ls -lh flutter/${{ matrix.plugin }}/android/src/main/jniLibs/${{ matrix.abi }}/
|
|
|
|
- name: Use local ${{ matrix.plugin }}
|
|
shell: bash
|
|
run: |
|
|
cd flutter/sherpa_onnx
|
|
sed -i.bak 's| ${{ matrix.plugin_key }}: 1.13.8| # ${{ matrix.plugin_key }}: 1.13.8\n ${{ matrix.plugin_key }}:\n path: ../${{ matrix.plugin }}|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
cat pubspec.yaml
|
|
|
|
|
|
- name: Download model
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/assets
|
|
rm -fv .gitkeep
|
|
if [ "${{ matrix.demo }}" = "online-punctuation" ]; then
|
|
curl -sSL -o sherpa-onnx-online-punct-en-2024-08-06.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
tar xf sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06/model.onnx
|
|
else
|
|
curl -sSL -o sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
tar xf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
fi
|
|
cd ..
|
|
./generate-asset-list.py
|
|
|
|
- name: Build Flutter APK
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}
|
|
|
|
sed -i.bak 's|sherpa_onnx: 1.13.8|sherpa_onnx:\n path: ../../flutter/sherpa_onnx|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
flutter pub get
|
|
flutter build apk --split-per-abi --target-platform ${{ matrix.target_platform }}
|
|
|
|
ls -lh build/app/outputs/flutter-apk/
|
|
|
|
- name: Rename APK
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/build/app/outputs/flutter-apk/
|
|
mv app-*-release.apk flutter-${{ matrix.demo }}-${{ matrix.abi }}.apk
|
|
ls -lh *.apk
|
|
|
|
- name: Release
|
|
if: github.repository_owner == 'csukuangfj'
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
file_glob: true
|
|
overwrite: true
|
|
file: ./flutter-examples/${{ matrix.demo }}/build/app/outputs/flutter-apk/flutter-${{ matrix.demo }}-${{ matrix.abi }}.apk
|
|
repo_name: k2-fsa/sherpa-onnx
|
|
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
|
tag: flutter
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: flutter-${{ matrix.demo }}-android-${{ matrix.abi }}
|
|
path: flutter-examples/${{ matrix.demo }}/build/app/outputs/flutter-apk/flutter-${{ matrix.demo }}-${{ matrix.abi }}.apk
|
|
|
|
web:
|
|
name: Web (${{ matrix.demo }})
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
demo: [online-punctuation, offline-punctuation]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Update version
|
|
shell: bash
|
|
run: |
|
|
./new-release.sh
|
|
git diff .
|
|
|
|
- name: Install Emscripten
|
|
uses: mymindstorm/setup-emsdk@v14
|
|
with:
|
|
version: 4.0.23
|
|
|
|
- name: Setup Flutter SDK
|
|
uses: flutter-actions/setup-flutter@v4
|
|
with:
|
|
channel: stable
|
|
version: latest
|
|
|
|
- name: Display flutter info
|
|
shell: bash
|
|
run: |
|
|
which flutter
|
|
which dart
|
|
flutter --version
|
|
dart --version
|
|
flutter doctor
|
|
|
|
- name: Build WASM module
|
|
shell: bash
|
|
run: |
|
|
./build-wasm-simd-web.sh
|
|
|
|
- name: Copy WASM assets to web plugin
|
|
shell: bash
|
|
run: |
|
|
./build-flutter-web-wasm.sh
|
|
|
|
- name: Download model
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/assets
|
|
rm -fv .gitkeep
|
|
if [ "${{ matrix.demo }}" = "online-punctuation" ]; then
|
|
curl -sSL -o sherpa-onnx-online-punct-en-2024-08-06.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
tar xf sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06.tar.bz2
|
|
rm sherpa-onnx-online-punct-en-2024-08-06/model.onnx
|
|
else
|
|
curl -sSL -o sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2 https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
tar xf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12-int8.tar.bz2
|
|
fi
|
|
cd ..
|
|
./generate-asset-list.py
|
|
|
|
|
|
- name: Use local sherpa_onnx_web
|
|
shell: bash
|
|
run: |
|
|
cd flutter/sherpa_onnx
|
|
sed -i.bak 's|^ sherpa_onnx_web:.*| # sherpa_onnx_web: 1.13.8\n sherpa_onnx_web:\n path: ../sherpa_onnx_web|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
- name: Build Flutter web app
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}
|
|
|
|
sed -i.bak 's|sherpa_onnx: 1.13.8|sherpa_onnx:\n path: ../../flutter/sherpa_onnx|' pubspec.yaml
|
|
rm -f pubspec.yaml.bak
|
|
|
|
flutter pub get
|
|
flutter build web
|
|
|
|
ls -lh build/web/
|
|
|
|
- name: Zip web app
|
|
shell: bash
|
|
run: |
|
|
cd flutter-examples/${{ matrix.demo }}/build/
|
|
mv web flutter-${{ matrix.demo }}-web
|
|
zip -r -y flutter-${{ matrix.demo }}-web.zip flutter-${{ matrix.demo }}-web/
|
|
ls -lh flutter-${{ matrix.demo }}-web.zip
|
|
|
|
- name: Release
|
|
if: github.repository_owner == 'csukuangfj'
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
file_glob: true
|
|
overwrite: true
|
|
file: ./flutter-examples/${{ matrix.demo }}/build/flutter-${{ matrix.demo }}-web.zip
|
|
repo_name: k2-fsa/sherpa-onnx
|
|
repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
|
|
tag: flutter
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: flutter-${{ matrix.demo }}-web
|
|
path: flutter-examples/${{ matrix.demo }}/build/flutter-${{ matrix.demo }}.zip
|