perf(macos): 保留 MLX 原生构建缓存

This commit is contained in:
sim committed 2026-09-25 14:05:26 +08:00
1 parent b268dcf978
commit f89b767fbe
4 files changed
+61

No files matched your search

@@ -0,0 +1,42 @@
name: Cache macOS MLX native build
description: Preserve vendored MLX CMake output before rust-cache removes in-tree path dependencies.
inputs:
profile:
description: Cargo output profile directory (debug or release)
required: true
runs:
using: composite
steps:
- name: Fingerprint MLX native toolchain
id: native
shell: bash
working-directory: openless-all/app
env:
OPENLESS_MLX_PROFILE: ${{ inputs.profile }}
run: |
set -euo pipefail
case "$OPENLESS_MLX_PROFILE" in
debug|release) ;;
*) echo "::error::Unsupported MLX cache profile"; exit 1 ;;
esac
fingerprint=$({
rustc -vV
xcrun clang --version
xcrun --sdk macosx --show-sdk-version
cmake --version
git -C src-tauri/vendor/qwen3-asr-rs rev-parse HEAD
git -C src-tauri/vendor/qwen3-asr-rs/mlx-c rev-parse HEAD
for name in CARGO_PROFILE_DEV_DEBUG CARGO_PROFILE_TEST_DEBUG CARGO_PROFILE_RELEASE_CODEGEN_UNITS CARGO_PROFILE_RELEASE_STRIP RUSTFLAGS CARGO_ENCODED_RUSTFLAGS CC CXX CFLAGS CXXFLAGS SDKROOT DEVELOPER_DIR MACOSX_DEPLOYMENT_TARGET CMAKE_GENERATOR CMAKE_TOOLCHAIN_FILE; do
printf '%s=%s\n' "$name" "${!name-}"
done
} | shasum -a 256 | awk '{print $1}')
echo "fingerprint=$fingerprint" >> "$GITHUB_OUTPUT"
# Call this action AFTER rust-cache: post actions run in reverse order,
# so MLX is saved before rust-cache prunes src-tauri/vendor path packages.
# Cache only CMake output, not Cargo fingerprints: Cargo still reruns the
# build script and CMake validates its native inputs on every clean checkout.
- uses: actions/cache@v4
with:
path: openless-all/app/src-tauri/target/${{ inputs.profile }}/build/qwen3-asr-rs-*/out
key: macos-mlx-v1-${{ runner.arch }}-${{ inputs.profile }}-${{ steps.native.outputs.fingerprint }}-${{ hashFiles('openless-all/app/src-tauri/Cargo.toml', 'openless-all/app/src-tauri/Cargo.lock', 'openless-all/app/src-tauri/tauri*.json', '.cargo/config.toml', '.github/actions/cache-macos-mlx/action.yml') }}
+11
View File
@@ -252,6 +252,12 @@ jobs:
openless-all/app -> target
openless-all/app/src-tauri -> target
- name: Cache macOS MLX native build
if: runner.os == 'macOS' && runner.arch == 'ARM64'
uses: ./.github/actions/cache-macos-mlx
with:
profile: debug
- name: Prepare Windows Sherpa static libraries
if: runner.os == 'Windows'
shell: pwsh
@@ -388,6 +394,11 @@ jobs:
workspaces: |
openless-all/app/src-tauri -> target
openless-all/app/src-tauri/backend-tests -> target
- name: Cache macOS MLX native build
if: runner.arch == 'ARM64'
uses: ./.github/actions/cache-macos-mlx
with:
profile: debug
- run: npm ci
- run: npm run build
- name: Check Tauri backend with Rust 1.88 MSRV
+6
View File
@@ -92,6 +92,12 @@ jobs:
key: macos-release-v1
workspaces: 'openless-all/app/src-tauri -> target'
- name: Cache macOS MLX native build
if: matrix.updater-arch == 'aarch64'
uses: ./.github/actions/cache-macos-mlx
with:
profile: release
- name: Prepare Windows Sherpa static libraries
if: matrix.platform == 'windows-latest'
working-directory: 'openless-all/app'