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
This commit is contained in:
Fangjun Kuang
2025-07-04 19:33:48 +08:00
committed by GitHub
parent 3bf986d08d
commit 53a3ad366b
7 changed files with 206 additions and 53 deletions

View File

@@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest] #, windows-latest]
os: [ubuntu-latest, macos-latest, ubuntu-24.04-arm] #, windows-latest]
steps:
- uses: actions/checkout@v4
@@ -50,11 +50,12 @@ jobs:
with:
key: ${{ matrix.os }}-dart
- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v3
# see https://github.com/subosito/flutter-action/issues/345
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
version: latest
channel: master
flutter-version: 3.24.0
- name: Display flutter info
shell: bash
@@ -91,22 +92,34 @@ jobs:
shell: bash
run: |
if [[ ${{ matrix.os }} == ubuntu-latest ]]; then
os=linux
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 "--------------------"
ls -lh ./flutter/sherpa_onnx_$os/$os
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