Support macOS (#14)

* support macos

* Update CI to test macos
This commit is contained in:
Fangjun Kuang
2022-10-12 21:08:51 +08:00
committed by GitHub
parent fb28455292
commit 93539b6f91
2 changed files with 17 additions and 8 deletions

View File

@@ -1,11 +1,11 @@
name: test-linux name: test-linux-macos
on: on:
push: push:
branches: branches:
- master - master
paths: paths:
- '.github/workflows/test-linux.yaml' - '.github/workflows/test-linux-macos.yaml'
- 'CMakeLists.txt' - 'CMakeLists.txt'
- 'cmake/**' - 'cmake/**'
- 'sherpa-onnx/csrc/*' - 'sherpa-onnx/csrc/*'
@@ -13,13 +13,13 @@ on:
branches: branches:
- master - master
paths: paths:
- '.github/workflows/test-linux.yaml' - '.github/workflows/test-linux-macos.yaml'
- 'CMakeLists.txt' - 'CMakeLists.txt'
- 'cmake/**' - 'cmake/**'
- 'sherpa-onnx/csrc/*' - 'sherpa-onnx/csrc/*'
concurrency: concurrency:
group: test-linux-${{ github.ref }} group: test-linux-macos-${{ github.ref }}
cancel-in-progress: true cancel-in-progress: true
permissions: permissions:
@@ -31,7 +31,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@@ -51,12 +51,12 @@ jobs:
cd build cd build
cmake -D CMAKE_BUILD_TYPE=Release .. cmake -D CMAKE_BUILD_TYPE=Release ..
- name: Build sherpa-onnx for ubuntu - name: Build sherpa-onnx for ubuntu/macos
run: | run: |
cd build cd build
make VERBOSE=1 -j3 make VERBOSE=1 -j3
- name: Run tests for ubuntu (English) - name: Run tests for ubuntu/macos (English)
run: | run: |
time ./build/bin/sherpa-onnx \ time ./build/bin/sherpa-onnx \
./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/onnx/encoder.onnx \ ./icefall-asr-librispeech-pruned-transducer-stateless3-2022-05-13/exp/onnx/encoder.onnx \

View File

@@ -22,8 +22,17 @@ function(download_onnxruntime)
# #
# ./include # ./include
# It contains all the needed header files # It contains all the needed header files
elseif(APPLE)
set(onnxruntime_URL "https://github.com/microsoft/onnxruntime/releases/download/v1.12.1/onnxruntime-osx-x86_64-1.12.1.tgz")
set(onnxruntime_HASH "SHA256=10921c2e75817edcbfc8b29882612be07e25dd33c8449d5892a9d45588898099")
# After downloading, it contains:
# ./lib/libonnxruntime.1.12.1.dylib
# ./lib/libonnxruntime.dylib, which is a symlink to lib/libonnxruntime.1.12.1.dylib
#
# ./include
# It contains all the needed header files
else() else()
message(FATAL_ERROR "Only support Linux at present. Will support other OSes later") message(FATAL_ERROR "Only support Linux and macOS at present. Will support other OSes later")
endif() endif()
FetchContent_Declare(onnxruntime FetchContent_Declare(onnxruntime