mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-04 08:34:12 +00:00
fix(ci): build macOS arm64 with Flutter 3.44 (#16821)
* fix(ci): build macOS arm64 with Flutter 3.44 Flutter 3.24.5's macOS engine can crash in attributedSubstringForProposedRange with an out-of-bounds range on an empty string (#16817). The fix (flutter/flutter#153157) landed after 3.24 and was never cherry-picked, and 3.44 has the bounds check. So macOS arm64 now builds with Flutter 3.44.9, the same way Windows arm64 does: the 3.44 bridge artifact and the shared source patch script. The script uses GNU `sed -i`, which BSD sed on macOS rejects, so the step puts GNU sed first on PATH. The 3.24 dropdown patch is skipped, because 3.44 already has that fix. macOS x86_64 stays on 3.24.5: 3.44's FlutterMacOS needs macOS 10.15 there, and the build targets 10.14. The Dart tests move to the x86_64 job, so CI still runs them against the 3.24.5 sources that most platforms ship. Refs #16817 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(ci): keep CocoaPods on macOS arm64 and run Dart tests on both arches Flutter 3.44 turns on Swift Package Manager by default. On the first `flutter build macos` it would migrate Runner.xcodeproj and Runner.xcscheme, and build file_selector_macos, path_provider_foundation, url_launcher_macos and video_player_avfoundation through SwiftPM while the other 12 plugins stay on CocoaPods. If the migration fails, the build fails. All 16 macOS plugins still ship a podspec, so turning SwiftPM off keeps arm64 on the CocoaPods-only path the 3.24.5 build uses, and this change only swaps the engine. The Dart tests now run on both macOS jobs: x86_64 covers the 3.24.5 sources most platforms ship, and arm64 covers the patched 3.44 sources it ships. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * ci: update comments that still call Windows arm64 the only Flutter 3.44 build The FLUTTER_WINDOWS_ARM_VERSION note, the Windows source-patch step and the header of apply_flutter_3.44_source_patches.sh still said Windows arm64 is the only Flutter 3.44 target. They now mention macOS arm64 too, and the script header records that macOS needs GNU sed for its `sed -i` calls. Comments only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: make test_RustDesk_interval_sleep deterministic The test recorded tick times as wall-clock seconds, rounded to the nearest second, and asserted all 5 were unique. If the runner stalled for close to a second, two correct ticks rounded to the same value and the test failed (macOS arm64 CI on #16821: left 5, right 4). It now runs on tokio's paused clock and checks what ThrottledInterval guarantees: ticks are at least 0.9 * period apart. A plain tokio interval bursts its missed ticks with no gap, so a lost throttle still fails. This needs tokio's test-util feature for the existing dev-dependency. It adds no crates, so Cargo.lock is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
29d1ab26a1
commit
4ec4ec3d14
5 files changed
+62
-37
No files matched your search
@@ -31,10 +31,15 @@ env:
|
||||
FLUTTER_VERSION: "3.24.5"
|
||||
ANDROID_FLUTTER_VERSION: "3.24.5"
|
||||
# Windows arm64 only: the first stable Flutter to ship a native arm64 Windows Dart SDK +
|
||||
# engine is 3.44. Every other platform stays on FLUTTER_VERSION (3.24.5) until Windows 7
|
||||
# support is restored after the upstream-wide Flutter bump. The arm64 job patches the few
|
||||
# 3.44-only source/pubspec changes on the fly (see "Patch RustDesk sources for Flutter 3.44").
|
||||
# engine is 3.44. Every other platform except macOS arm64 (below) stays on FLUTTER_VERSION
|
||||
# (3.24.5) until Windows 7 support is restored after the upstream-wide Flutter bump. The 3.44
|
||||
# jobs patch the few 3.44-only source/pubspec changes on the fly (see "Patch RustDesk sources
|
||||
# for Flutter 3.44").
|
||||
FLUTTER_WINDOWS_ARM_VERSION: "3.44.9"
|
||||
# macOS arm64 only: 3.24.5's engine crashes in attributedSubstringForProposedRange
|
||||
# (https://github.com/rustdesk/rustdesk/issues/16817, https://github.com/flutter/flutter/issues/153157).
|
||||
# x86_64 stays on FLUTTER_VERSION: 3.44's FlutterMacOS needs macOS 10.15 there, and it targets 10.14.
|
||||
FLUTTER_MACOS_ARM_VERSION: "3.44.9"
|
||||
# for arm64 linux because official Dart SDK does not work
|
||||
FLUTTER_ELINUX_VERSION: "3.16.9"
|
||||
TAG_NAME: "${{ inputs.upload-tag }}"
|
||||
@@ -273,8 +278,9 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Patch RustDesk sources for Flutter 3.44 (arm64)
|
||||
# arm64 is the only target on Flutter 3.44; apply its source/pubspec deltas on the fly
|
||||
# (shared with the 3.44 bridge job) so the committed sources stay on Flutter 3.24.5.
|
||||
# arm64 is on Flutter 3.44 (as is macOS arm64); apply its source/pubspec deltas on the fly
|
||||
# (shared with the macOS arm64 build and the 3.44 bridge job) so the committed sources
|
||||
# stay on Flutter 3.24.5.
|
||||
# `flutter build` then runs `pub get`, regenerating pubspec.lock for the bumped deps.
|
||||
if: ${{ matrix.job.arch == 'aarch64' }}
|
||||
shell: bash
|
||||
@@ -1004,9 +1010,17 @@ jobs:
|
||||
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
|
||||
with:
|
||||
channel: "stable"
|
||||
flutter-version: ${{ env.FLUTTER_VERSION }}
|
||||
flutter-version: ${{ matrix.job.arch == 'aarch64' && env.FLUTTER_MACOS_ARM_VERSION || env.FLUTTER_VERSION }}
|
||||
|
||||
- name: Keep CocoaPods for Flutter 3.44 (arm64)
|
||||
# 3.44 turns on Swift Package Manager by default, which would migrate Runner.xcodeproj and
|
||||
# move some plugins off CocoaPods; every plugin still ships a podspec.
|
||||
if: ${{ matrix.job.arch == 'aarch64' }}
|
||||
run: flutter config --no-enable-swift-package-manager
|
||||
|
||||
- name: Patch flutter
|
||||
# Flutter 3.44 (arm64) already has this dropdown fix.
|
||||
if: ${{ matrix.job.arch == 'x86_64' }}
|
||||
run: |
|
||||
cd $(dirname $(dirname $(which flutter)))
|
||||
if [[ "3.24.5" == ${{env.FLUTTER_VERSION}} ]]; then
|
||||
@@ -1021,6 +1035,15 @@ jobs:
|
||||
sed -i -e 's/_setFramesEnabledState(false);/\/\/_setFramesEnabledState(false);/g' ../packages/flutter/lib/src/scheduler/binding.dart
|
||||
grep -n '_setFramesEnabledState(false);' ../packages/flutter/lib/src/scheduler/binding.dart
|
||||
|
||||
- name: Patch RustDesk sources for Flutter 3.44 (arm64)
|
||||
# The script uses GNU `sed -i`, which macOS's BSD sed rejects.
|
||||
if: ${{ matrix.job.arch == 'aarch64' }}
|
||||
shell: bash
|
||||
run: |
|
||||
brew install gnu-sed
|
||||
export PATH="$(brew --prefix gnu-sed)/libexec/gnubin:$PATH"
|
||||
bash .github/patches/apply_flutter_3.44_source_patches.sh
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # v1
|
||||
with:
|
||||
@@ -1035,11 +1058,13 @@ jobs:
|
||||
- name: Restore bridge files
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
with:
|
||||
name: bridge-artifact
|
||||
# arm64's *.freezed.dart must match the freezed it resolves under Flutter 3.44.
|
||||
name: ${{ matrix.job.arch == 'aarch64' && 'bridge-artifact-flutter-3.44' || 'bridge-artifact' }}
|
||||
path: ./
|
||||
|
||||
- name: Run the Dart tests
|
||||
if: ${{ !inputs.upload-artifact && matrix.job.arch == 'aarch64' }}
|
||||
# x86_64 tests the Flutter 3.24.5 sources most platforms ship, arm64 the patched 3.44 ones.
|
||||
if: ${{ !inputs.upload-artifact }}
|
||||
working-directory: flutter
|
||||
run: flutter test --timeout 60s
|
||||
|
||||
|
||||
Reference in new issue
Block a user