Publish node-addon-api wrapper for sherpa-onnx as npm packages (#829)

This commit is contained in:
Fangjun Kuang
2024-05-04 13:27:39 +08:00
committed by GitHub
parent 2f9553d838
commit 4f758e6cd3
27 changed files with 773 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ on:
branches:
- master
paths:
- '.github/workflows/test-node-addon-api.yaml'
- '.github/workflows/test-nodejs-addon-api.yaml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
@@ -16,7 +16,7 @@ on:
branches:
- master
paths:
- '.github/workflows/test-node-addon-api.yaml'
- '.github/workflows/test-nodejs-addon-api.yaml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
@@ -34,12 +34,13 @@ permissions:
jobs:
test-node-addon-api:
name: ${{ matrix.os }}
name: ${{ matrix.os }} ${{ matrix.node-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, macos-14]
os: [macos-11, macos-14, ubuntu-20.04, ubuntu-22.04]
node-version: ["16", "17", "18", "19", "21", "22"]
python-version: ["3.8"]
steps:
@@ -55,6 +56,7 @@ jobs:
- uses: actions/setup-node@v4
with:
registry-url: 'https://registry.npmjs.org'
node-version: ${{ matrix.node-version }}
- name: Display node version
shell: bash
@@ -69,9 +71,18 @@ jobs:
- name: Build sherpa-onnx
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 -DCMAKE_INSTALL_PREFIX=/tmp/sherpa-onnx -DBUILD_SHARED_LIBS=ON ..
cmake \
-DCMAKE_INSTALL_PREFIX=/tmp/sherpa-onnx \
-DBUILD_SHARED_LIBS=ON \
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
-DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
..
make -j
make install
@@ -87,8 +98,6 @@ jobs:
pkg-config --cflags sherpa-onnx
pkg-config --libs sherpa-onnx
a=$(pkg-config --cflags sherpa-onnx);a=${a:2};echo $a
npm i
./node_modules/.bin/node-gyp configure build --verbose