Committed by
GitHub
Provide npm package for 32-bit Windows x86 (#1141)
正在显示
12 个修改的文件
包含
383 行增加
和
66 行删除
| @@ -49,6 +49,7 @@ | @@ -49,6 +49,7 @@ | ||
| 49 | "sherpa-onnx-darwin-x64": "^SHERPA_ONNX_VERSION", | 49 | "sherpa-onnx-darwin-x64": "^SHERPA_ONNX_VERSION", |
| 50 | "sherpa-onnx-linux-x64": "^SHERPA_ONNX_VERSION", | 50 | "sherpa-onnx-linux-x64": "^SHERPA_ONNX_VERSION", |
| 51 | "sherpa-onnx-linux-arm64": "^SHERPA_ONNX_VERSION", | 51 | "sherpa-onnx-linux-arm64": "^SHERPA_ONNX_VERSION", |
| 52 | - "sherpa-onnx-win-x64": "^SHERPA_ONNX_VERSION" | 52 | + "sherpa-onnx-win-x64": "^SHERPA_ONNX_VERSION", |
| 53 | + "sherpa-onnx-win-ia32": "^SHERPA_ONNX_VERSION" | ||
| 53 | } | 54 | } |
| 54 | } | 55 | } |
| @@ -9,16 +9,23 @@ platform=$(node -p "require('os').platform()") | @@ -9,16 +9,23 @@ platform=$(node -p "require('os').platform()") | ||
| 9 | 9 | ||
| 10 | arch=$(node -p "require('os').arch()") | 10 | arch=$(node -p "require('os').arch()") |
| 11 | 11 | ||
| 12 | +echo "platform: $platform" | ||
| 13 | +echo "arch: $arch" | ||
| 14 | + | ||
| 15 | +# ia32 for win x86 | ||
| 16 | + | ||
| 12 | platform2=$platform | 17 | platform2=$platform |
| 13 | 18 | ||
| 19 | + | ||
| 14 | if [[ $platform == win32 ]]; then | 20 | if [[ $platform == win32 ]]; then |
| 15 | platform2=win | 21 | platform2=win |
| 16 | fi | 22 | fi |
| 17 | 23 | ||
| 24 | + | ||
| 18 | SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | 25 | SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) |
| 19 | echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | 26 | echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" |
| 20 | 27 | ||
| 21 | -# SHERPA_ONNX_VERSION=1.0.28 | 28 | +# SHERPA_ONNX_VERSION=1.0.31 |
| 22 | 29 | ||
| 23 | if [ -z $owner ]; then | 30 | if [ -z $owner ]; then |
| 24 | owner=k2-fsa | 31 | owner=k2-fsa |
| @@ -6,6 +6,66 @@ d=nodejs-addon-examples | @@ -6,6 +6,66 @@ d=nodejs-addon-examples | ||
| 6 | echo "dir: $d" | 6 | echo "dir: $d" |
| 7 | cd $d | 7 | cd $d |
| 8 | 8 | ||
| 9 | +arch=$(node -p "require('os').arch()") | ||
| 10 | +platform=$(node -p "require('os').platform()") | ||
| 11 | +node_version=$(node -p "process.versions.node.split('.')[0]") | ||
| 12 | + | ||
| 13 | +echo "----------asr----------" | ||
| 14 | + | ||
| 15 | +if [[ $arch != "ia32" && $platform != "win32" ]]; then | ||
| 16 | + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 | ||
| 17 | + tar xvf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 | ||
| 18 | + rm sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 | ||
| 19 | + | ||
| 20 | + node ./test_asr_non_streaming_nemo_ctc.js | ||
| 21 | + rm -rf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k | ||
| 22 | + | ||
| 23 | + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 | ||
| 24 | + tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 | ||
| 25 | + rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 | ||
| 26 | + | ||
| 27 | + node ./test_asr_non_streaming_paraformer.js | ||
| 28 | + | ||
| 29 | + rm -f itn* | ||
| 30 | + | ||
| 31 | + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst | ||
| 32 | + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav | ||
| 33 | + | ||
| 34 | + node ./test_asr_non_streaming_paraformer_itn.js | ||
| 35 | + | ||
| 36 | + rm -rf sherpa-onnx-paraformer-zh-2023-09-14 | ||
| 37 | +fi | ||
| 38 | + | ||
| 39 | +echo "----------tts----------" | ||
| 40 | + | ||
| 41 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_GB-cori-medium.tar.bz2 | ||
| 42 | +tar xf vits-piper-en_GB-cori-medium.tar.bz2 | ||
| 43 | +rm vits-piper-en_GB-cori-medium.tar.bz2 | ||
| 44 | + | ||
| 45 | +node ./test_tts_non_streaming_vits_piper_en.js | ||
| 46 | +rm -rf vits-piper-en_GB-cori-medium | ||
| 47 | + | ||
| 48 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-coqui-de-css10.tar.bz2 | ||
| 49 | +tar xvf vits-coqui-de-css10.tar.bz2 | ||
| 50 | +rm vits-coqui-de-css10.tar.bz2 | ||
| 51 | + | ||
| 52 | +node ./test_tts_non_streaming_vits_coqui_de.js | ||
| 53 | +rm -rf vits-coqui-de-css10 | ||
| 54 | + | ||
| 55 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-vits-zh-ll.tar.bz2 | ||
| 56 | +tar xvf sherpa-onnx-vits-zh-ll.tar.bz2 | ||
| 57 | +rm sherpa-onnx-vits-zh-ll.tar.bz2 | ||
| 58 | + | ||
| 59 | +node ./test_tts_non_streaming_vits_zh_ll.js | ||
| 60 | +rm -rf sherpa-onnx-vits-zh-ll | ||
| 61 | + | ||
| 62 | +curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-icefall-zh-aishell3.tar.bz2 | ||
| 63 | +tar xvf vits-icefall-zh-aishell3.tar.bz2 | ||
| 64 | +rm vits-icefall-zh-aishell3.tar.bz2 | ||
| 65 | + | ||
| 66 | +node ./test_tts_non_streaming_vits_zh_aishell3.js | ||
| 67 | +rm -rf vits-icefall-zh-aishell3 | ||
| 68 | + | ||
| 9 | echo "----------keyword spotting----------" | 69 | echo "----------keyword spotting----------" |
| 10 | 70 | ||
| 11 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/kws-models/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2 | 71 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/kws-models/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2 |
| @@ -15,14 +75,23 @@ rm sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2 | @@ -15,14 +75,23 @@ rm sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2 | ||
| 15 | node ./test_keyword_spotter_transducer.js | 75 | node ./test_keyword_spotter_transducer.js |
| 16 | rm -rf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01 | 76 | rm -rf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01 |
| 17 | 77 | ||
| 18 | -echo "----------add punctuations----------" | 78 | +if [[ $arch != "ia32" && $platform != "win32" && $node_version != 21 ]]; then |
| 79 | + # The punctuation model is so large that it cause memory allocation failure on windows x86 | ||
| 80 | + # 2024-07-17 03:24:34.2388391 [E:onnxruntime:, inference_session.cc:1981 | ||
| 81 | + # onnxruntime::InferenceSession::Initialize::<lambda_d603a8c74863bd6b58a1c7996295ed04>::operator ()] | ||
| 82 | + # Exception during initialization: bad allocation | ||
| 83 | + # Error: Process completed with exit code 127. | ||
| 84 | + # | ||
| 85 | + # Node 21 does not have such an issue | ||
| 86 | + echo "----------add punctuations----------" | ||
| 19 | 87 | ||
| 20 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
| 21 | -tar xvf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
| 22 | -rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | 88 | + curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/punctuation-models/sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 |
| 89 | + tar xvf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
| 90 | + rm sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12.tar.bz2 | ||
| 23 | 91 | ||
| 24 | -node ./test_punctuation.js | ||
| 25 | -rm -rf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12 | 92 | + node ./test_punctuation.js |
| 93 | + rm -rf sherpa-onnx-punct-ct-transformer-zh-en-vocab272727-2024-04-12 | ||
| 94 | +fi | ||
| 26 | 95 | ||
| 27 | echo "----------audio tagging----------" | 96 | echo "----------audio tagging----------" |
| 28 | 97 | ||
| @@ -75,9 +144,10 @@ rm -f itn* | @@ -75,9 +144,10 @@ rm -f itn* | ||
| 75 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst | 144 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst |
| 76 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav | 145 | curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav |
| 77 | 146 | ||
| 78 | -node test_asr_streaming_transducer_itn.js | ||
| 79 | - | ||
| 80 | -node test_asr_streaming_transducer.js | 147 | +if [[ $arch != "ia32" && $platform != "win32" ]]; then |
| 148 | + node test_asr_streaming_transducer_itn.js | ||
| 149 | + node test_asr_streaming_transducer.js | ||
| 150 | +fi | ||
| 81 | 151 | ||
| 82 | rm -rf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 | 152 | rm -rf sherpa-onnx-streaming-zipformer-bilingual-zh-en-2023-02-20 |
| 83 | 153 | ||
| @@ -114,56 +184,6 @@ rm sherpa-onnx-whisper-tiny.en.tar.bz2 | @@ -114,56 +184,6 @@ rm sherpa-onnx-whisper-tiny.en.tar.bz2 | ||
| 114 | node ./test_asr_non_streaming_whisper.js | 184 | node ./test_asr_non_streaming_whisper.js |
| 115 | rm -rf sherpa-onnx-whisper-tiny.en | 185 | rm -rf sherpa-onnx-whisper-tiny.en |
| 116 | 186 | ||
| 117 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 | ||
| 118 | -tar xvf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 | ||
| 119 | -rm sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k.tar.bz2 | ||
| 120 | - | ||
| 121 | -node ./test_asr_non_streaming_nemo_ctc.js | ||
| 122 | -rm -rf sherpa-onnx-nemo-fast-conformer-ctc-be-de-en-es-fr-hr-it-pl-ru-uk-20k | ||
| 123 | - | ||
| 124 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 | ||
| 125 | -tar xvf sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 | ||
| 126 | -rm sherpa-onnx-paraformer-zh-2023-09-14.tar.bz2 | ||
| 127 | - | ||
| 128 | -node ./test_asr_non_streaming_paraformer.js | ||
| 129 | - | ||
| 130 | -rm -f itn* | ||
| 131 | - | ||
| 132 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn_zh_number.fst | ||
| 133 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/itn-zh-number.wav | ||
| 134 | - | ||
| 135 | -node ./test_asr_non_streaming_paraformer_itn.js | ||
| 136 | 187 | ||
| 137 | -rm -rf sherpa-onnx-paraformer-zh-2023-09-14 | ||
| 138 | - | ||
| 139 | -echo "----------tts----------" | ||
| 140 | - | ||
| 141 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-piper-en_GB-cori-medium.tar.bz2 | ||
| 142 | -tar xvf vits-piper-en_GB-cori-medium.tar.bz2 | ||
| 143 | -rm vits-piper-en_GB-cori-medium.tar.bz2 | ||
| 144 | - | ||
| 145 | -node ./test_tts_non_streaming_vits_piper_en.js | ||
| 146 | -rm -rf vits-piper-en_GB-cori-medium | ||
| 147 | - | ||
| 148 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-coqui-de-css10.tar.bz2 | ||
| 149 | -tar xvf vits-coqui-de-css10.tar.bz2 | ||
| 150 | -rm vits-coqui-de-css10.tar.bz2 | ||
| 151 | - | ||
| 152 | -node ./test_tts_non_streaming_vits_coqui_de.js | ||
| 153 | -rm -rf vits-coqui-de-css10 | ||
| 154 | - | ||
| 155 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/sherpa-onnx-vits-zh-ll.tar.bz2 | ||
| 156 | -tar xvf sherpa-onnx-vits-zh-ll.tar.bz2 | ||
| 157 | -rm sherpa-onnx-vits-zh-ll.tar.bz2 | ||
| 158 | - | ||
| 159 | -node ./test_tts_non_streaming_vits_zh_ll.js | ||
| 160 | -rm -rf sherpa-onnx-vits-zh-ll | ||
| 161 | - | ||
| 162 | -curl -SL -O https://github.com/k2-fsa/sherpa-onnx/releases/download/tts-models/vits-icefall-zh-aishell3.tar.bz2 | ||
| 163 | -tar xvf vits-icefall-zh-aishell3.tar.bz2 | ||
| 164 | -rm vits-icefall-zh-aishell3.tar.bz2 | ||
| 165 | - | ||
| 166 | -node ./test_tts_non_streaming_vits_zh_aishell3.js | ||
| 167 | -rm -rf vits-icefall-zh-aishell3 | ||
| 168 | 188 | ||
| 169 | ls -lh | 189 | ls -lh |
| @@ -108,6 +108,12 @@ jobs: | @@ -108,6 +108,12 @@ jobs: | ||
| 108 | shell: bash | 108 | shell: bash |
| 109 | run: | | 109 | run: | |
| 110 | ls -lh ./sherpa-onnx-node | 110 | ls -lh ./sherpa-onnx-node |
| 111 | + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node | ||
| 112 | + | ||
| 113 | + - uses: actions/upload-artifact@v4 | ||
| 114 | + with: | ||
| 115 | + name: sherpa-onnx-linux-x64 | ||
| 116 | + path: ./sherpa-onnx-node.tar.bz2 | ||
| 111 | 117 | ||
| 112 | - name: Publish | 118 | - name: Publish |
| 113 | shell: bash | 119 | shell: bash |
| @@ -102,6 +102,12 @@ jobs: | @@ -102,6 +102,12 @@ jobs: | ||
| 102 | shell: bash | 102 | shell: bash |
| 103 | run: | | 103 | run: | |
| 104 | ls -lh ./sherpa-onnx-node | 104 | ls -lh ./sherpa-onnx-node |
| 105 | + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node | ||
| 106 | + | ||
| 107 | + - uses: actions/upload-artifact@v4 | ||
| 108 | + with: | ||
| 109 | + name: sherpa-onnx-${{ matrix.os }} | ||
| 110 | + path: ./sherpa-onnx-node.tar.bz2 | ||
| 105 | 111 | ||
| 106 | - name: Publish | 112 | - name: Publish |
| 107 | shell: bash | 113 | shell: bash |
| @@ -20,7 +20,7 @@ jobs: | @@ -20,7 +20,7 @@ jobs: | ||
| 20 | strategy: | 20 | strategy: |
| 21 | fail-fast: false | 21 | fail-fast: false |
| 22 | matrix: | 22 | matrix: |
| 23 | - os: [windows-latest] | 23 | + os: [windows-2019] |
| 24 | python-version: ["3.8"] | 24 | python-version: ["3.8"] |
| 25 | 25 | ||
| 26 | steps: | 26 | steps: |
| @@ -54,6 +54,8 @@ jobs: | @@ -54,6 +54,8 @@ jobs: | ||
| 54 | -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ | 54 | -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ |
| 55 | -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ | 55 | -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ |
| 56 | -DSHERPA_ONNX_ENABLE_BINARY=OFF \ | 56 | -DSHERPA_ONNX_ENABLE_BINARY=OFF \ |
| 57 | + -DBUILD_ESPEAK_NG_EXE=OFF \ | ||
| 58 | + -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \ | ||
| 57 | .. | 59 | .. |
| 58 | 60 | ||
| 59 | ls -lh _deps/onnxruntime-src/lib/ | 61 | ls -lh _deps/onnxruntime-src/lib/ |
| @@ -65,6 +67,7 @@ jobs: | @@ -65,6 +67,7 @@ jobs: | ||
| 65 | echo "----------" | 67 | echo "----------" |
| 66 | 68 | ||
| 67 | cp -v _deps/onnxruntime-src/lib/*.lib ./install/lib | 69 | cp -v _deps/onnxruntime-src/lib/*.lib ./install/lib |
| 70 | + cp -v _deps/onnxruntime-src/lib/*.dll ./install/lib | ||
| 68 | 71 | ||
| 69 | echo "----------" | 72 | echo "----------" |
| 70 | 73 | ||
| @@ -100,6 +103,12 @@ jobs: | @@ -100,6 +103,12 @@ jobs: | ||
| 100 | shell: bash | 103 | shell: bash |
| 101 | run: | | 104 | run: | |
| 102 | ls -lh ./sherpa-onnx-node | 105 | ls -lh ./sherpa-onnx-node |
| 106 | + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node | ||
| 107 | + | ||
| 108 | + - uses: actions/upload-artifact@v4 | ||
| 109 | + with: | ||
| 110 | + name: sherpa-onnx-win-x64 | ||
| 111 | + path: ./sherpa-onnx-node.tar.bz2 | ||
| 103 | 112 | ||
| 104 | - name: Publish | 113 | - name: Publish |
| 105 | shell: bash | 114 | shell: bash |
.github/workflows/npm-addon-win-x86.yaml
0 → 100644
| 1 | +name: npm-addon-win-x86 | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + push: | ||
| 5 | + branches: | ||
| 6 | + - node-addon | ||
| 7 | + workflow_dispatch: | ||
| 8 | + | ||
| 9 | +concurrency: | ||
| 10 | + group: npm-addon-win-x86-${{ github.ref }} | ||
| 11 | + cancel-in-progress: true | ||
| 12 | + | ||
| 13 | +permissions: | ||
| 14 | + contents: read | ||
| 15 | + id-token: write | ||
| 16 | + | ||
| 17 | +jobs: | ||
| 18 | + build: | ||
| 19 | + runs-on: ${{ matrix.os }} | ||
| 20 | + strategy: | ||
| 21 | + fail-fast: false | ||
| 22 | + matrix: | ||
| 23 | + os: [windows-2019] | ||
| 24 | + python-version: ["3.8"] | ||
| 25 | + | ||
| 26 | + steps: | ||
| 27 | + - uses: actions/checkout@v4 | ||
| 28 | + with: | ||
| 29 | + fetch-depth: 0 | ||
| 30 | + | ||
| 31 | + - name: Setup Python ${{ matrix.python-version }} | ||
| 32 | + uses: actions/setup-python@v5 | ||
| 33 | + with: | ||
| 34 | + python-version: ${{ matrix.python-version }} | ||
| 35 | + | ||
| 36 | + - uses: actions/setup-node@v4 | ||
| 37 | + with: | ||
| 38 | + registry-url: 'https://registry.npmjs.org' | ||
| 39 | + architecture: 'x86' | ||
| 40 | + node-version: 16 | ||
| 41 | + | ||
| 42 | + - name: Display node version | ||
| 43 | + shell: bash | ||
| 44 | + run: | | ||
| 45 | + node --version | ||
| 46 | + | ||
| 47 | + - name: Show node-addon | ||
| 48 | + shell: bash | ||
| 49 | + run: | | ||
| 50 | + cd scripts/node-addon-api/ | ||
| 51 | + | ||
| 52 | + npm i || true | ||
| 53 | + cat node_modules/node-addon-api/package.json | ||
| 54 | + cd node_modules/ | ||
| 55 | + tar cjf node-addon-api.tar.bz2 ./node-addon-api | ||
| 56 | + | ||
| 57 | + - uses: actions/upload-artifact@v4 | ||
| 58 | + with: | ||
| 59 | + name: node-addon-api | ||
| 60 | + path: ./scripts/node-addon-api/node_modules/node-addon-api.tar.bz2 | ||
| 61 | + | ||
| 62 | + - name: Build sherpa-onnx | ||
| 63 | + shell: bash | ||
| 64 | + run: | | ||
| 65 | + mkdir build | ||
| 66 | + cd build | ||
| 67 | + cmake \ | ||
| 68 | + -A Win32 \ | ||
| 69 | + -DCMAKE_BUILD_TYPE=Release \ | ||
| 70 | + -DCMAKE_INSTALL_PREFIX=./install \ | ||
| 71 | + -DBUILD_SHARED_LIBS=ON \ | ||
| 72 | + -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \ | ||
| 73 | + -DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \ | ||
| 74 | + -DSHERPA_ONNX_ENABLE_BINARY=OFF \ | ||
| 75 | + -DBUILD_ESPEAK_NG_EXE=OFF \ | ||
| 76 | + -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \ | ||
| 77 | + .. | ||
| 78 | + | ||
| 79 | + ls -lh _deps/onnxruntime-src/lib/ | ||
| 80 | + | ||
| 81 | + cmake --build . --config Release --target install -- -m:6 | ||
| 82 | + | ||
| 83 | + ls -lh install/lib | ||
| 84 | + | ||
| 85 | + echo "----------" | ||
| 86 | + | ||
| 87 | + cp -v _deps/onnxruntime-src/lib/*.lib ./install/lib | ||
| 88 | + cp -v _deps/onnxruntime-src/lib/*.dll ./install/lib | ||
| 89 | + | ||
| 90 | + echo "----------" | ||
| 91 | + | ||
| 92 | + ls -lh install/lib | ||
| 93 | + | ||
| 94 | + - name: Build sherpa-onnx node-addon | ||
| 95 | + shell: bash | ||
| 96 | + run: | | ||
| 97 | + d=$PWD | ||
| 98 | + export SHERPA_ONNX_INSTALL_DIR=$d/build/install | ||
| 99 | + | ||
| 100 | + cd scripts/node-addon-api/ | ||
| 101 | + | ||
| 102 | + npm i | ||
| 103 | + | ||
| 104 | + npm config set cmake_js_A "Win32" | ||
| 105 | + ./node_modules/.bin/cmake-js compile -A Win32 --log-level verbose | ||
| 106 | + | ||
| 107 | + - name: Prepare for publish | ||
| 108 | + shell: bash | ||
| 109 | + run: | | ||
| 110 | + owner=${{ github.repository_owner }} | ||
| 111 | + export owner | ||
| 112 | + | ||
| 113 | + echo "---" | ||
| 114 | + ls -lh build/install/lib/ | ||
| 115 | + echo "---" | ||
| 116 | + ls -lh build/install/lib/ | ||
| 117 | + echo "---" | ||
| 118 | + | ||
| 119 | + .github/scripts/node-addon/run.sh | ||
| 120 | + | ||
| 121 | + - name: Display files to be published | ||
| 122 | + shell: bash | ||
| 123 | + run: | | ||
| 124 | + ls -lh ./sherpa-onnx-node | ||
| 125 | + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node | ||
| 126 | + | ||
| 127 | + - uses: actions/upload-artifact@v4 | ||
| 128 | + with: | ||
| 129 | + name: sherpa-onnx-win-ia32 | ||
| 130 | + path: ./sherpa-onnx-node.tar.bz2 | ||
| 131 | + | ||
| 132 | + upload: | ||
| 133 | + needs: [build] | ||
| 134 | + name: upload | ||
| 135 | + runs-on: ${{ matrix.os }} | ||
| 136 | + strategy: | ||
| 137 | + fail-fast: false | ||
| 138 | + matrix: | ||
| 139 | + os: [macos-latest] | ||
| 140 | + python-version: ["3.8"] | ||
| 141 | + | ||
| 142 | + steps: | ||
| 143 | + - uses: actions/checkout@v4 | ||
| 144 | + with: | ||
| 145 | + fetch-depth: 0 | ||
| 146 | + | ||
| 147 | + - uses: actions/setup-node@v4 | ||
| 148 | + with: | ||
| 149 | + registry-url: 'https://registry.npmjs.org' | ||
| 150 | + | ||
| 151 | + - name: Display node version | ||
| 152 | + shell: bash | ||
| 153 | + run: | | ||
| 154 | + node --version | ||
| 155 | + | ||
| 156 | + - name: Retrieve artifact | ||
| 157 | + uses: actions/download-artifact@v4 | ||
| 158 | + with: | ||
| 159 | + name: sherpa-onnx-win-ia32 | ||
| 160 | + path: /tmp/files/ | ||
| 161 | + | ||
| 162 | + - name: Unzip | ||
| 163 | + shell: bash | ||
| 164 | + run: | | ||
| 165 | + cd /tmp/files | ||
| 166 | + tar xvf sherpa-onnx-node.tar.bz2 | ||
| 167 | + | ||
| 168 | + - name: Publish | ||
| 169 | + shell: bash | ||
| 170 | + env: | ||
| 171 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN2 }} | ||
| 172 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN2 }} | ||
| 173 | + token: ${{ secrets.NPM_TOKEN2 }} | ||
| 174 | + run: | | ||
| 175 | + cd /tmp/files/sherpa-onnx-node | ||
| 176 | + npm publish --access public |
| @@ -55,7 +55,7 @@ jobs: | @@ -55,7 +55,7 @@ jobs: | ||
| 55 | 55 | ||
| 56 | SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | 56 | SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) |
| 57 | echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" | 57 | echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" |
| 58 | - # SHERPA_ONNX_VERSION=1.0.28 | 58 | + # SHERPA_ONNX_VERSION=1.0.30 |
| 59 | 59 | ||
| 60 | src_dir=.github/scripts/node-addon | 60 | src_dir=.github/scripts/node-addon |
| 61 | sed -i.bak s/SHERPA_ONNX_VERSION/$SHERPA_ONNX_VERSION/g $src_dir/package.json | 61 | sed -i.bak s/SHERPA_ONNX_VERSION/$SHERPA_ONNX_VERSION/g $src_dir/package.json |
| @@ -71,6 +71,12 @@ jobs: | @@ -71,6 +71,12 @@ jobs: | ||
| 71 | shell: bash | 71 | shell: bash |
| 72 | run: | | 72 | run: | |
| 73 | ls -lh ./sherpa-onnx-node | 73 | ls -lh ./sherpa-onnx-node |
| 74 | + tar cjvf ./sherpa-onnx-node.tar.bz2 ./sherpa-onnx-node | ||
| 75 | + | ||
| 76 | + - uses: actions/upload-artifact@v4 | ||
| 77 | + with: | ||
| 78 | + name: sherpa-onnx-node | ||
| 79 | + path: ./sherpa-onnx-node.tar.bz2 | ||
| 74 | 80 | ||
| 75 | - name: Publish | 81 | - name: Publish |
| 76 | shell: bash | 82 | shell: bash |
| 1 | +name: test-node-addon-npm-win-x86 | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + push: | ||
| 5 | + branches: | ||
| 6 | + - master | ||
| 7 | + paths: | ||
| 8 | + - '.github/workflows/test-nodejs-addon-npm-win-x86.yaml' | ||
| 9 | + - 'CMakeLists.txt' | ||
| 10 | + - 'cmake/**' | ||
| 11 | + - 'sherpa-onnx/csrc/*' | ||
| 12 | + - 'sherpa-onnx/c-api/*' | ||
| 13 | + - 'scripts/node-addon-api/**' | ||
| 14 | + - 'scripts/node-addon-api/*.js' | ||
| 15 | + - 'nodejs-addon-examples/package.json' | ||
| 16 | + - '.github/scripts/test-nodejs-addon-npm.sh' | ||
| 17 | + | ||
| 18 | + pull_request: | ||
| 19 | + branches: | ||
| 20 | + - master | ||
| 21 | + paths: | ||
| 22 | + - '.github/workflows/test-nodejs-addon-npm-win-x86.yaml' | ||
| 23 | + - 'CMakeLists.txt' | ||
| 24 | + - 'cmake/**' | ||
| 25 | + - 'sherpa-onnx/csrc/*' | ||
| 26 | + - 'sherpa-onnx/c-api/*' | ||
| 27 | + - 'scripts/node-addon-api/*.js' | ||
| 28 | + - 'nodejs-addon-examples/package.json' | ||
| 29 | + - '.github/scripts/test-nodejs-addon-npm.sh' | ||
| 30 | + | ||
| 31 | + workflow_dispatch: | ||
| 32 | + | ||
| 33 | +concurrency: | ||
| 34 | + group: test-node-addon-npm-win-x86-${{ github.ref }} | ||
| 35 | + cancel-in-progress: true | ||
| 36 | + | ||
| 37 | +permissions: | ||
| 38 | + contents: read | ||
| 39 | + | ||
| 40 | +jobs: | ||
| 41 | + test-node-addon-npm-win-x86: | ||
| 42 | + name: ${{ matrix.os }} node v${{ matrix.node-version }} | ||
| 43 | + runs-on: ${{ matrix.os }} | ||
| 44 | + strategy: | ||
| 45 | + fail-fast: false | ||
| 46 | + matrix: | ||
| 47 | + os: [windows-latest] | ||
| 48 | + node-version: ["16", "17", "18", "19", "21", "22"] | ||
| 49 | + | ||
| 50 | + steps: | ||
| 51 | + - uses: actions/checkout@v4 | ||
| 52 | + with: | ||
| 53 | + fetch-depth: 0 | ||
| 54 | + | ||
| 55 | + - uses: actions/setup-node@v4 | ||
| 56 | + with: | ||
| 57 | + registry-url: 'https://registry.npmjs.org' | ||
| 58 | + node-version: ${{ matrix.node-version }} | ||
| 59 | + architecture: 'x86' | ||
| 60 | + | ||
| 61 | + - name: Display node version | ||
| 62 | + shell: bash | ||
| 63 | + run: | | ||
| 64 | + node --version | ||
| 65 | + | ||
| 66 | + - name: Run tests | ||
| 67 | + shell: bash | ||
| 68 | + run: | | ||
| 69 | + d=nodejs-addon-examples | ||
| 70 | + echo "dir: $d" | ||
| 71 | + cd $d | ||
| 72 | + npm install --verbose | ||
| 73 | + git status | ||
| 74 | + ls -lh | ||
| 75 | + ls -lh node_modules | ||
| 76 | + | ||
| 77 | + export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-x64:$DYLD_LIBRARY_PATH | ||
| 78 | + export DYLD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-arm64:$DYLD_LIBRARY_PATH | ||
| 79 | + export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-x64:$DYLD_LIBRARY_PATH | ||
| 80 | + export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-darwin-arm64:$DYLD_LIBRARY_PATH | ||
| 81 | + export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-x64:$LD_LIBRARY_PATH | ||
| 82 | + export LD_LIBRARY_PATH=$PWD/node_modules/sherpa-onnx-linux-arm64:$LD_LIBRARY_PATH | ||
| 83 | + | ||
| 84 | + cd ../ | ||
| 85 | + | ||
| 86 | + .github/scripts/test-nodejs-addon-npm.sh |
| @@ -199,7 +199,7 @@ static Napi::Object AudioTaggingComputeWrapper(const Napi::CallbackInfo &info) { | @@ -199,7 +199,7 @@ static Napi::Object AudioTaggingComputeWrapper(const Napi::CallbackInfo &info) { | ||
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | Napi::Array ans = Napi::Array::New(env, k); | 201 | Napi::Array ans = Napi::Array::New(env, k); |
| 202 | - for (int32_t i = 0; i != k; ++i) { | 202 | + for (uint32_t i = 0; i != k; ++i) { |
| 203 | Napi::Object obj = Napi::Object::New(env); | 203 | Napi::Object obj = Napi::Object::New(env); |
| 204 | obj.Set(Napi::String::New(env, "name"), | 204 | obj.Set(Napi::String::New(env, "name"), |
| 205 | Napi::String::New(env, events[i]->name)); | 205 | Napi::String::New(env, events[i]->name)); |
| @@ -749,7 +749,7 @@ static Napi::Array SpeakerEmbeddingManagerGetAllSpeakersWrapper( | @@ -749,7 +749,7 @@ static Napi::Array SpeakerEmbeddingManagerGetAllSpeakersWrapper( | ||
| 749 | SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers(manager); | 749 | SherpaOnnxSpeakerEmbeddingManagerGetAllSpeakers(manager); |
| 750 | 750 | ||
| 751 | Napi::Array ans = Napi::Array::New(env, num_speakers); | 751 | Napi::Array ans = Napi::Array::New(env, num_speakers); |
| 752 | - for (int32_t i = 0; i != num_speakers; ++i) { | 752 | + for (uint32_t i = 0; i != num_speakers; ++i) { |
| 753 | ans[i] = Napi::String::New(env, all_speaker_names[i]); | 753 | ans[i] = Napi::String::New(env, all_speaker_names[i]); |
| 754 | } | 754 | } |
| 755 | SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers(all_speaker_names); | 755 | SherpaOnnxSpeakerEmbeddingManagerFreeAllSpeakers(all_speaker_names); |
-
请 注册 或 登录 后发表评论