Fix releasing go packages (#476)

This commit is contained in:
Fangjun Kuang
2023-12-09 00:07:52 +08:00
committed by GitHub
parent aef74c5125
commit cae0231f93
13 changed files with 261 additions and 301 deletions

View File

@@ -50,6 +50,35 @@ jobs:
ls -lh ./wheelhouse/*.whl
- name: Publish to huggingface
if: matrix.python-version == 'cp38'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "csukuangfj@gmail.com"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_LFS_SKIP_SMUDGE=1
git clone https://huggingface.co/csukuangfj/sherpa-onnx-wheels huggingface
cd huggingface
git fetch
git pull
git merge -m "merge remote" --ff origin main
cp -v ../wheelhouse/*.whl .
git status
git add .
git commit -m "add more wheels"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

View File

@@ -83,6 +83,35 @@ jobs:
run: |
ls -lh ./wheelhouse/
- name: Publish to huggingface
if: matrix.python-version == '3.8'
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
uses: nick-fields/retry@v2
with:
max_attempts: 20
timeout_seconds: 200
shell: bash
command: |
git config --global user.email "csukuangfj@gmail.com"
git config --global user.name "Fangjun Kuang"
rm -rf huggingface
export GIT_LFS_SKIP_SMUDGE=1
git clone https://huggingface.co/csukuangfj/sherpa-onnx-wheels huggingface
cd huggingface
git fetch
git pull
git merge -m "merge remote" --ff origin main
cp -v ../wheelhouse/*.whl .
git status
git add .
git commit -m "add more wheels"
git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-wheels main
- name: Upload wheel
uses: actions/upload-artifact@v3
with:

View File

@@ -6,152 +6,15 @@ on:
- '*'
workflow_dispatch:
inputs:
version:
description: "Version informatione.g., v1.5.3) or auto"
required: true
env:
VERSION:
|- # Enter release tag name or version name in workflow_dispatch. Appropriate version if not specified
${{ github.event.release.tag_name || github.event.inputs.version }}
concurrency:
group: release-go-${{ github.ref }}
cancel-in-progress: true
jobs:
linux-x86_64_wheel:
if: github.repository_owner == 'k2-fsa' || github.repository_owner == 'csukuangfj'
name: Linux x86_64
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v4
- name: SSH to GitHub
run: |
mkdir -p ~/.ssh/
cp scripts/go/ssh_config ~/.ssh/config
echo "${{ secrets.MY_GITHUB_SSH_KEY }}" > ~/.ssh/github && chmod 600 ~/.ssh/github
ssh github.com || true
rm ~/.ssh/github
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/cibuildwheel@v2.11.4
env:
CIBW_BEFORE_BUILD: "pip install -U cmake numpy"
CIBW_BUILD: "cp38-*64"
CIBW_SKIP: "cp27-* cp35-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH='/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib'
- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/*.whl
unzip -l ./wheelhouse/*.whl
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-wheels-for-go
path: ./wheelhouse/*.whl
macOS:
name: macOS ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest]
arch: [x86_64, arm64]
steps:
- uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.arch }}
- name: Configure CMake
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cmake --version
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -D BUILD_SHARED_LIBS=ON -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -DCMAKE_INSTALL_PREFIX=./install ..
- name: Build sherpa-onnx for macOS ${{ matrix.arch }}
shell: bash
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cd build
make -j2
make install
ls -lh lib
ls -lh bin
file install/lib/lib*
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-for-${{ matrix.arch }}
path: ./build/install/lib/
windows:
name: Windows ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest]
arch: [x64, Win32]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure CMake
shell: bash
run: |
mkdir build
cd build
cmake -A ${{ matrix.arch }} -D CMAKE_BUILD_TYPE=Release -D BUILD_SHARED_LIBS=ON -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 install/*
ls -lh install/lib
ls -lh install/bin
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: sherpa-onnx-go-windows-${{ matrix.arch }}
path: ./build/install/lib/
Release:
name: Release
release_go:
name: Release go
runs-on: ubuntu-latest
needs: [linux-x86_64_wheel, macOS, windows]
steps:
- uses: actions/checkout@v4
@@ -163,46 +26,8 @@ jobs:
echo "${{ secrets.MY_GITHUB_SSH_KEY }}" > ~/.ssh/github && chmod 600 ~/.ssh/github
ssh github.com || true
- name: Retrieve artifact from ubuntu-latest
uses: actions/download-artifact@v2
with:
name: ubuntu-latest-wheels-for-go
path: ./linux
- name: Retrieve artifact from macos-latest (x86_64)
uses: actions/download-artifact@v2
with:
name: macos-latest-for-x86_64
path: ./macos-x86_64
- name: Retrieve artifact from macos-latest (arm64)
uses: actions/download-artifact@v2
with:
name: macos-latest-for-arm64
path: ./macos-arm64
- name: Retrieve artifact from windows-latest (x64)
uses: actions/download-artifact@v2
with:
name: sherpa-onnx-go-windows-x64
path: ./windows-x64
- name: Retrieve artifact from windows-latest (Win32)
uses: actions/download-artifact@v2
with:
name: sherpa-onnx-go-windows-Win32
path: ./windows-win32
- name: Unzip Ubuntu wheels
- name: Release
shell: bash
run: |
cd linux
ls -lh
unzip ./*.whl
tree .
- name: Release go
# if: env.VERSION != ''
shell: bash
run: |
./scripts/go/release.sh
cd scripts/go
./release.sh

View File

@@ -95,6 +95,11 @@ jobs:
./run-vits-zh-aishell3.sh
rm -rf vits-zh-aishell3
echo "Test vits-piper-en_US-lessac-medium"
git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium
./run-vits-piper-en_US-lessac-medium.sh
rm -rf vits-piper-en_US-lessac-medium
ls -lh *.wav
cp *.wav ../../tts-waves/
@@ -133,6 +138,11 @@ jobs:
./run-vits-zh-aishell3.sh
rm -rf vits-zh-aishell3
echo "Test vits-piper-en_US-lessac-medium"
git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium
./run-vits-piper-en_US-lessac-medium.sh
rm -rf vits-piper-en_US-lessac-medium
ls -lh *.wav
cp *.wav ../../tts-waves/
@@ -140,6 +150,7 @@ jobs:
if: matrix.os == 'windows-latest' && matrix.arch == 'x86'
shell: bash
run: |
mkdir tts-waves
cd go-api-examples/non-streaming-tts
ls -lh
go mod tidy
@@ -178,6 +189,11 @@ jobs:
./run-vits-zh-aishell3.sh
rm -rf vits-zh-aishell3
echo "Test vits-piper-en_US-lessac-medium"
git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium
./run-vits-piper-en_US-lessac-medium.sh
rm -rf vits-piper-en_US-lessac-medium
ls -lh *.wav
cp *.wav ../../tts-waves/

View File

@@ -65,6 +65,8 @@ jobs:
run: |
mkdir tts-waves
cp -v go-api-examples/non-streaming-tts/*.sh scripts/go/_internal/non-streaming-tts/
cd scripts/go/_internal/non-streaming-tts/
ls -lh
go mod tidy
@@ -89,6 +91,11 @@ jobs:
./run-vits-zh-aishell3.sh
rm -rf vits-zh-aishell3
echo "Test vits-piper-en_US-lessac-medium"
git clone https://huggingface.co/csukuangfj/vits-piper-en_US-lessac-medium
./run-vits-piper-en_US-lessac-medium.sh
rm -rf vits-piper-en_US-lessac-medium
cp *.wav ../../../../tts-waves/
- uses: actions/upload-artifact@v3
@@ -99,6 +106,8 @@ jobs:
- name: Test non-streaming decoding files (macOS)
shell: bash
run: |
cp -v go-api-examples/non-streaming-decode-files/*.sh scripts/go/_internal/non-streaming-decode-files/
cd scripts/go/_internal/non-streaming-decode-files/
ls -lh
go mod tidy
@@ -139,6 +148,7 @@ jobs:
- name: Test streaming decoding files
shell: bash
run: |
cp -v go-api-examples/streaming-decode-files/*.sh scripts/go/_internal/streaming-decode-files
cd scripts/go/_internal/streaming-decode-files
ls -lh
go mod tidy