44 push :
55 branches :
66 - flutter
7+ tags :
8+ - ' v[0-9]+.[0-9]+.[0-9]+*'
79
810 workflow_dispatch :
911
@@ -12,6 +14,262 @@ concurrency:
1214 cancel-in-progress : true
1315
1416jobs :
17+ asr :
18+ name : asr ${{ matrix.index }}/${{ matrix.total }}
19+ runs-on : ${{ matrix.os }}
20+ strategy :
21+ fail-fast : false
22+ matrix :
23+ os : [ubuntu-latest]
24+ total : ["3"]
25+ index : ["0", "1", "2"]
26+
27+ steps :
28+ - uses : actions/checkout@v4
29+ with :
30+ fetch-depth : 0
31+
32+ - name : Set up JDK 17
33+ uses : actions/setup-java@v3
34+ with :
35+ distribution : ' temurin'
36+ java-version : ' 17'
37+
38+ - name : Check Java version
39+ run : |
40+ java -version
41+ echo $JAVA_HOME
42+
43+ - name : Set JAVA_HOME for Gradle
44+ run : echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
45+
46+ - name : Check Java version
47+ run : |
48+ java -version
49+ echo $JAVA_HOME
50+
51+ - name : Update version
52+ shell : bash
53+ run : |
54+ ./new-release.sh
55+ git diff .
56+
57+ - name : Display NDK HOME
58+ shell : bash
59+ run : |
60+ echo "ANDROID_NDK_LATEST_HOME: ${ANDROID_NDK_LATEST_HOME}"
61+ ls -lh ${ANDROID_NDK_LATEST_HOME}
62+
63+ - name : Setup build tool version variable
64+ shell : bash
65+ run : |
66+ echo "---"
67+ ls -lh /usr/local/lib/android/
68+ echo "---"
69+
70+ ls -lh /usr/local/lib/android/sdk
71+ echo "---"
72+
73+ ls -lh /usr/local/lib/android/sdk/build-tools
74+ echo "---"
75+
76+ BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
77+ echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
78+ echo "Last build tool version is: $BUILD_TOOL_VERSION"
79+
80+ - name : Install Python dependencies
81+ shell : bash
82+ run : |
83+ python3 -m pip install --upgrade pip jinja2 iso639-lang
84+
85+ - name : Install deps
86+ shell : bash
87+ run : |
88+ sudo apt-get update -y
89+ sudo apt-get install -y build-essential jq git cmake
90+ sudo apt-get install -y curl
91+
92+ - name : Setup Flutter SDK
93+ uses : flutter-actions/setup-flutter@v4
94+ with :
95+ channel : stable
96+ version : 3.29.0
97+ cache : true
98+
99+ - name : Install ninja
100+ shell : bash
101+ run : |
102+ sudo apt-get install -y ninja-build
103+
104+ - name : Display ninja version
105+ shell : bash
106+ run : |
107+ ninja --version
108+ ninja --help || true
109+ which ninja
110+
111+ - name : Display PWD
112+ shell : bash
113+ run : |
114+ echo "pwd: $PWD"
115+ ls -lh
116+
117+ - name : Display machine info
118+ shell : bash
119+ run : |
120+ uname -a
121+
122+ - name : Display flutter info
123+ shell : bash
124+ run : |
125+ which flutter
126+ which dart
127+
128+ flutter --version
129+
130+ git config --global --add safe.directory /__t/flutter-Linux-*/flutter || true
131+
132+ flutter --version
133+
134+ dart --version
135+ flutter doctor
136+
137+ - name : Install libgtk-3-dev
138+ shell : bash
139+ run : |
140+ sudo apt install -y libgtk-3-dev tree clang pkg-config
141+
142+ - name : Accept Android licenses
143+ run : yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
144+
145+ - name : Install Android SDK Components
146+ run : |
147+ $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "platforms;android-35" "build-tools;35.0.0"
148+
149+ - name : Install NDK 27
150+ run : |
151+ $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "ndk;27.0.12077973"
152+
153+ - name : Display flutter info (2)
154+ shell : bash
155+ run : |
156+ which flutter
157+ which dart
158+
159+ flutter --version
160+ dart --version
161+ flutter doctor
162+
163+ cd ..
164+
165+ - name : Build flutter
166+ shell : bash
167+ run : |
168+ cd scripts/flutter
169+
170+ total=${{ matrix.total }}
171+ index=${{ matrix.index }}
172+
173+ ./generate-streaming-asr.py --total $total --index $index
174+
175+ chmod +x *.sh
176+ ./build-android-streaming-asr.sh
177+
178+ cd ../../
179+
180+ ls -lh *.apk
181+
182+ - name : Display generated files
183+ shell : bash
184+ run : |
185+ ls -lh *.apk
186+
187+ mkdir apks
188+
189+ mv -v *.apk ./apks
190+
191+ # https://github.com/marketplace/actions/sign-android-release
192+ - uses : r0adkll/sign-android-release@v1
193+ name : Sign app APK
194+ with :
195+ releaseDirectory : ./apks
196+ signingKeyBase64 : ${{ secrets.ANDROID_SIGNING_KEY }}
197+ alias : ${{ secrets.ANDROID_SIGNING_KEY_ALIAS }}
198+ keyStorePassword : ${{ secrets.ANDROID_SIGNING_KEY_STORE_PASSWORD }}
199+ env :
200+ BUILD_TOOLS_VERSION : ${{ env.BUILD_TOOL_VERSION }}
201+
202+ - name : Display APK after signing
203+ shell : bash
204+ run : |
205+ ls -lh ./apks/
206+ du -h -d1 .
207+
208+ - name : Rename APK after signing
209+ shell : bash
210+ run : |
211+ cd apks
212+ rm -fv signingKey.jks
213+ rm -fv *.apk.idsig
214+ rm -fv *-aligned.apk
215+
216+ all_apks=$(ls -1 *-signed.apk)
217+ echo "----"
218+ echo $all_apks
219+ echo "----"
220+ for apk in ${all_apks[@]}; do
221+ n=$(echo $apk | sed -e s/-signed//)
222+ mv -v $apk $n
223+ done
224+
225+ cd ..
226+
227+ ls -lh ./apks/
228+ du -h -d1 .
229+
230+ - name : Display APK after rename
231+ shell : bash
232+ run : |
233+ ls -lh ./apks/
234+ du -h -d1 .
235+
236+ - name : Publish to huggingface
237+ if : (github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa' || github.repository_owner == 'csu-fangjun') && ((github.event_name == 'push' || github.event_name == 'workflow_dispatch') || contains(github.ref, 'refs/tags/'))
238+ env :
239+ HF_TOKEN : ${{ secrets.HF_TOKEN }}
240+ uses : nick-fields/retry@v3
241+ with :
242+ max_attempts : 20
243+ timeout_seconds : 200
244+ shell : bash
245+ command : |
246+ git config --global user.email "csukuangfj@gmail.com"
247+ git config --global user.name "Fangjun Kuang"
248+
249+ rm -rf huggingface
250+ export GIT_LFS_SKIP_SMUDGE=1
251+ export GIT_CLONE_PROTECTION_ACTIVE=false
252+
253+ SHERPA_ONNX_VERSION=$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
254+ echo "SHERPA_ONNX_VERSION $SHERPA_ONNX_VERSION"
255+
256+ git clone https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter huggingface
257+ cd huggingface
258+ git fetch
259+ git pull
260+ git merge -m "merge remote" --ff origin main
261+
262+ dst=flutter/asr/android/$SHERPA_ONNX_VERSION
263+ mkdir -p $dst
264+
265+ cp -v ../apks/*.apk $dst
266+
267+ git status
268+ git lfs track "*.apk"
269+ git add .
270+ git commit -m "add more files"
271+ git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-flutter main
272+
15273 tts :
16274 name : tts ${{ matrix.index }}/${{ matrix.total }}
17275 runs-on : ${{ matrix.os }}
@@ -27,6 +285,25 @@ jobs:
27285 with :
28286 fetch-depth : 0
29287
288+ - name : Set up JDK 17
289+ uses : actions/setup-java@v3
290+ with :
291+ distribution : ' temurin'
292+ java-version : ' 17'
293+
294+ - name : Check Java version
295+ run : |
296+ java -version
297+ echo $JAVA_HOME
298+
299+ - name : Set JAVA_HOME for Gradle
300+ run : echo "JAVA_HOME=$JAVA_HOME" >> $GITHUB_ENV
301+
302+ - name : Check Java version
303+ run : |
304+ java -version
305+ echo $JAVA_HOME
306+
30307 - name : Update version
31308 shell : bash
32309 run : |
@@ -69,10 +346,11 @@ jobs:
69346 sudo apt-get install -y curl
70347
71348 - name : Setup Flutter SDK
72- uses : flutter-actions/setup-flutter@v3
349+ uses : flutter-actions/setup-flutter@v4
73350 with :
74351 channel : stable
75- version : latest
352+ version : 3.29.0
353+ cache : true
76354
77355 - name : Install ninja
78356 shell : bash
@@ -117,6 +395,13 @@ jobs:
117395 run : |
118396 sudo apt install -y libgtk-3-dev tree clang pkg-config
119397
398+ - name : Accept Android licenses
399+ run : yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses
400+
401+ - name : Install Android SDK Components
402+ run : |
403+ $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager "platforms;android-35" "build-tools;35.0.0"
404+
120405 - name : Display flutter info (2)
121406 shell : bash
122407 run : |
0 commit comments