Files
sherpa-onnx/.github/workflows/test-nodejs.yaml
T
Fangjun Kuang 0b3647632f Remove espeak-ng and piper-phonemize from sherpa-onnx (#4055)
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
2026-10-20 11:09:04 +08:00

133 lines
3.3 KiB
YAML

name: test-nodejs
on:
push:
branches:
- master
- nodejs-api
paths:
- '.github/workflows/test-nodejs.yaml'
- 'build-wasm-simd-nodejs.sh'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
- 'sherpa-onnx/c-api/*'
- 'wasm/nodejs/**'
- 'scripts/nodejs/**'
- 'nodejs-examples/**'
workflow_dispatch:
concurrency:
group: test-nodejs-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test-nodejs:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] #, macos-latest] #, windows-2022]
python-version: ["3.10"]
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: ${{ matrix.os }}-${{ matrix.build_type }}-wasm-nodejs
- name: Install emsdk
uses: mymindstorm/setup-emsdk@v14
with:
version: 4.0.23
actions-cache-folder: 'emsdk-cache'
- name: View emsdk version
shell: bash
run: |
emcc -v
echo "--------------------"
emcc --check
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
- name: Display node version
shell: bash
run: |
node --version
- name: Build nodejs package
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --version
./build-wasm-simd-nodejs.sh
cp -v build-wasm-simd-nodejs/install/bin/wasm/nodejs/*.js ./scripts/nodejs/
cp -v build-wasm-simd-nodejs/install/bin/wasm/nodejs/*.wasm ./scripts/nodejs/
- name: replace files
shell: bash
run: |
cd nodejs-examples
files=$(ls -1 *.js)
for f in ${files[@]}; do
echo $f
sed -i.bak s%\'sherpa-onnx\'%\'./index.js\'% $f
git status
done
git diff
cp *.js ../scripts/nodejs
- name: Run tests
shell: bash
run: |
node --version
npm --version
export d=scripts/nodejs
cat $d/index.js
pushd $d
npm install
npm install wav
npm install piper-phonemize
popd
./.github/scripts/test-nodejs-npm.sh
- uses: actions/upload-artifact@v4
with:
name: tts-waves-${{ matrix.os }}-${{ matrix.node-version }}
# The examples are copied into scripts/nodejs and run from there
# (export d=scripts/nodejs), so their wavs land in scripts/nodejs,
# not in nodejs-examples.
path: scripts/nodejs/test-*.wav
if-no-files-found: warn
- name: Setup tmate session
if: false
# if: failure()
uses: mxschmitt/action-tmate@v3