diff --git a/.github/workflows/aarch64-linux-gnu.yaml b/.github/workflows/aarch64-linux-gnu.yaml index bf68568a..f6814f76 100644 --- a/.github/workflows/aarch64-linux-gnu.yaml +++ b/.github/workflows/aarch64-linux-gnu.yaml @@ -5,6 +5,8 @@ on: push: branches: - master + tags: + - '*' paths: - '.github/workflows/aarch64-linux-gnu.yaml' - 'CMakeLists.txt' @@ -20,14 +22,25 @@ on: - 'cmake/**' - 'sherpa-onnx/csrc/*' - 'toolchains/aarch64-linux-gnu.toolchain.cmake' + release: + types: + - published + + workflow_dispatch: + inputs: + release: + description: "Whether to release" + type: boolean + +env: + RELEASE: + |- # Release if there is a release tag name or a release flag in workflow_dispatch + ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }} concurrency: group: aarch64-linux-gnu-${{ github.ref }} cancel-in-progress: true -permissions: - contents: read - jobs: aarch64_linux_gnu: runs-on: ${{ matrix.os }} @@ -118,7 +131,31 @@ jobs: export PATH=$GITHUB_WORKSPACE/qemu-install/bin:$PATH export QEMU_LD_PREFIX=$GITHUB_WORKSPACE/toolchain/aarch64-linux-gnu/libc - ls -lh ./build-aarch64-linux-gnu/bin qemu-aarch64 ./build-aarch64-linux-gnu/bin/sherpa-onnx --help + + - name: Copy files + if: env.RELEASE == 'true' + shell: bash + run: | + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) + + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-aarch64 + mkdir $dst + + cp -a build-aarch64-linux-gnu/install/bin $dst/ + cp -a build-aarch64-linux-gnu/install/lib $dst/ + cp -a build-aarch64-linux-gnu/install/include $dst/ + + tree $dst + + tar cjvf ${dst}.tar.bz2 $dst + + - name: Release pre-compiled binaries and libs for aarch64 linux + if: env.RELEASE == 'true' + uses: svenstaro/upload-release-action@v2 + with: + file_glob: true + overwrite: true + file: sherpa-onnx-*linux-aarch64.tar.bz2 diff --git a/.github/workflows/arm-linux-gnueabihf.yaml b/.github/workflows/arm-linux-gnueabihf.yaml index 0e1d4c32..7cab7ffe 100644 --- a/.github/workflows/arm-linux-gnueabihf.yaml +++ b/.github/workflows/arm-linux-gnueabihf.yaml @@ -20,14 +20,25 @@ on: - 'cmake/**' - 'sherpa-onnx/csrc/*' - 'toolchains/arm-linux-gnueabihf.toolchain.cmake' + release: + types: + - published + + workflow_dispatch: + inputs: + release: + description: "Whether to release" + type: boolean + +env: + RELEASE: + |- # Release if there is a release tag name or a release flag in workflow_dispatch + ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }} concurrency: group: arm-linux-gnueabihf-${{ github.ref }} cancel-in-progress: true -permissions: - contents: read - jobs: arm_linux_gnueabihf: runs-on: ${{ matrix.os }} @@ -124,3 +135,28 @@ jobs: ls -lh ./build-arm-linux-gnueabihf/bin qemu-arm ./build-arm-linux-gnueabihf/bin/sherpa-onnx --help + + - name: Copy files + if: env.RELEASE == 'true' + shell: bash + run: | + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) + + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-arm-gnueabihf + mkdir $dst + + cp -a build-arm-linux-gnueabihf/install/bin $dst/ + cp -a build-arm-linux-gnueabihf/install/lib $dst/ + cp -a build-arm-linux-gnueabihf/install/include $dst/ + + tree $dst + + tar cjvf ${dst}.tar.bz2 $dst + + - name: Release pre-compiled binaries and libs for arm linux gnueabihf + if: env.RELEASE == 'true' + uses: svenstaro/upload-release-action@v2 + with: + file_glob: true + overwrite: true + file: sherpa-onnx-*linux-arm-gnueabihf.tar.bz2 diff --git a/.github/workflows/build-xcframework.yaml b/.github/workflows/build-xcframework.yaml index fe9ff43e..576b2d08 100644 --- a/.github/workflows/build-xcframework.yaml +++ b/.github/workflows/build-xcframework.yaml @@ -9,8 +9,20 @@ on: - './build-ios.sh' tags: - '*' + release: + types: + - published workflow_dispatch: + inputs: + release: + description: "Whether to release" + type: boolean + +env: + RELEASE: + |- # Release if there is a release tag name or a release flag in workflow_dispatch + ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }} concurrency: group: build-xcframework-${{ github.ref }} @@ -51,7 +63,7 @@ jobs: tree build-ios - filename=sherpa-onnx-${SHERPA_ONNX_VERSION}-pre-compiled-ios-libs.tar.bz2 + filename=sherpa-onnx-${SHERPA_ONNX_VERSION}-ios.tar.bz2 tar cjvf $filename ./build-ios @@ -59,12 +71,12 @@ jobs: - uses: actions/upload-artifact@v2 with: - name: sherpa-onnx-pre-compiled-ios-libs + name: sherpa-onnx-ios-libs path: ./build-ios # https://huggingface.co/docs/hub/spaces-github-actions - name: Publish to huggingface - if: ${{ github.repository_owner == 'csukuangfj' }} || ${{ github.repository_owner == 'k2-fsa' }} + if: github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | @@ -76,13 +88,21 @@ jobs: cd huggingface git lfs pull - cp -v ../sherpa-onnx-*-pre-compiled-ios-libs.tar.bz2 ./ + cp -v ../sherpa-onnx-*-ios.tar.bz2 ./ git status git lfs track "*.bz2" git add . - git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-pre-compiled-ios-libs.tar.bz2" + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-ios.tar.bz2" git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main + + - name: Release xcframework + if: env.RELEASE == 'true' + uses: svenstaro/upload-release-action@v2 + with: + file_glob: true + overwrite: true + file: sherpa-onnx-*-ios.tar.bz2 diff --git a/.github/workflows/dot-net.yaml b/.github/workflows/dot-net.yaml index 12816515..fd345a0f 100644 --- a/.github/workflows/dot-net.yaml +++ b/.github/workflows/dot-net.yaml @@ -6,6 +6,20 @@ on: - dot-net tags: - '*' + release: + types: + - published + + workflow_dispatch: + inputs: + release: + description: "Whether to release" + type: boolean + +env: + RELEASE: + |- # Release if there is a release tag name or a release flag in workflow_dispatch + ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }} concurrency: group: dot-net-${{ github.ref }} @@ -133,3 +147,11 @@ jobs: # API_KEY is valid until 2024.05.02 cd scripts/dotnet/packages dotnet nuget push ./org.k2fsa.sherpa.onnx.*.nupkg --skip-duplicate --api-key $API_KEY --source https://api.nuget.org/v3/index.json + + - name: Release nuget packages + if: env.RELEASE == 'true' + uses: svenstaro/upload-release-action@v2 + with: + file_glob: true + overwrite: true + file: scripts/dotnet/packages/*.nupkg diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index a328616e..0b8036ea 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -4,6 +4,8 @@ on: push: branches: - master + tags: + - '*' paths: - '.github/workflows/linux.yaml' - '.github/scripts/test-online-transducer.sh' @@ -26,14 +28,25 @@ on: - 'cmake/**' - 'sherpa-onnx/csrc/*' - 'sherpa-onnx/c-api/*' + release: + types: + - published + + workflow_dispatch: + inputs: + release: + description: "Whether to release" + type: boolean + +env: + RELEASE: + |- # Release if there is a release tag name or a release flag in workflow_dispatch + ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }} concurrency: group: linux-${{ github.ref }} cancel-in-progress: true -permissions: - contents: read - jobs: linux: runs-on: ${{ matrix.os }} @@ -53,13 +66,14 @@ jobs: run: | mkdir build cd build - cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} .. + cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install .. - name: Build sherpa-onnx for ubuntu shell: bash run: | cd build make -j2 + make install ls -lh lib ls -lh bin @@ -101,3 +115,28 @@ jobs: export EXE=decode-file-c-api .github/scripts/test-online-transducer.sh + + - name: Copy files + if: env.RELEASE == 'true' + shell: bash + run: | + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) + + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-linux-x64 + mkdir $dst + + cp -a build/install/bin $dst/ + cp -a build/install/lib $dst/ + cp -a build/install/include $dst/ + + tree $dst + + tar cjvf ${dst}.tar.bz2 $dst + + - name: Release pre-compiled binaries and libs for linux x64 + if: env.RELEASE == 'true' && matrix.build_type == 'Release' + uses: svenstaro/upload-release-action@v2 + with: + file_glob: true + overwrite: true + file: sherpa-onnx-*linux-x64.tar.bz2 diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 0967290b..37b27f93 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -23,14 +23,25 @@ on: - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' + release: + types: + - published + + workflow_dispatch: + inputs: + release: + description: "Whether to release" + type: boolean + +env: + RELEASE: + |- # Release if there is a release tag name or a release flag in workflow_dispatch + ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }} concurrency: group: macos-${{ github.ref }} cancel-in-progress: true -permissions: - contents: read - jobs: macos: runs-on: ${{ matrix.os }} @@ -50,17 +61,19 @@ jobs: run: | mkdir build cd build - cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} .. + cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_INSTALL_PREFIX=./install .. - name: Build sherpa-onnx for macos shell: bash run: | cd build make -j2 + make install ls -lh lib ls -lh bin + file ./bin/sherpa-onnx - name: Display dependencies of sherpa-onnx for macos shell: bash @@ -100,3 +113,28 @@ jobs: export EXE=decode-file-c-api .github/scripts/test-online-transducer.sh + + - name: Copy files + if: env.RELEASE == 'true' + shell: bash + run: | + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) + + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-osx-universal2 + mkdir $dst + + cp -a build/install/bin $dst/ + cp -a build/install/lib $dst/ + cp -a build/install/include $dst/ + + tree $dst + + tar cjvf ${dst}.tar.bz2 $dst + + - name: Release pre-compiled binaries and libs for macOS + if: env.RELEASE == 'true' && matrix.build_type == 'Release' + uses: svenstaro/upload-release-action@v2 + with: + file_glob: true + overwrite: true + file: sherpa-onnx-*osx-universal2.tar.bz2 diff --git a/.github/workflows/test-dot-net.yaml b/.github/workflows/test-dot-net.yaml index 2118d6c9..75d7cc88 100644 --- a/.github/workflows/test-dot-net.yaml +++ b/.github/workflows/test-dot-net.yaml @@ -15,6 +15,8 @@ on: - '.github/workflows/test-dot-net' - 'dotnet-examples/**' + workflow_dispatch: + schedule: # minute (0-59) # hour (0-23) diff --git a/.github/workflows/windows-x64.yaml b/.github/workflows/windows-x64.yaml index 225ab514..fcf87950 100644 --- a/.github/workflows/windows-x64.yaml +++ b/.github/workflows/windows-x64.yaml @@ -4,6 +4,8 @@ on: push: branches: - master + tags: + - '*' paths: - '.github/workflows/windows-x64.yaml' - '.github/scripts/test-online-transducer.sh' @@ -23,14 +25,25 @@ on: - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' + release: + types: + - published + + workflow_dispatch: + inputs: + release: + description: "Whether to release" + type: boolean + +env: + RELEASE: + |- # Release if there is a release tag name or a release flag in workflow_dispatch + ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }} concurrency: group: windows-x64-${{ github.ref }} cancel-in-progress: true -permissions: - contents: read - jobs: windows_x64: runs-on: ${{ matrix.os }} @@ -65,13 +78,14 @@ jobs: run: | mkdir build cd build - cmake -T ${{ matrix.toolset-version}},host=x64 -A x64 -D CMAKE_BUILD_TYPE=Release .. + cmake -T ${{ matrix.toolset-version}},host=x64 -A x64 -D CMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./install .. - name: Build sherpa-onnx for windows shell: bash run: | cd build cmake --build . --config Release -- -m:2 + cmake --build . --config Release --target install -- -m:2 ls -lh ./bin/Release/sherpa-onnx.exe @@ -106,3 +120,26 @@ jobs: export EXE=decode-file-c-api.exe .github/scripts/test-online-transducer.sh + + - name: Copy files + if: env.RELEASE == 'true' && matrix.vs-version == 'vs2015' + shell: bash + run: | + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) + + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x64 + mkdir $dst + + cp -a build/install/bin $dst/ + cp -a build/install/lib $dst/ + cp -a build/install/include $dst/ + + tar cjvf ${dst}.tar.bz2 $dst + + - name: Release pre-compiled binaries and libs for macOS + if: env.RELEASE == 'true' && matrix.vs-version == 'vs2015' + uses: svenstaro/upload-release-action@v2 + with: + file_glob: true + overwrite: true + file: sherpa-onnx-*-win-x64.tar.bz2 diff --git a/.github/workflows/windows-x86.yaml b/.github/workflows/windows-x86.yaml index 6ed029ca..38425d32 100644 --- a/.github/workflows/windows-x86.yaml +++ b/.github/workflows/windows-x86.yaml @@ -23,17 +23,28 @@ on: - 'CMakeLists.txt' - 'cmake/**' - 'sherpa-onnx/csrc/*' + release: + types: + - published + + workflow_dispatch: + inputs: + release: + description: "Whether to release" + type: boolean + +env: + RELEASE: + |- # Release if there is a release tag name or a release flag in workflow_dispatch + ${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }} concurrency: group: windows-x86-${{ github.ref }} cancel-in-progress: true -permissions: - contents: read - jobs: windows_x86: - if: false # disable windows x86 CI for now + if: true # disable windows x86 CI for now runs-on: ${{ matrix.os }} name: ${{ matrix.vs-version }} strategy: @@ -66,13 +77,14 @@ jobs: run: | mkdir build cd build - cmake -T ${{ matrix.toolset-version}},host=x64 -A Win32 -D CMAKE_BUILD_TYPE=Release .. + cmake -T ${{ matrix.toolset-version}},host=x64 -A Win32 -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=./install .. - name: Build sherpa-onnx for windows shell: bash run: | cd build cmake --build . --config Release -- -m:2 + cmake --build . --config Release --target install -- -m:2 ls -lh ./bin/Release/sherpa-onnx.exe @@ -84,13 +96,13 @@ jobs: .github/scripts/test-offline-ctc.sh - - name: Test offline transducer for Windows x86 - shell: bash - run: | - export PATH=$PWD/build/bin/Release:$PATH - export EXE=sherpa-onnx-offline.exe - - .github/scripts/test-offline-transducer.sh + # - name: Test offline transducer for Windows x86 + # shell: bash + # run: | + # export PATH=$PWD/build/bin/Release:$PATH + # export EXE=sherpa-onnx-offline.exe + # + # .github/scripts/test-offline-transducer.sh - name: Test online transducer for Windows x86 shell: bash @@ -107,3 +119,26 @@ jobs: export EXE=decode-file-c-api.exe .github/scripts/test-online-transducer.sh + + - name: Copy files + if: env.RELEASE == 'true' && matrix.vs-version == 'vs2015' + shell: bash + run: | + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) + + dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-win-x86 + mkdir $dst + + cp -a build/install/bin $dst/ + cp -a build/install/lib $dst/ + cp -a build/install/include $dst/ + + tar cjvf ${dst}.tar.bz2 $dst + + - name: Release pre-compiled binaries and libs for macOS + if: env.RELEASE == 'true' && matrix.vs-version == 'vs2015' + uses: svenstaro/upload-release-action@v2 + with: + file_glob: true + overwrite: true + file: sherpa-onnx-*-win-x86.tar.bz2 diff --git a/scripts/dotnet/generate.py b/scripts/dotnet/generate.py index ffe83f5a..6392dd8b 100755 --- a/scripts/dotnet/generate.py +++ b/scripts/dotnet/generate.py @@ -34,7 +34,7 @@ def get_dict(): def process_linux(s): libs = [ "libkaldi-native-fbank-core.so", - "libonnxruntime.so.1.14.0", + "libonnxruntime.so.1.15.1", "libsherpa-onnx-c-api.so", "libsherpa-onnx-core.so", ] @@ -56,7 +56,7 @@ def process_linux(s): def process_macos(s): libs = [ "libkaldi-native-fbank-core.dylib", - "libonnxruntime.1.14.0.dylib", + "libonnxruntime.1.15.1.dylib", "libsherpa-onnx-c-api.dylib", "libsherpa-onnx-core.dylib", ]