|
| 1 | +name: build-wheels-aarch64-rknn |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - wheel |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +concurrency: |
| 10 | + group: build-wheels-aarch64-rknn-${{ github.ref }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build_wheels_aarch64_rknn: |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + name: ${{ matrix.os }} ${{ matrix.python-version }} |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + os: [ubuntu-22.04-arm] |
| 21 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - name: Setup Python ${{ matrix.python-version }} |
| 29 | + uses: actions/setup-python@v5 |
| 30 | + with: |
| 31 | + python-version: ${{ matrix.python-version }} |
| 32 | + |
| 33 | + - name: Install Python dependencies |
| 34 | + shell: bash |
| 35 | + run: | |
| 36 | + python3 -m pip install --upgrade pip numpy pypinyin sentencepiece setuptools wheel |
| 37 | +
|
| 38 | + - name: ccache |
| 39 | + uses: hendrikmuhs/[email protected] |
| 40 | + with: |
| 41 | + key: ${{ matrix.os }}-rknn-linux-aarch64-wheel |
| 42 | + |
| 43 | + - name: Download rknn-toolkit2 |
| 44 | + shell: bash |
| 45 | + run: | |
| 46 | + git clone --depth 1 https://github.com/airockchip/rknn-toolkit2 |
| 47 | +
|
| 48 | + - name: Build sherpa-onnx |
| 49 | + shell: bash |
| 50 | + run: | |
| 51 | + export CMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 52 | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" |
| 53 | + cmake --version |
| 54 | +
|
| 55 | + echo "config: ${{ matrix.config }}" |
| 56 | + uname -a |
| 57 | + which gcc |
| 58 | +
|
| 59 | + gcc --version |
| 60 | + g++ --version |
| 61 | +
|
| 62 | + echo "pwd" |
| 63 | +
|
| 64 | + ls -lh |
| 65 | +
|
| 66 | + git clone --depth 1 --branch v1.2.12 https://github.com/alsa-project/alsa-lib |
| 67 | + pushd alsa-lib |
| 68 | + ./gitcompile |
| 69 | + popd |
| 70 | +
|
| 71 | + export SHERPA_ONNX_RKNN_TOOLKIT2_PATH=$PWD/rknn-toolkit2 |
| 72 | + export SHERPA_ONNX_RKNN_TOOLKIT2_LIB_DIR=$SHERPA_ONNX_RKNN_TOOLKIT2_PATH/rknpu2/runtime/Linux/librknn_api/aarch64 |
| 73 | + export CPLUS_INCLUDE_PATH=$SHERPA_ONNX_RKNN_TOOLKIT2_PATH/rknpu2/runtime/Linux/librknn_api/include:$CPLUS_INCLUDE_PATH |
| 74 | + export CPLUS_INCLUDE_PATH=$PWD/alsa-lib/include:$CPLUS_INCLUDE_PATH |
| 75 | + export SHERPA_ONNX_ALSA_LIB_DIR=$PWD/alsa-lib/src/.libs |
| 76 | +
|
| 77 | + export SHERPA_ONNX_CMAKE_ARGS="-DSHERPA_ONNX_ENABLE_RKNN=ON -DSHERPA_ONNX_ENABLE_ALSA=1" |
| 78 | + python3 setup.py bdist_wheel |
| 79 | +
|
| 80 | +
|
| 81 | + - name: Display results |
| 82 | + shell: bash |
| 83 | + run: | |
| 84 | + ls -lh dist |
| 85 | +
|
| 86 | + - name: Publish to huggingface |
| 87 | + env: |
| 88 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} |
| 89 | + uses: nick-fields/retry@v3 |
| 90 | + with: |
| 91 | + max_attempts: 20 |
| 92 | + timeout_seconds: 200 |
| 93 | + shell: bash |
| 94 | + command: | |
| 95 | + git config --global user.email "[email protected]" |
| 96 | + git config --global user.name "Fangjun Kuang" |
| 97 | +
|
| 98 | + rm -rf huggingface |
| 99 | + export GIT_LFS_SKIP_SMUDGE=1 |
| 100 | + export GIT_CLONE_PROTECTION_ACTIVE=false |
| 101 | +
|
| 102 | + SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) |
| 103 | + echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION" |
| 104 | +
|
| 105 | + d=rknn/$SHERPA_ONNX_VERSION/ |
| 106 | +
|
| 107 | + git clone https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-wheels huggingface |
| 108 | + cd huggingface |
| 109 | + git fetch |
| 110 | + git pull |
| 111 | + git merge -m "merge remote" --ff origin main |
| 112 | +
|
| 113 | + mkdir -p $d |
| 114 | +
|
| 115 | + cp -v ../dist/*.whl $d/ |
| 116 | +
|
| 117 | + git status |
| 118 | + git add . |
| 119 | + git commit -m "add more wheels" |
| 120 | + git push https://csukuangfj:[email protected]/csukuangfj/sherpa-onnx-wheels main |
| 121 | +
|
| 122 | + - uses: actions/upload-artifact@v4 |
| 123 | + with: |
| 124 | + name: wheel-${{ matrix.python-version }} |
| 125 | + path: ./dist/*.whl |
0 commit comments