-
Notifications
You must be signed in to change notification settings - Fork 445
122 lines (103 loc) · 2.84 KB
/
test-nodejs.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
name: test-nodejs
on:
push:
branches:
- master
paths:
- '.github/workflows/test-nodejs.yaml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
- 'sherpa-onnx/c-api/*'
- 'scripts/nodejs/**'
- 'nodejs-examples/**'
pull_request:
branches:
- master
paths:
- '.github/workflows/test-nodejs.yaml'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
- 'sherpa-onnx/c-api/*'
- '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-2019]
python-version: ["3.8"]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-${{ matrix.build_type }}-wasm-nodejs
- name: Install emsdk
uses: mymindstorm/setup-emsdk@v14
with:
version: 3.1.51
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
popd
./.github/scripts/test-nodejs-npm.sh