-
Notifications
You must be signed in to change notification settings - Fork 454
133 lines (111 loc) · 3.76 KB
/
pkg-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: pkg-config
on:
push:
branches:
- master
- pkg-config
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
paths:
- '.github/workflows/pkg-config.yaml'
- '.github/scripts/test-offline-tts.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
- 'sherpa-onnx/c-api/*'
- 'c-api-examples/**'
pull_request:
branches:
- master
paths:
- '.github/workflows/pkg-config.yaml'
- '.github/scripts/test-offline-tts.sh'
- 'CMakeLists.txt'
- 'cmake/**'
- 'sherpa-onnx/csrc/*'
- 'sherpa-onnx/c-api/*'
workflow_dispatch:
concurrency:
group: pkg-config-${{ github.ref }}
cancel-in-progress: true
jobs:
pkg_config:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
build_type: [Release, Debug]
lib_type: [shared, static]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-${{ matrix.build_type }}-lib-${{ matrix.lib_type }}
- 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
if [[ ${{ matrix.lib_type }} == "shared" ]]; then
cmake -DSHERPA_ONNX_ENABLE_C_API=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON ..
else
cmake -DSHERPA_ONNX_ENABLE_C_API=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=OFF ..
fi
- name: Build sherpa-onnx for ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
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
- name: Install tree
if: matrix.os == 'ubuntu-latest'
shell: bash
run: |
sudo apt-get install tree
- name: Install tree
if: matrix.os == 'macos-latest'
shell: bash
run: |
brew install tree
- name: Display generated files of sherpa-onnx for ${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
shell: bash
run: |
tree build/install
ls -lh build/install
cat build/install/sherpa-onnx.pc
- name: Build C API example
shell: bash
run: |
export PKG_CONFIG_PATH=$PWD/build/install:$PKG_CONFIG_PATH
cd c-api-examples
gcc -o decode-file-c-api $(pkg-config --cflags sherpa-onnx) ./decode-file-c-api.c $(pkg-config --libs sherpa-onnx)
./decode-file-c-api --help
gcc -o offline-tts-c-api $(pkg-config --cflags sherpa-onnx) ./offline-tts-c-api.c $(pkg-config --libs sherpa-onnx)
./offline-tts-c-api --help
- name: Test offline TTS C API
shell: bash
run: |
export PATH=$PWD/c-api-examples:$PATH
export EXE=offline-tts-c-api
.github/scripts/test-offline-tts.sh
- name: Test online transducer (C API)
shell: bash
run: |
export PATH=$PWD/c-api-examples:$PATH
export EXE=decode-file-c-api
.github/scripts/test-online-transducer.sh
- uses: actions/upload-artifact@v4
with:
name: tts-generated-test-files-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.lib_type }}
path: tts