This repository has been archived on 2025-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
Files
enginex_bi_series-sherpa-onnx/.github/workflows/test-dart.yaml
Fangjun Kuang 53a3ad366b Support linux aarch64 for Dart and Flutter (#2342)
Adds support for building and packaging Linux AArch64 (arm64) artifacts alongside x64 for Dart/Flutter plugins.

- Detects host architecture in CMake and adjusts library paths
- Extends test workflows to run on an ARM runner and handle linux-aarch64 paths
- Splits release pipeline into separate x64 and aarch64 build/package jobs
2025-07-04 19:33:48 +08:00

142 lines
4.4 KiB
YAML

name: test-dart
on:
push:
branches:
- master
- dart
paths:
- '.github/workflows/test-dart.yaml'
- '.github/scripts/test-dart.sh'
- 'dart-api-examples/**'
- 'flutter/**'
pull_request:
branches:
- master
paths:
- '.github/workflows/test-dart.yaml'
- '.github/scripts/test-dart.sh'
- 'dart-api-examples/**'
- 'flutter/**'
workflow_dispatch:
concurrency:
group: test-dart-${{ github.ref }}
cancel-in-progress: true
jobs:
test_dart:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm] #, windows-latest]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Update version
shell: bash
run: |
./new-release.sh
git diff .
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}-dart
# see https://github.com/subosito/flutter-action/issues/345
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: master
flutter-version: 3.24.0
- name: Display flutter info
shell: bash
run: |
which flutter
which dart
flutter --version
dart --version
flutter doctor
- name: Build sherpa-onnx
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 \
-DBUILD_SHARED_LIBS=ON \
-DSHERPA_ONNX_ENABLE_PORTAUDIO=OFF \
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
-DBUILD_ESPEAK_NG_EXE=OFF \
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
-DCMAKE_INSTALL_PREFIX=./install \
..
cmake --build . --target install --config Release
- name: Copy libs
shell: bash
run: |
if [[ ${{ matrix.os }} == ubuntu-latest ]]; then
os=linux-x64
elif [[ ${{ matrix.os }} == ubuntu-24.04-arm ]]; then
os=linux-aarch64
elif [[ ${{ matrix.os }} == macos-latest ]]; then
os=macos
elif [[ ${{ matrix.os }} == windows-latest ]]; then
os=windows
fi
echo "os: $os"
if [[ $os == windows ]]; then
cp -fv build/install/lib/*.dll ./flutter/sherpa_onnx_$os/$os
elif [[ $os == linux-x64 ]]; then
cp -fv build/install/lib/lib* ./flutter/sherpa_onnx_linux/linux/x64
elif [[ $os == linux-aarch64 ]]; then
cp -fv build/install/lib/lib* ./flutter/sherpa_onnx_linux/linux/aarch64
else
cp -fv build/install/lib/lib* ./flutter/sherpa_onnx_$os/$os
fi
echo "--------------------"
if [[ $os == linux-x64 || $os == linux-aarch64 ]]; then
ls -lh ./flutter/sherpa_onnx_linux/linux/*
else
ls -lh ./flutter/sherpa_onnx_$os/$os
fi
- name: Run tests
shell: bash
run: |
cp scripts/dart/vad-pubspec.yaml dart-api-examples/vad/pubspec.yaml
cp scripts/dart/non-streaming-asr-pubspec.yaml dart-api-examples/non-streaming-asr/pubspec.yaml
cp scripts/dart/streaming-asr-pubspec.yaml dart-api-examples/streaming-asr/pubspec.yaml
cp scripts/dart/tts-pubspec.yaml dart-api-examples/tts/pubspec.yaml
cp scripts/dart/kws-pubspec.yaml dart-api-examples/keyword-spotter/pubspec.yaml
cp scripts/dart/vad-non-streaming-asr-pubspec.yaml dart-api-examples/vad-with-non-streaming-asr/pubspec.yaml
cp scripts/dart/audio-tagging-pubspec.yaml dart-api-examples/audio-tagging/pubspec.yaml
cp scripts/dart/add-punctuations-pubspec.yaml dart-api-examples/add-punctuations/pubspec.yaml
cp scripts/dart/speaker-id-pubspec.yaml dart-api-examples/speaker-identification/pubspec.yaml
cp scripts/dart/speaker-diarization-pubspec.yaml dart-api-examples/speaker-diarization/pubspec.yaml
cp scripts/dart/speech-enhancement-gtcrn-pubspec.yaml dart-api-examples/speech-enhancement-gtcrn/pubspec.yaml
cp scripts/dart/sherpa-onnx-pubspec.yaml flutter/sherpa_onnx/pubspec.yaml
.github/scripts/test-dart.sh