Files
SpotiFLAC-Mobile/.github/workflows/ci.yml
T
zarzet aa99726439 feat(backend): migrate production backend to Rust
Replace the Go backend with the Rust workspace and route Android/iOS through
UniFFI bindings. Include the migrated extension runtime, network, providers,
media metadata, downloads and library operations, with version 5.0.0+147.

Remove Go sources, adapters, native build selection and CI dependencies.
Build Rust unconditionally and lock the iOS Rust pod using a relative path.
Retain legacy source and migration evidence in a local ignored archive.

Validation: Android Kotlin compile and 53 native tests; Swift Rust-branch
equivalence and syntax; CocoaPods install; workflow, shell, Ruby, plist and
diff checks. Reuse the preceding 100 Rust tests, fmt/Clippy and five-ABI
build checkpoint; no new APK or iOS application build for this cleanup.

Known follow-up: URL/URLSearchParams globals are missing from the Rust JS
runtime. A controlled extension replay confirms a URL-resolution regression;
this commit does not fix that runtime gap.
2026-09-14 22:58:27 +07:00

249 lines
7.5 KiB
YAML

name: CI
on:
pull_request:
push:
branches:
- main
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
changes:
name: Detect changed paths
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
dart: ${{ steps.filter.outputs.dart }}
android: ${{ steps.filter.outputs.android }}
ios: ${{ steps.filter.outputs.ios }}
rust: ${{ steps.filter.outputs.rust }}
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Filter paths
uses: dorny/paths-filter@0e4a8c6effa4802afeda77dc8d303f8176d7dfad # v3
id: filter
with:
filters: |
dart:
- 'lib/**'
- 'test/**'
- 'android/app/src/test/resources/**'
- 'assets/**'
- 'pubspec.yaml'
- 'pubspec.lock'
- 'analysis_options.yaml'
- 'l10n.yaml'
- '.fvmrc'
- '.github/workflows/ci.yml'
rust:
- 'rust_backend/**'
- 'scripts/*rust*.sh'
- 'android/gradlew'
- 'android/gradle/wrapper/**'
- '.github/workflows/ci.yml'
ios:
- 'ios/**'
- 'scripts/build_ios.sh'
- 'scripts/check_backend_ios.py'
- 'lib/**'
- 'assets/**'
- 'pubspec.yaml'
- 'pubspec.lock'
- 'l10n.yaml'
- '.fvmrc'
- '.github/workflows/ci.yml'
android:
- 'android/**'
- 'rust_backend/**'
- 'scripts/build_android.sh'
- 'scripts/build_rust_backend.sh'
- 'scripts/check_backend_apk.py'
- 'lib/**'
- 'assets/**'
- 'pubspec.yaml'
- 'pubspec.lock'
- 'l10n.yaml'
- '.fvmrc'
- '.github/workflows/ci.yml'
flutter:
name: Flutter analyze & test
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.dart == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
with:
channel: "stable"
flutter-version-file: .fvmrc
cache: true
- name: Cache pub dependencies
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5
with:
path: ~/.pub-cache
key: pub-${{ runner.os }}-${{ hashFiles('pubspec.lock') }}
restore-keys: pub-${{ runner.os }}-
- name: Get Flutter dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Install media test tools
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
ffmpeg -version
ffprobe -version
- name: Run tests
run: flutter test
rust:
name: Rust checks & Android libraries
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.rust == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Java for Android SDK tools
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: "temurin"
java-version: "25"
- name: Activate pinned Rust toolchain
working-directory: rust_backend
run: rustup show
- name: Install C binding generator dependencies
run: |
sudo apt-get update
sudo apt-get install -y libclang-dev
- name: Rust formatting, Clippy and unit tests
run: bash scripts/check_rust_backend.sh
- name: Install Android NDK
run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "ndk;29.0.14206865"
- name: Build Android ARM32 and ARM64 libraries
run: ANDROID_NDK_HOME="$ANDROID_HOME/ndk/29.0.14206865" bash scripts/build_rust_backend.sh android
rust-ios:
name: Rust iOS libraries & release application
runs-on: macos-latest
needs: changes
if: needs.changes.outputs.rust == 'true' || needs.changes.outputs.ios == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Activate pinned Rust toolchain
working-directory: rust_backend
run: rustup show
- name: Build iOS device and universal simulator XCFramework
run: bash scripts/build_rust_backend.sh ios
- name: Setup Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
with:
channel: "stable"
flutter-version-file: .fvmrc
cache: true
- name: Configure Rust application pods
run: |
flutter pub get
cd ios
pod install
- name: Build and audit Rust iOS release application
run: |
flutter build ios --release --no-codesign --target lib/main.dart
python3 scripts/check_backend_ios.py build/ios/iphoneos/Runner.app \
--backend rust --archs arm64 --platform ios --release
android:
name: Android Rust builds & native tests
runs-on: ubuntu-latest
needs: changes
if: needs.changes.outputs.android == 'true'
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- name: Setup Java
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: "temurin"
java-version: "25"
- name: Setup Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2
with:
channel: "stable"
flutter-version-file: .fvmrc
cache: true
- name: Setup Gradle
uses: gradle/actions/setup-gradle@0723195856401067f7a2779048b490ace7a47d7c # v5
with:
gradle-version: "9.7.1"
- name: Install Android SDK & NDK
run: |
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses || true
$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager \
"ndk;29.0.14206865" \
"platforms;android-37.0" \
"build-tools;37.0.0"
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/29.0.14206865" >> "$GITHUB_ENV"
- name: Get Flutter dependencies
run: flutter pub get
- name: Configure Flutter SDK for Gradle
run: echo "flutter.sdk=$FLUTTER_ROOT" > android/local.properties
- name: Install Rust application build prerequisites
run: |
cd rust_backend
rustup show
sudo apt-get update
sudo apt-get install -y libclang-dev
- name: Package Rust application and run native unit tests
run: gradle -p android :app:assembleDebug :app:testDebugUnitTest
- name: Build Rust release application
run: bash scripts/build_android.sh --target lib/main.dart
- name: Verify Rust release APK payloads
run: |
python3 scripts/check_backend_apk.py \
build/app/outputs/flutter-apk/app-arm64-v8a-release.apk \
--backend rust --abis arm64-v8a
python3 scripts/check_backend_apk.py \
build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk \
--backend rust --abis armeabi-v7a