@@ -11,8 +11,103 @@ permissions:
11
11
contents : read
12
12
13
13
jobs :
14
+ build-libs :
15
+ name : ${{ matrix.os }} ${{ matrix.arch }}
16
+ runs-on : ${{ matrix.os }}
17
+ strategy :
18
+ fail-fast : false
19
+ matrix :
20
+ os : [windows-2019]
21
+ arch : [x64, x86, arm64]
22
+
23
+ steps :
24
+ - uses : actions/checkout@v4
25
+ with :
26
+ fetch-depth : 0
27
+
28
+ - name : Build sherpa-onnx
29
+ shell : bash
30
+ run : |
31
+ arch=${{ matrix.arch }}
32
+ opts=""
33
+ if [ $arch == x86 ]; then
34
+ opts="-A Win32"
35
+ elif [ $arch == arm64 ]; then
36
+ opts="-A ARM64"
37
+ fi
38
+
39
+ mkdir build
40
+ cd build
41
+ cmake \
42
+ $opts \
43
+ -DBUILD_SHARED_LIBS=ON \
44
+ -DCMAKE_INSTALL_PREFIX=./install \
45
+ -DCMAKE_BUILD_TYPE=Release \
46
+ -DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
47
+ -DBUILD_ESPEAK_NG_EXE=OFF \
48
+ -DSHERPA_ONNX_BUILD_C_API_EXAMPLES=OFF \
49
+ -DSHERPA_ONNX_ENABLE_BINARY=ON \
50
+ ..
51
+
52
+ cmake --build . --target install --config Release
53
+ rm -rf install/pkgconfig
54
+
55
+ - uses : actions/upload-artifact@v4
56
+ with :
57
+ name : windows-${{ matrix.arch }}
58
+ path : ./build/install/lib/
59
+
60
+ - name : Create tar file
61
+ shell : bash
62
+ run : |
63
+ arch=${{ matrix.arch }}
64
+
65
+ cd build
66
+
67
+ SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ../CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
68
+
69
+ dst=sherpa-onnx-$SHERPA_ONNX_VERSION-win-$arch
70
+ mv install/lib $dst
71
+ tar cjvf $dst.tar.bz2 $dst
72
+ ls -lh *.tar.bz2
73
+ mv *.tar.bz2 ../
74
+
75
+ # https://huggingface.co/docs/hub/spaces-github-actions
76
+ - name : Publish to huggingface
77
+ if : (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
78
+ env :
79
+ HF_TOKEN : ${{ secrets.HF_TOKEN }}
80
+ uses : nick-fields/retry@v3
81
+ with :
82
+ max_attempts : 20
83
+ timeout_seconds : 200
84
+ shell : bash
85
+ command : |
86
+ git config --global user.email "csukuangfj@gmail.com"
87
+ git config --global user.name "Fangjun Kuang"
88
+
89
+ rm -rf huggingface
90
+ export GIT_CLONE_PROTECTION_ACTIVE=false
91
+ GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface
92
+
93
+ cd huggingface
94
+ mkdir -p windows-for-dotnet
95
+
96
+ cp -v ../sherpa-onnx-*.tar.bz2 ./windows-for-dotnet
97
+
98
+ git status
99
+ git lfs track "*.bz2"
100
+
101
+ git add .
102
+
103
+ git commit -m "add more files"
104
+
105
+ git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main
106
+ rm -rf huggingface
107
+
14
108
release-nuget-package :
15
109
runs-on : ${{ matrix.os }}
110
+ needs : [build-libs]
16
111
strategy :
17
112
fail-fast : false
18
113
matrix :
@@ -30,9 +125,44 @@ jobs:
30
125
6.0.x
31
126
7.0.x
32
127
128
+ - name : Install Python dependencies
129
+ shell : bash
130
+ run : |
131
+ python3 -m pip install --upgrade pip Jinja2
132
+
133
+ - name : Retrieve artifact from windows x64
134
+ uses : actions/download-artifact@v4
135
+ with :
136
+ name : windows-x64
137
+ path : /tmp/windows-x64
138
+
139
+ - name : Retrieve artifact from windows x86
140
+ uses : actions/download-artifact@v4
141
+ with :
142
+ name : windows-x86
143
+ path : /tmp/windows-x86
144
+
145
+ - name : Retrieve artifact from windows arm64
146
+ uses : actions/download-artifact@v4
147
+ with :
148
+ name : windows-arm64
149
+ path : /tmp/windows-arm64
150
+
33
151
- name : Check dotnet
34
152
run : dotnet --info
35
153
154
+ - name : Build
155
+ shell : bash
156
+ run : |
157
+ sudo apt-get install -y tree
158
+ ls -lh /tmp/
159
+
160
+ tree /tmp/windows*
161
+ echo "----"
162
+
163
+ rm -v /tmp/windows*/*.lib
164
+ tree /tmp/windows*
165
+
36
166
- name : Build
37
167
shell : bash
38
168
run : |
0 commit comments