Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

ci: arm linux support (#2226)

Yohane-Mashiro10a5c0567077
diff --git a/.github/actions/flutter-arm64-setup/action.yml b/.github/actions/flutter-arm64-setup/action.yml
new file mode 100644
index 00000000..bd0aaa90
--- /dev/null
+++ b/.github/actions/flutter-arm64-setup/action.yml
@@ -0,0 +1,130 @@
+name: 'Setup Flutter for ARM64 Linux'
+description: 'Install Flutter SDK on ARM64 Linux runners (no snap, no prebuilt binary)'
+author: 'hare'
+
+branding:
+ icon: 'layers'
+ color: 'blue'
+
+inputs:
+ channel:
+ description: 'Flutter channel (stable, beta, main)'
+ required: false
+ default: 'stable'
+ flutter-version:
+ description: 'Specific Flutter version (git ref). Overrides flutter-version-file and channel if set.'
+ required: false
+ default: ''
+ flutter-version-file:
+ description: 'Path to pubspec.yaml containing environment.flutter.'
+ required: false
+ default: 'pubspec.yaml'
+ cache:
+ description: 'Cache the Flutter SDK'
+ required: false
+ default: 'true'
+ cache-key:
+ description: 'Additional cache key suffix'
+ required: false
+ default: ''
+ install-linux-deps:
+ description: 'Install Linux desktop build dependencies (clang, gtk3, etc.)'
+ required: false
+ default: 'true'
+
+outputs:
+ flutter-path:
+ description: 'Path to the Flutter SDK'
+ value: ${{ steps.setup.outputs.flutter-path }}
+ flutter-version:
+ description: 'Installed Flutter version'
+ value: ${{ steps.setup.outputs.flutter-version }}
+ dart-version:
+ description: 'Bundled Dart version'
+ value: ${{ steps.setup.outputs.dart-version }}
+
+runs:
+ using: 'composite'
+ steps:
+ - name: Install Linux desktop dependencies
+ if: inputs.install-linux-deps == 'true'
+ shell: bash
+ run: |
+ sudo apt-get update -y
+ sudo apt-get install -y --no-install-recommends \
+ clang \
+ libgtk-3-dev \
+ mesa-utils \
+ ninja-build \
+ pkg-config \
+ liblzma-dev \
+ libstdc++-12-dev
+
+ - name: Resolve Flutter version
+ id: resolve
+ shell: bash
+ run: |
+ REF="${{ inputs.flutter-version }}"
+ VERSION_FILE="${{ inputs.flutter-version-file }}"
+
+ if [ -z "$REF" ] && [ -n "$VERSION_FILE" ] && [ -f "$VERSION_FILE" ]; then
+ REF="$(awk '
+ /^[^[:space:]]/ { in_environment = ($1 == "environment:") }
+ in_environment && /^[[:space:]]+flutter:[[:space:]]*/ { print $2; exit }
+ ' "$VERSION_FILE")"
+ REF="$(printf '%s' "$REF" | tr -d "\"'")"
+ fi
+
+ if [ -z "$REF" ]; then
+ REF="${{ inputs.channel }}"
+ fi
+
+ echo "flutter-ref=$REF" >> "$GITHUB_OUTPUT"
+
+ - name: Cache Flutter SDK
+ if: inputs.cache == 'true'
+ id: cache-flutter
+ uses: actions/cache@v4
+ with:
+ path: ${{ runner.temp }}/flutter
+ key: flutter-arm64-${{ steps.resolve.outputs.flutter-ref }}-${{ runner.os }}-${{ inputs.cache-key }}
+
+ - name: Clone Flutter SDK
+ id: setup
+ shell: bash
+ run: |
+ FLUTTER_PATH="${{ runner.temp }}/flutter"
+
+ if [ -f "$FLUTTER_PATH/bin/flutter" ]; then
+ echo "Using cached Flutter SDK"
+ else
+ REF="${{ steps.resolve.outputs.flutter-ref }}"
+ git clone https://github.com/flutter/flutter.git \
+ -b "$REF" \
+ --depth 1 \
+ "$FLUTTER_PATH"
+ fi
+
+ # Add to PATH
+ echo "$FLUTTER_PATH/bin" >> "$GITHUB_PATH"
+
+ # Trigger Dart SDK download (auto-detects ARM64) and verify
+ VERSION_OUTPUT="$("$FLUTTER_PATH/bin/flutter" --version --machine)"
+ printf '%s\n' "$VERSION_OUTPUT" >&2
+
+ echo "flutter-path=$FLUTTER_PATH" >> "$GITHUB_OUTPUT"
+ printf '%s' "$VERSION_OUTPUT" | python3 -c 'import json, sys
+ s = sys.stdin.read()
+ start = s.find("{")
+ end = s.rfind("}")
+ if start == -1 or end == -1 or end < start:
+ raise SystemExit("Flutter version output did not contain JSON")
+ data = json.loads(s[start:end + 1])
+ print("flutter-version=" + data["frameworkVersion"])
+ print("dart-version=" + data["dartSdkVersion"].split()[0])' >> "$GITHUB_OUTPUT"
+
+ - name: Precache Flutter artifacts
+ shell: bash
+ run: |
+ flutter precache --linux || true
+ flutter doctor -v || true
diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml
index ab3e0d9f..e044a57e 100644
--- a/.github/workflows/pr.yaml
+++ b/.github/workflows/pr.yaml
@@ -291,10 +291,10 @@
name: macos_outputs
path: Kazumi_macos_*.dmg
- flutter-build-linux:
+ flutter-build-linux-amd64:
needs: [flutter-test, flutter-analyze]
if: ${{ (github.event_name == 'pull_request' && ! github.event.pull_request.draft) || (github.event_name == 'workflow_dispatch' && (inputs.run_linux || (! inputs.run_android && ! inputs.run_windows && ! inputs.run_ios && ! inputs.run_macos && ! inputs.run_linux))) }}
- name: "Release for Linux"
+ name: "Release for Linux amd64"
runs-on: "ubuntu-latest"
permissions: write-all
steps:
@@ -343,10 +343,10 @@
# token: ${{ secrets.GITHUB_TOKEN }}
# - run: rm -f build/linux/x64/release/bundle/lib/libffmpeg.so.7
# - run: unzip ffmpeg_linux_amd64.zip -d build/linux/x64/release/bundle/lib
- - name: Package linux build output
+ - name: Package linux amd64 build output
run: |
# Tarball package
- tar -zcvf Kazumi_linux_canary.tar.gz -C build/linux/x64/release/bundle .
+ tar -zcvf Kazumi_linux_canary_amd64.tar.gz -C build/linux/x64/release/bundle .
# Debian package
mkdir Kazumi_linux_canary_amd64
@@ -382,10 +382,91 @@
dpkg-deb --build --root-owner-group Kazumi_linux_canary_amd64
shell: bash
- - name: Upload linux outputs
+ - name: Upload linux amd64 outputs
uses: actions/upload-artifact@v4
with:
- name: linux_outputs
+ name: linux_amd64_outputs
+ path: |
+ Kazumi_linux_*.tar.gz
+ Kazumi_linux_*.deb
+
+ flutter-build-linux-arm64:
+ needs: [flutter-test, flutter-analyze]
+ if: ${{ (github.event_name == 'pull_request' && ! github.event.pull_request.draft) || (github.event_name == 'workflow_dispatch' && (inputs.run_linux || (! inputs.run_android && ! inputs.run_windows && ! inputs.run_ios && ! inputs.run_macos && ! inputs.run_linux))) }}
+ name: "Release for Linux arm64"
+ runs-on: ${{ vars.LINUX_ARM64_RUNNER || 'ubuntu-24.04-arm' }}
+ permissions: write-all
+ steps:
+ - name: Clone repository
+ uses: actions/checkout@v4
+ - name: Echo build progress
+ run: echo "Kazumi_linux_canary_arm64 build progress"
+ shell: bash
+ - name: Set up Flutter for ARM64
+ uses: ./.github/actions/flutter-arm64-setup
+ with:
+ channel: stable
+ flutter-version-file: pubspec.yaml
+ - name: Install project dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y cmake libwebkit2gtk-4.1-dev libsoup-3.0-dev libasound2-dev \
+ libayatana-appindicator3-dev libepoxy-dev libmpv-dev unzip
+ shell: bash
+ - name: Get Flutter dependencies
+ run: flutter pub get
+ shell: bash
+ - name: Build Flutter for Linux ARM64
+ run: >-
+ flutter build linux
+ --dart-define=DANDANAPI_APPID=$DANDANAPI_APPID
+ --dart-define=DANDANAPI_KEY=$DANDANAPI_KEY
+ --dart-define=KAZUMI_APPID=$KAZUMI_APPID
+ --dart-define=KAZUMI_KEY=$KAZUMI_KEY
+ shell: bash
+ - name: Package linux arm64 build output
+ run: |
+ # Tarball package
+ tar -zcvf Kazumi_linux_canary_arm64.tar.gz -C build/linux/arm64/release/bundle .
+
+ # Debian package
+ mkdir Kazumi_linux_canary_arm64
+ cd Kazumi_linux_canary_arm64
+ mkdir -p opt/Kazumi
+ mkdir -p usr/share/applications
+ mkdir -p usr/share/icons/hicolor/512x512/apps
+ cp -r ../build/linux/arm64/release/bundle/* opt/Kazumi
+ cp -r ../assets/linux/DEBIAN .
+ chmod 0755 DEBIAN/postinst
+ chmod 0755 DEBIAN/postrm
+
+ cat>DEBIAN/control<<EOF
+ Maintainer: madoka773 <[email protected]>
+ Package: Kazumi
+ Version: 0.0.1
+ Section: x11
+ Priority: optional
+ Architecture: arm64
+ Essential: no
+ Installed-Size: $(du -sk opt | cut -f1)
+ Description: Watch Animes online with danmaku support.
+ Homepage: https://github.com/Predidit/Kazumi
+ Depends: libayatana-appindicator3-1,
+ gir1.2-ayatanaappindicator3-0.1,
+ libwebkit2gtk-4.1-0
+ EOF
+
+ cp ../assets/linux/io.github.Predidit.Kazumi.desktop usr/share/applications
+ cp ../assets/images/logo/logo_linux.png usr/share/icons/hicolor/512x512/apps/io.github.Predidit.Kazumi.png
+
+ cd ..
+ dpkg-deb --build --root-owner-group Kazumi_linux_canary_arm64
+ shell: bash
+
+ - name: Upload linux arm64 outputs
+ uses: actions/upload-artifact@v4
+ with:
+ name: linux_arm64_outputs
path: |
Kazumi_linux_*.tar.gz
Kazumi_linux_*.deb
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index a6c6c473..dbec080f 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -113,7 +113,7 @@
flutter-build-windows:
name: "Release for windows"
runs-on: "windows-latest"
- needs: [flutter-build-android, flutter-build-ios, flutter-build-linux, flutter-build-macos]
+ needs: [flutter-build-android, flutter-build-ios, flutter-build-linux-amd64, flutter-build-linux-arm64, flutter-build-macos]
permissions: write-all
steps:
@@ -209,8 +209,8 @@
name: windows_msix_signed_outputs
path: build/windows/msix_signed_output/*.msix
- flutter-build-linux:
- name: "Release for Linux"
+ flutter-build-linux-amd64:
+ name: "Release for Linux amd64"
needs: [flutter-test, flutter-analyze]
runs-on: "ubuntu-latest"
permissions: write-all
@@ -221,7 +221,7 @@
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
shell: bash
- name: Echo build progress
- run: echo "Kazumi_linux_${{ env.tag }}.tar.gz build progress"
+ run: echo "Kazumi_linux_${{ env.tag }}_amd64.tar.gz build progress"
shell: bash
- name: Install dependencies
run: |
@@ -266,7 +266,7 @@
# token: ${{ secrets.GITHUB_TOKEN }}
# - run: rm -f build/linux/x64/release/bundle/lib/libffmpeg.so.7
# - run: unzip ffmpeg_linux_amd64.zip -d build/linux/x64/release/bundle/lib
- - name: Package linux build output
+ - name: Package linux amd64 build output
run: |
# Tarball package
tar -zcvf Kazumi_linux_${{ env.tag }}_amd64.tar.gz -C build/linux/x64/release/bundle .
@@ -305,10 +305,93 @@
dpkg-deb --build --root-owner-group Kazumi_linux_${{ env.tag }}_amd64
shell: bash
- - name: Upload linux outputs
+ - name: Upload linux amd64 outputs
uses: actions/upload-artifact@v4
with:
- name: linux_outputs
+ name: linux_amd64_outputs
+ path: |
+ Kazumi_linux_*.tar.gz
+ Kazumi_linux_*.deb
+
+ flutter-build-linux-arm64:
+ name: "Release for Linux arm64"
+ needs: [flutter-test, flutter-analyze]
+ runs-on: ${{ vars.LINUX_ARM64_RUNNER || 'ubuntu-24.04-arm' }}
+ permissions: write-all
+ steps:
+ - name: Clone repository
+ uses: actions/checkout@v4
+ - name: Extract tag name
+ run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
+ shell: bash
+ - name: Echo build progress
+ run: echo "Kazumi_linux_${{ env.tag }}_arm64 build progress"
+ shell: bash
+ - name: Set up Flutter for ARM64
+ uses: ./.github/actions/flutter-arm64-setup
+ with:
+ channel: stable
+ flutter-version-file: pubspec.yaml
+ - name: Install project dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y cmake libwebkit2gtk-4.1-dev libsoup-3.0-dev libasound2-dev \
+ libayatana-appindicator3-dev libepoxy-dev libmpv-dev unzip
+ shell: bash
+ - name: Get Flutter dependencies
+ run: flutter pub get
+ shell: bash
+ - name: Build Flutter for Linux ARM64
+ run: >-
+ flutter build linux
+ --dart-define=DANDANAPI_APPID=$DANDANAPI_APPID
+ --dart-define=DANDANAPI_KEY=$DANDANAPI_KEY
+ --dart-define=KAZUMI_APPID=$KAZUMI_APPID
+ --dart-define=KAZUMI_KEY=$KAZUMI_KEY
+ shell: bash
+ - name: Package linux arm64 build output
+ run: |
+ # Tarball package
+ tar -zcvf Kazumi_linux_${{ env.tag }}_arm64.tar.gz -C build/linux/arm64/release/bundle .
+
+ # Debian package
+ mkdir Kazumi_linux_${{ env.tag }}_arm64
+ cd Kazumi_linux_${{ env.tag }}_arm64
+ mkdir -p opt/Kazumi
+ mkdir -p usr/share/applications
+ mkdir -p usr/share/icons/hicolor/512x512/apps
+ cp -r ../build/linux/arm64/release/bundle/* opt/Kazumi
+ cp -r ../assets/linux/DEBIAN .
+ chmod 0755 DEBIAN/postinst
+ chmod 0755 DEBIAN/postrm
+
+ cat>DEBIAN/control<<EOF
+ Maintainer: madoka773 <[email protected]>
+ Package: Kazumi
+ Version: ${{ env.tag }}
+ Section: x11
+ Priority: optional
+ Architecture: arm64
+ Essential: no
+ Installed-Size: $(du -sk opt | cut -f1)
+ Description: Watch Animes online with danmaku support.
+ Homepage: https://github.com/Predidit/Kazumi
+ Depends: libayatana-appindicator3-1,
+ gir1.2-ayatanaappindicator3-0.1,
+ libwebkit2gtk-4.1-0
+ EOF
+
+ cp ../assets/linux/io.github.Predidit.Kazumi.desktop usr/share/applications
+ cp ../assets/images/logo/logo_linux.png usr/share/icons/hicolor/512x512/apps/io.github.Predidit.Kazumi.png
+
+ cd ..
+ dpkg-deb --build --root-owner-group Kazumi_linux_${{ env.tag }}_arm64
+ shell: bash
+
+ - name: Upload linux arm64 outputs
+ uses: actions/upload-artifact@v4
+ with:
+ name: linux_arm64_outputs
path: |
Kazumi_linux_*.tar.gz
Kazumi_linux_*.deb
@@ -464,15 +547,25 @@
- name: Copy macos build file to root
run: cp macos_outputs/* Kazumi_macos_${{ env.tag }}.dmg
- - name: Download linux build file
+ - name: Download linux amd64 build file
+ uses: actions/download-artifact@v4
+ with:
+ name: linux_amd64_outputs
+ path: linux_amd64_outputs
+ - name: List files in linux_amd64_outputs directory
+ run: ls -l linux_amd64_outputs
+ - name: Copy linux amd64 build file to root
+ run: cp linux_amd64_outputs/* .
+
+ - name: Download linux arm64 build file
uses: actions/download-artifact@v4
with:
- name: linux_outputs
- path: linux_outputs
- - name: List files in linux_outputs directory
- run: ls -l linux_outputs
- - name: Copy linux build file to root
- run: cp linux_outputs/* .
+ name: linux_arm64_outputs
+ path: linux_arm64_outputs
+ - name: List files in linux_arm64_outputs directory
+ run: ls -l linux_arm64_outputs
+ - name: Copy linux arm64 build file to root
+ run: cp linux_arm64_outputs/* .
- name: Sign APK
id: sign_app