feat: add linux_arm platform

This commit is contained in:
Kingkor Roy Tirtho 2024-05-09 14:03:40 +06:00
parent 28a213831d
commit 97a58f0b2c
5 changed files with 62 additions and 8 deletions

13
.github/Dockerfile vendored
View File

@ -10,17 +10,14 @@ COPY . .
RUN chown -R $(whoami) /app
RUN flutter pub get &&\
flutter config --enable-linux-desktop &&\
flutter pub get &&\
dart run build_runner build --delete-conflicting-outputs
RUN alias dpkg-deb="dpkg-deb --Zxz" &&\
flutter_distributor package --platform=linux --targets=deb
RUN flutter pub get
RUN make tar VERSION=${BUILD_VERSION} ARCH=arm64 PKG_ARCH=aarch64
RUN alias dpkg-deb="dpkg-deb --Zxz" &&\
flutter_distributor package --platform=linux --targets=deb --skip-clean
RUN mv build/spotube-linux-*-aarch64.tar.xz dist/ &&\
mv dist/**/spotube-*-linux.deb dist/Spotube-linux-aarch64.deb

View File

@ -36,6 +36,11 @@ jobs:
dist/Spotube-linux-x86_64.deb
dist/Spotube-linux-x86_64.rpm
dist/spotube-linux-*-x86_64.tar.xz
- os: ubuntu-latest
platform: linux_arm
files: |
dist/Spotube-linux-aarch64.deb
dist/spotube-linux-*-aarch64.tar.xz
- os: ubuntu-latest
platform: android
files: |
@ -70,6 +75,12 @@ jobs:
java-version: '17'
cache: 'gradle'
check-latest: true
- name: Set up QEMU
if: ${{matrix.platform == 'linux_arm'}}
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
if: ${{matrix.platform == 'linux_arm'}}
uses: docker/setup-buildx-action@v3
- name: Install ${{matrix.platform}} dependencies
run: |

View File

@ -0,0 +1,36 @@
import 'dart:async';
import 'package:args/command_runner.dart';
import '../../core/env.dart';
import 'common.dart';
class LinuxArmBuildCommand extends Command with BuildCommandCommonSteps {
@override
String get description => "Build Linux Arm";
@override
String get name => "linux_arm";
@override
FutureOr? run() async {
await bootstrap();
await shell.run(
"docker buildx build --platform=linux/arm64 "
"-f .github/Dockerfile . "
"--build-arg FLUTTER_VERSION=${CliEnv.flutterVersion} "
"--build-arg BUILD_VERSION=${CliEnv.channel == BuildChannel.nightly ? "nightly" : versionWithoutBuildNumber} "
"-t krtirtho/spotube_linux_arm:latest "
"--load",
);
await shell.run(
"""
docker images ls
docker create --name spotube_linux_arm krtirtho/spotube_linux_arm:latest
docker cp spotube_linux_arm:/app/dist/ dist/
""",
);
}
}

View File

@ -17,6 +17,7 @@ class InstallDependenciesCommand extends Command {
allowed: [
"windows",
"linux",
"linux_arm",
"macos",
"ios",
"android",
@ -40,6 +41,14 @@ class InstallDependenciesCommand extends Command {
""",
);
break;
case "linux_arm":
await shell.run(
"""
sudo apt-get update -y
sudo apt-get install -y pkg-config make python3-pip python3-setuptools
""",
);
break;
case "macos":
await shell.run(
"""

View File

@ -20,4 +20,5 @@ class CliEnv {
static final channel = BuildChannel.fromEnvironment("CHANNEL");
static final dotenv = Platform.environment["DOTENV"]!;
static final ghRunNumber = Platform.environment["GITHUB_RUN_NUMBER"];
static final flutterVersion = Platform.environment["FLUTTER_VERSION"]!;
}