Skip to content

Commit

Permalink
add CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Aug 17, 2024
1 parent 348d9b5 commit 2e58493
Show file tree
Hide file tree
Showing 24 changed files with 439 additions and 13 deletions.
29 changes: 29 additions & 0 deletions .github/scripts/test-vad.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -e

log() {
# This function is from espnet
local fname=${BASH_SOURCE[1]##*/}
echo -e "$(date '+%Y-%m-%d %H:%M:%S') (${fname}:${BASH_LINENO[0]}:${FUNCNAME[1]}) $*"
}

echo "EXE is $EXE"
echo "PATH: $PATH"

which $EXE

cd build

curl -SL -O https://github.com/k2-fsa/sherpa-ncnn/releases/download/models/sherpa-ncnn-silero-vad.tar.bz2
tar xvf sherpa-ncnn-silero-vad.tar.bz2
rm sherpa-ncnn-silero-vad.tar.bz2
ls -lh sherpa-ncnn-silero-vad

curl -SL -O https://github.com/k2-fsa/sherpa-ncnn/releases/download/models/lei-jun-test.wav

$EXE

ls -lh *.wav
rm -rfv sherpa-ncnn-*
rm *.wav
2 changes: 2 additions & 0 deletions .github/workflows/aarch64-linux-gnu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ on:
- 'sherpa-ncnn/csrc/*'
- 'toolchains/aarch64-linux-gnu.toolchain.cmake'

workflow_dispatch:

concurrency:
group: aarch64-linux-gnu-${{ github.ref }}
cancel-in-progress: true
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ jobs:
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-android

- name: Display NDK HOME
shell: bash
run: |
Expand All @@ -62,6 +67,9 @@ jobs:
- name: build android arm64-v8a
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
./build-android-arm64-v8a.sh
mkdir -p jniLibs/arm64-v8a/
Expand All @@ -70,6 +78,9 @@ jobs:
- name: build android armv7-eabi
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
./build-android-armv7-eabi.sh
mkdir -p ./jniLibs/armeabi-v7a/
Expand All @@ -78,6 +89,9 @@ jobs:
- name: build android x86_64
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
./build-android-x86-64.sh
mkdir -p ./jniLibs/x86_64
Expand All @@ -86,6 +100,9 @@ jobs:
- name: build android x86
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
export ANDROID_NDK=$ANDROID_NDK_LATEST_HOME
./build-android-x86.sh
mkdir -p ./jniLibs/x86
Expand Down Expand Up @@ -117,10 +134,11 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "Fangjun Kuang"
export GIT_CLONE_PROTECTION_ACTIVE=false
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-ncnn-libs huggingface
cd huggingface
git lfs pull
git pull
cp -v ../sherpa-ncnn-*-android.tar.bz2 ./
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/arm-linux-gnueabihf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ on:
- 'sherpa-ncnn/csrc/*'
- 'toolchains/arm-linux-gnueabihf.toolchain.cmake'

workflow_dispatch:

concurrency:
group: arm-linux-gnueabihf-${{ github.ref }}
cancel-in-progress: true
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/jni.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ on:
- 'sherpa-ncnn/jni/*'
- '.github/scripts/test-jni.sh'

workflow_dispatch:

concurrency:
group: jni-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -42,6 +44,11 @@ jobs:
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-jni

- name: Display kotlin version
shell: bash
run: |
Expand All @@ -56,4 +63,7 @@ jobs:
- name: Run JNI test
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
.github/scripts/test-jni.sh
28 changes: 27 additions & 1 deletion .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths:
- '.github/workflows/linux.yaml'
- '.github/scripts/run-test.sh'
- '.github/scripts/test-vad.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-ncnn/csrc/*'
Expand All @@ -16,11 +17,14 @@ on:
paths:
- '.github/workflows/linux.yaml'
- '.github/scripts/run-test.sh'
- '.github/scripts/test-vad.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-ncnn/csrc/*'
- 'sherpa-ncnn/csrc/*'

workflow_dispatch:

concurrency:
group: linux-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -37,19 +41,31 @@ jobs:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-linux

- 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=Release -DSHERPA_NCNN_ENABLE_FFMPEG_EXAMPLES=OFF ..
- name: Build sherpa-ncnn for ubuntu
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cd build
make -j2
Expand All @@ -59,6 +75,9 @@ jobs:
ls -lh bin/sherpa-ncnn
file bin/sherpa-ncnn
ls -lh bin/sherpa-ncnn-vad
file bin/sherpa-ncnn-vad
ls -lh bin/sherpa-ncnn-microphone
file bin/sherpa-ncnn-microphone
Expand All @@ -71,6 +90,13 @@ jobs:
name: sherpa-ncnn-pre-built-binaries-os-${{ matrix.os }}
path: ./build/bin

- name: Test vad
run: |
export PATH=$PWD/build/bin:$PATH
export EXE=sherpa-ncnn-vad
.github/scripts/test-vad.sh
- name: Test sherpa-ncnn
run: |
export PATH=$PWD/build/bin:$PATH
Expand Down
30 changes: 28 additions & 2 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths:
- '.github/workflows/macos.yaml'
- '.github/scripts/run-test.sh'
- '.github/scripts/test-vad.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-ncnn/csrc/*'
Expand All @@ -16,10 +17,13 @@ on:
paths:
- '.github/workflows/macos.yaml'
- '.github/scripts/run-test.sh'
- '.github/scripts/test-vad.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-ncnn/csrc/*'

workflow_dispatch:

concurrency:
group: macos-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -33,22 +37,34 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-latest]
os: [macos-latest, macos-13]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-macos

- 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=Release ..
- name: Build sherpa-ncnn for macos
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
cd build
make -j2
Expand All @@ -58,6 +74,9 @@ jobs:
ls -lh bin/sherpa-ncnn
file bin/sherpa-ncnn
ls -lh bin/sherpa-ncnn-vad
file bin/sherpa-ncnn-vad
ls -lh bin/sherpa-ncnn-microphone
file bin/sherpa-ncnn-microphone
Expand All @@ -70,6 +89,13 @@ jobs:
name: sherpa-ncnn-pre-built-binaries-os-${{ matrix.os }}
path: ./build/bin

- name: Test vad
run: |
export PATH=$PWD/build/bin:$PATH
export EXE=sherpa-ncnn-vad
.github/scripts/test-vad.sh
- name: Test sherpa-ncnn
run: |
export PATH=$PWD/build/bin:$PATH
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ jobs:
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-npm

- name: Install emsdk
uses: mymindstorm/setup-emsdk@v14

Expand Down Expand Up @@ -59,6 +64,9 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
./build-wasm-simd-for-nodejs.sh
cp -v build-wasm-simd-for-nodejs/install/bin/wasm/sherpa-ncnn-wasm-main.js ./scripts/nodejs
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/swift-api-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ on:
- 'sherpa-ncnn/swift-api-examples/*'
- 'build-swift-macos.sh'

workflow_dispatch:

concurrency:
group: swift-api-test-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -44,7 +46,15 @@ jobs:
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-swift

- name: Run swift-api-test
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
.github/scripts/swift-api-test.sh
2 changes: 2 additions & 0 deletions .github/workflows/test-dot-net.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ on:
- '.github/workflows/test-dot-net'
- 'dotnet-examples/**'

workflow_dispatch:

schedule:
# minute (0-59)
# hour (0-23)
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test-pip-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ on:
# nightly test at 22:50 UTC time every day
- cron: "50 22 * * *"

workflow_dispatch:

concurrency:
group: test_pip_install-${{ github.ref }}
cancel-in-progress: true
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/wasm-simd-hf-space-en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.os }}-wasm

- name: Install emsdk
uses: mymindstorm/setup-emsdk@v14

Expand Down Expand Up @@ -53,6 +59,9 @@ jobs:
- name: Build sherpa-ncnn for WebAssembly
shell: bash
run: |
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
./build-wasm-simd.sh
- name: collect files
Expand Down
Loading

0 comments on commit 2e58493

Please sign in to comment.