-
Notifications
You must be signed in to change notification settings - Fork 424
195 lines (162 loc) · 4.9 KB
/
run-python-test.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
name: run-python-test
on:
push:
branches:
- master
paths:
- '.github/workflows/run-python-test.yaml'
- '.github/scripts/test-python.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
- 'python-api-examples/**'
pull_request:
branches:
- master
paths:
- '.github/workflows/run-python-test.yaml'
- '.github/scripts/test-python.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
- 'python-api-examples/**'
workflow_dispatch:
concurrency:
group: run-python-test-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
run-python-test:
name: ${{ matrix.os }} ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# it fails to install ffmpeg on ubuntu 20.04
#
# - os: ubuntu-20.04
# python-version: "3.7"
# - os: ubuntu-20.04
# python-version: "3.8"
# - os: ubuntu-20.04
# python-version: "3.9"
- os: ubuntu-22.04
python-version: "3.10"
- os: ubuntu-22.04
python-version: "3.11"
- os: ubuntu-22.04
python-version: "3.12"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Display OS version
shell: bash
run: |
uname -a
find "/etc" -maxdepth 1 -type f -name "*version" -exec head -n 100 {} \;
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-python-${{ matrix.python-version }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
shell: bash
run: |
python3 -m pip install --upgrade pip numpy pypinyin sentencepiece>=0.1.96 soundfile
python3 -m pip install wheel twine setuptools
- name: Install ffmpeg
shell: bash
run: |
sudo apt-get install ffmpeg
- name: Install ninja
shell: bash
run: |
sudo apt-get install ninja-build
- name: Display ninja version
shell: bash
run: |
ninja --version
ninja --help || true
which ninja
- name: Display site packages dir
shell: bash
run: |
python3 -c 'import site; print(site.getsitepackages())'
p=$(python3 -c 'import site; print(site.getsitepackages())')
echo "p: $p"
- name: Install patchelf
shell: bash
run: |
sudo apt-get update -q
sudo apt-get install -q -y patchelf
patchelf --help
- name: Build sherpa-onnx
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --version
export SHERPA_ONNX_CMAKE_ARGS="-G Ninja -DCMAKE_BUILD_TYPE=Release"
export SHERPA_ONNX_MAKE_ARGS="-j 6"
python3 setup.py bdist_wheel
- name: Patch wheels
shell: bash
run: |
mkdir ./dist2
sudo ./scripts/wheel/patch_wheel.py --in-dir ./dist --out-dir ./dist2
- name: Install sherpa-onnx
shell: bash
run: |
ls -lh dist2
python3 -m pip install ./dist2/*.whl
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}-whl
path: ./dist
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}-whl-patched
path: ./dist2
- name: Show dependencies
shell: bash
run: |
cd dist
mkdir t
cd t
unzip ../*.whl
readelf -d _sherpa_onnx*.so
echo "----"
readelf -d sherpa_onnx-*.data/data/bin/sherpa-onnx
- name: Show dependencies (patched)
shell: bash
run: |
cd dist2
mkdir t
cd t
unzip ../*.whl
readelf -d _sherpa_onnx*.so
echo "----"
readelf -d sherpa_onnx-*.data/data/bin/sherpa-onnx
- name: Test sherpa-onnx
shell: bash
run: |
export OS=${{ matrix.os }}
p=$(python3 -c 'import site; print(site.getsitepackages()[0])')
echo "p: $p"
p=$p/sherpa_onnx/lib
echo "p: $p"
ls -lh $p
export LD_LIBRARY_PATH=$p:$LD_LIBRARY_PATH
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
.github/scripts/test-python.sh
.github/scripts/test-speaker-recognition-python.sh
- uses: actions/upload-artifact@v4
with:
name: tts-generated-test-files-${{ matrix.os }}-${{ matrix.python-version }}
path: tts