Fangjun Kuang
Committed by GitHub

Use manylinux in CI test (#692)

@@ -179,7 +179,7 @@ jobs: @@ -179,7 +179,7 @@ jobs:
179 179
180 # https://huggingface.co/docs/hub/spaces-github-actions 180 # https://huggingface.co/docs/hub/spaces-github-actions
181 - name: Publish to huggingface 181 - name: Publish to huggingface
182 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch') 182 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
183 env: 183 env:
184 HF_TOKEN: ${{ secrets.HF_TOKEN }} 184 HF_TOKEN: ${{ secrets.HF_TOKEN }}
185 uses: nick-fields/retry@v3 185 uses: nick-fields/retry@v3
@@ -170,7 +170,7 @@ jobs: @@ -170,7 +170,7 @@ jobs:
170 170
171 # https://huggingface.co/docs/hub/spaces-github-actions 171 # https://huggingface.co/docs/hub/spaces-github-actions
172 - name: Publish to huggingface 172 - name: Publish to huggingface
173 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch') 173 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
174 env: 174 env:
175 HF_TOKEN: ${{ secrets.HF_TOKEN }} 175 HF_TOKEN: ${{ secrets.HF_TOKEN }}
176 uses: nick-fields/retry@v3 176 uses: nick-fields/retry@v3
@@ -101,28 +101,33 @@ jobs: @@ -101,28 +101,33 @@ jobs:
101 101
102 # https://huggingface.co/docs/hub/spaces-github-actions 102 # https://huggingface.co/docs/hub/spaces-github-actions
103 - name: Publish to huggingface 103 - name: Publish to huggingface
104 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch') 104 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
105 env: 105 env:
106 HF_TOKEN: ${{ secrets.HF_TOKEN }} 106 HF_TOKEN: ${{ secrets.HF_TOKEN }}
107 - run: |  
108 - git config --global user.email "csukuangfj@gmail.com"  
109 - git config --global user.name "Fangjun Kuang" 107 + uses: nick-fields/retry@v3
  108 + with:
  109 + max_attempts: 20
  110 + timeout_seconds: 200
  111 + shell: bash
  112 + command: |
  113 + git config --global user.email "csukuangfj@gmail.com"
  114 + git config --global user.name "Fangjun Kuang"
110 115
111 - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface 116 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
112 117
113 - cd huggingface  
114 - git lfs pull 118 + cd huggingface
  119 + git lfs pull
115 120
116 - cp -v ../sherpa-onnx-*-android.tar.bz2 ./ 121 + cp -v ../sherpa-onnx-*-android.tar.bz2 ./
117 122
118 - git status  
119 - git lfs track "*.bz2" 123 + git status
  124 + git lfs track "*.bz2"
120 125
121 - git add . 126 + git add .
122 127
123 - git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-android.tar.bz2" 128 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-android.tar.bz2"
124 129
125 - git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main 130 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
126 131
127 - name: Release android libs 132 - name: Release android libs
128 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 133 if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
@@ -193,7 +193,7 @@ jobs: @@ -193,7 +193,7 @@ jobs:
193 193
194 # https://huggingface.co/docs/hub/spaces-github-actions 194 # https://huggingface.co/docs/hub/spaces-github-actions
195 - name: Publish to huggingface 195 - name: Publish to huggingface
196 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch') 196 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
197 env: 197 env:
198 HF_TOKEN: ${{ secrets.HF_TOKEN }} 198 HF_TOKEN: ${{ secrets.HF_TOKEN }}
199 uses: nick-fields/retry@v3 199 uses: nick-fields/retry@v3
@@ -78,31 +78,36 @@ jobs: @@ -78,31 +78,36 @@ jobs:
78 78
79 # https://huggingface.co/docs/hub/spaces-github-actions 79 # https://huggingface.co/docs/hub/spaces-github-actions
80 - name: Publish to huggingface 80 - name: Publish to huggingface
81 - if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 81 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
82 env: 82 env:
83 HF_TOKEN: ${{ secrets.HF_TOKEN }} 83 HF_TOKEN: ${{ secrets.HF_TOKEN }}
84 - run: |  
85 - git config --global user.email "csukuangfj@gmail.com"  
86 - git config --global user.name "Fangjun Kuang" 84 + uses: nick-fields/retry@v3
  85 + with:
  86 + max_attempts: 20
  87 + timeout_seconds: 200
  88 + shell: bash
  89 + command: |
  90 + git config --global user.email "csukuangfj@gmail.com"
  91 + git config --global user.name "Fangjun Kuang"
87 92
88 - GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface 93 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
89 94
90 - cd huggingface  
91 - git lfs pull 95 + cd huggingface
  96 + git lfs pull
92 97
93 - cp -v ../sherpa-onnx-*-ios.tar.bz2 ./ 98 + cp -v ../sherpa-onnx-*-ios.tar.bz2 ./
94 99
95 - git status  
96 - git lfs track "*.bz2" 100 + git status
  101 + git lfs track "*.bz2"
97 102
98 - git add . 103 + git add .
99 104
100 - git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-ios.tar.bz2" 105 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-ios.tar.bz2"
101 106
102 - git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main 107 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
103 108
104 - name: Release xcframework 109 - name: Release xcframework
105 - if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') 110 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
106 uses: svenstaro/upload-release-action@v2 111 uses: svenstaro/upload-release-action@v2
107 with: 112 with:
108 file_glob: true 113 file_glob: true
@@ -45,77 +45,66 @@ concurrency: @@ -45,77 +45,66 @@ concurrency:
45 45
46 jobs: 46 jobs:
47 linux: 47 linux:
48 - name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.shared_lib }} ${{ matrix.gcc_version }} 48 + name: ${{ matrix.build_type }} ${{ matrix.shared_lib }}
49 runs-on: ${{ matrix.os }} 49 runs-on: ${{ matrix.os }}
50 strategy: 50 strategy:
51 fail-fast: false 51 fail-fast: false
52 matrix: 52 matrix:
53 - os: [ubuntu-20.04, ubuntu-22.04] 53 + os: [ubuntu-latest]
54 build_type: [Release, Debug] 54 build_type: [Release, Debug]
55 shared_lib: [ON, OFF] 55 shared_lib: [ON, OFF]
56 - # see https://github.com/egor-tensin/setup-gcc  
57 - # 7-11 for ubuntu 20.04  
58 - # 9-12 for ubuntu 22.04  
59 - gcc_version: ["7", "8", "9", "10", "11", "12", "13"]  
60 - exclude:  
61 - - os: ubuntu-20.04  
62 - gcc_version: "12"  
63 - - os: ubuntu-22.04  
64 - gcc_version: "7"  
65 - - os: ubuntu-22.04  
66 - gcc_version: "8"  
67 56
68 steps: 57 steps:
69 - uses: actions/checkout@v4 58 - uses: actions/checkout@v4
70 with: 59 with:
71 fetch-depth: 0 60 fetch-depth: 0
72 61
73 - - name: Set up GCC ${{ matrix.gcc_version }}  
74 - uses: egor-tensin/setup-gcc@v1  
75 - with:  
76 - version: ${{ matrix.gcc_version }}  
77 - platform: x64  
78 -  
79 - - name: Display gcc version ${{ matrix.gcc_version }} 62 + - name: Display PWD
80 shell: bash 63 shell: bash
81 run: | 64 run: |
82 - which gcc  
83 - gcc --version  
84 -  
85 - which g++  
86 - g++ --version 65 + echo "pwd: $PWD"
  66 + ls -lh
87 67
88 - - name: ccache  
89 - uses: hendrikmuhs/ccache-action@v1.2 68 + - name: Build sherpa-onnx
  69 + uses: addnab/docker-run-action@v3
90 with: 70 with:
91 - key: ${{ matrix.os }}-${{ matrix.build_type }}-shared-${{ matrix.shared_lib }}-gcc-${{ matrix.gcc_version }} 71 + image: quay.io/pypa/manylinux2014_x86_64
  72 + options: |
  73 + --volume ${{ github.workspace }}/:/home/runner/work/sherpa-onnx/sherpa-onnx
  74 + shell: bash
  75 + run: |
  76 + uname -a
  77 + gcc --version
  78 + cmake --version
  79 + cat /etc/*release
  80 + id
  81 + pwd
92 82
93 - - name: Configure CMake  
94 - shell: bash  
95 - run: |  
96 - export CMAKE_CXX_COMPILER_LAUNCHER=ccache  
97 - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"  
98 - cmake --version 83 + cd /home/runner/work/sherpa-onnx/sherpa-onnx
99 84
100 - mkdir build  
101 - cd build  
102 - cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install .. 85 + git clone --depth 1 https://github.com/alsa-project/alsa-lib
  86 + pushd alsa-lib
  87 + ./gitcompile
  88 + popd
103 89
104 - - name: Build sherpa-onnx for ubuntu  
105 - shell: bash  
106 - run: |  
107 - export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" 90 + export CPLUS_INCLUDE_PATH=$PWD/alsa-lib/include:$CPLUS_INCLUDE_PATH
  91 + export SHERPA_ONNX_ALSA_LIB_DIR=$PWD/alsa-lib/src/.libs
  92 +
  93 + mkdir build
  94 + cd build
108 95
109 - cd build  
110 - make -j2  
111 - make install 96 + cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=${{ matrix.shared_lib }} -DCMAKE_INSTALL_PREFIX=./install ..
112 97
113 - ls -lh lib  
114 - ls -lh bin 98 + make -j2
  99 + make install
  100 +
  101 + ls -lh lib
  102 + ls -lh bin
115 103
116 - name: Display dependencies of sherpa-onnx for linux 104 - name: Display dependencies of sherpa-onnx for linux
117 shell: bash 105 shell: bash
118 run: | 106 run: |
  107 + sudo chown -R $USER ./build
119 ls -lh build/bin 108 ls -lh build/bin
120 ls -lh build/_deps/onnxruntime-src/lib/ 109 ls -lh build/_deps/onnxruntime-src/lib/
121 110
@@ -130,9 +119,8 @@ jobs: @@ -130,9 +119,8 @@ jobs:
130 readelf -d build/bin/sherpa-onnx 119 readelf -d build/bin/sherpa-onnx
131 120
132 - uses: actions/upload-artifact@v4 121 - uses: actions/upload-artifact@v4
133 - if: matrix.shared_lib == 'OFF' && matrix.build_type == 'Release'  
134 with: 122 with:
135 - name: release-static-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.shared_lib }}-${{ matrix.gcc_version }} 123 + name: release-${{ matrix.build_type }}-${{ matrix.shared_lib }}
136 path: build/bin/* 124 path: build/bin/*
137 125
138 - name: Test transducer kws 126 - name: Test transducer kws
@@ -211,10 +199,17 @@ jobs: @@ -211,10 +199,17 @@ jobs:
211 199
212 - name: Copy files 200 - name: Copy files
213 shell: bash 201 shell: bash
  202 + if: matrix.build_type == 'Release'
214 run: | 203 run: |
215 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) 204 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
216 205
217 - dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-x64 206 + if [[ ${{ matrix.shared_lib }} == 'ON' ]]; then
  207 + suffix=shared
  208 + else
  209 + suffix=static
  210 + fi
  211 +
  212 + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-x64-$suffix
218 mkdir $dst 213 mkdir $dst
219 214
220 cp -a build/install/bin $dst/ 215 cp -a build/install/bin $dst/
@@ -225,16 +220,46 @@ jobs: @@ -225,16 +220,46 @@ jobs:
225 220
226 tar cjvf ${dst}.tar.bz2 $dst 221 tar cjvf ${dst}.tar.bz2 $dst
227 222
  223 + - name: Publish to huggingface
  224 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && matrix.build_type == 'Release'
  225 + env:
  226 + HF_TOKEN: ${{ secrets.HF_TOKEN }}
  227 + uses: nick-fields/retry@v3
  228 + with:
  229 + max_attempts: 20
  230 + timeout_seconds: 200
  231 + shell: bash
  232 + command: |
  233 + git config --global user.email "csukuangfj@gmail.com"
  234 + git config --global user.name "Fangjun Kuang"
  235 +
  236 + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
  237 +
  238 + cd huggingface
  239 + git lfs pull
  240 + mkdir -p linux-x64
  241 +
  242 + cp -v ../sherpa-onnx-*.tar.bz2 ./linux-x64
  243 +
  244 + git status
  245 + git lfs track "*.bz2"
  246 +
  247 + git add .
  248 +
  249 + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}"
  250 +
  251 + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
  252 +
228 - name: Release pre-compiled binaries and libs for linux x64 253 - name: Release pre-compiled binaries and libs for linux x64
229 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-20.04' && matrix.gcc_version == '7' 254 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
230 uses: svenstaro/upload-release-action@v2 255 uses: svenstaro/upload-release-action@v2
231 with: 256 with:
232 file_glob: true 257 file_glob: true
233 overwrite: true 258 overwrite: true
234 - file: sherpa-onnx-*linux-x64.tar.bz2 259 + file: sherpa-onnx-*.tar.bz2
235 260
236 - uses: actions/upload-artifact@v4 261 - uses: actions/upload-artifact@v4
237 with: 262 with:
238 - name: tts-generated-test-files-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.shared_lib }}-${{ matrix.gcc_version }} 263 + name: tts-generated-test-files-${{ matrix.build_type }}-${{ matrix.shared_lib }}
239 path: tts 264 path: tts
240 265
@@ -225,7 +225,7 @@ jobs: @@ -225,7 +225,7 @@ jobs:
225 225
226 # https://huggingface.co/docs/hub/spaces-github-actions 226 # https://huggingface.co/docs/hub/spaces-github-actions
227 - name: Publish to huggingface 227 - name: Publish to huggingface
228 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch') 228 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
229 env: 229 env:
230 HF_TOKEN: ${{ secrets.HF_TOKEN }} 230 HF_TOKEN: ${{ secrets.HF_TOKEN }}
231 uses: nick-fields/retry@v3 231 uses: nick-fields/retry@v3
@@ -154,7 +154,7 @@ jobs: @@ -154,7 +154,7 @@ jobs:
154 154
155 # https://huggingface.co/docs/hub/spaces-github-actions 155 # https://huggingface.co/docs/hub/spaces-github-actions
156 - name: Publish to huggingface 156 - name: Publish to huggingface
157 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch') 157 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
158 env: 158 env:
159 HF_TOKEN: ${{ secrets.HF_TOKEN }} 159 HF_TOKEN: ${{ secrets.HF_TOKEN }}
160 uses: nick-fields/retry@v3 160 uses: nick-fields/retry@v3
@@ -157,7 +157,7 @@ jobs: @@ -157,7 +157,7 @@ jobs:
157 157
158 # https://huggingface.co/docs/hub/spaces-github-actions 158 # https://huggingface.co/docs/hub/spaces-github-actions
159 - name: Publish to huggingface 159 - name: Publish to huggingface
160 - if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' && github.event_name == 'workflow_dispatch') 160 + if: (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
161 env: 161 env:
162 HF_TOKEN: ${{ secrets.HF_TOKEN }} 162 HF_TOKEN: ${{ secrets.HF_TOKEN }}
163 uses: nick-fields/retry@v3 163 uses: nick-fields/retry@v3
1 cmake_minimum_required(VERSION 3.13 FATAL_ERROR) 1 cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
2 project(sherpa-onnx) 2 project(sherpa-onnx)
3 3
4 -set(SHERPA_ONNX_VERSION "1.9.12") 4 +set(SHERPA_ONNX_VERSION "1.9.13")
5 5
6 # Disable warning about 6 # Disable warning about
7 # 7 #