diff --git a/.github/workflows/spotube-release-binary.yml b/.github/workflows/spotube-release-binary.yml index a4afcab3..410cb835 100644 --- a/.github/workflows/spotube-release-binary.yml +++ b/.github/workflows/spotube-release-binary.yml @@ -33,31 +33,37 @@ jobs: include: - os: ubuntu-latest platform: linux + arch: x86 files: | 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 + - os: ubuntu-22.04-arm + platform: linux + arch: arm64 files: | dist/Spotube-linux-aarch64.deb dist/spotube-linux-*-aarch64.tar.xz - os: ubuntu-latest platform: android + arch: all files: | build/Spotube-android-all-arch.apk build/Spotube-playstore-all-arch.aab - os: windows-latest platform: windows + arch: x86 files: | dist/Spotube-windows-x86_64.nupkg dist/Spotube-windows-x86_64-setup.exe - os: macos-latest platform: ios + arch: all files: | Spotube-iOS.ipa - os: macos-14 platform: macos + arch: all files: | build/Spotube-macos-universal.dmg build/Spotube-macos-universal.pkg @@ -78,14 +84,8 @@ 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: Setup Rust toolchain - if: ${{matrix.platform != 'linux_arm'}} uses: dtolnay/rust-toolchain@stable with: toolchain: stable @@ -107,20 +107,8 @@ jobs: echo '${{ secrets.KEYSTORE }}' | base64 --decode > android/app/upload-keystore.jks echo '${{ secrets.KEY_PROPERTIES }}' > android/key.properties - - name: Uncessary hosted tools - if: ${{matrix.platform == 'linux_arm'}} - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - swap-storage: false - android: true - dotnet: true - haskell: true - large-packages: true - docker-images: true - - name: Build ${{matrix.platform}} binaries - run: dart cli/cli.dart build ${{matrix.platform}} + run: dart cli/cli.dart build --arch=${{matrix.arch}} ${{matrix.platform}} env: CHANNEL: ${{inputs.channel}} DOTENV: ${{secrets.DOTENV_RELEASE}} diff --git a/cli/commands/build.dart b/cli/commands/build.dart index fdf35a95..e0c254ff 100644 --- a/cli/commands/build.dart +++ b/cli/commands/build.dart @@ -3,7 +3,6 @@ import 'package:args/command_runner.dart'; import 'build/android.dart'; import 'build/ios.dart'; import 'build/linux.dart'; -import 'build/linux_arm.dart'; import 'build/macos.dart'; import 'build/windows.dart'; @@ -18,8 +17,13 @@ class BuildCommand extends Command { addSubcommand(AndroidBuildCommand()); addSubcommand(IosBuildCommand()); addSubcommand(LinuxBuildCommand()); - addSubcommand(LinuxArmBuildCommand()); addSubcommand(MacosBuildCommand()); addSubcommand(WindowsBuildCommand()); + argParser.addOption( + "arch", + abbr: "a", + defaultsTo: "x86", + allowed: ["x86", "arm64", "all"], + ); } } diff --git a/cli/commands/build/common.dart b/cli/commands/build/common.dart index 4c7e3e51..f6f6ad50 100644 --- a/cli/commands/build/common.dart +++ b/cli/commands/build/common.dart @@ -63,4 +63,6 @@ mixin BuildCommandCommonSteps on Command { """, ); } + + String get architecture => argResults?.option("arch") as String; } diff --git a/cli/commands/build/linux.dart b/cli/commands/build/linux.dart index a218720c..f61ffbce 100644 --- a/cli/commands/build/linux.dart +++ b/cli/commands/build/linux.dart @@ -37,23 +37,32 @@ class LinuxBuildCommand extends Command with BuildCommandCommonSteps { await bootstrap(); await shell.run( - """ - flutter_distributor package --platform=linux --targets=deb - flutter_distributor package --platform=linux --targets=rpm - """, + "flutter_distributor package --platform=linux --targets=deb", ); + if (architecture == "x86") { + await shell.run( + "flutter_distributor package --platform=linux --targets=rpm", + ); + } + final tempDir = join(Directory.systemTemp.path, "spotube-tar"); - final bundleDirPath = - join(cwd.path, "build", "linux", "x64", "release", "bundle"); + final bundleDirPath = join( + cwd.path, + "build", + "linux", + architecture == "x86" ? "x64" : architecture, + "release", + "bundle", + ); final tarFile = File(join( cwd.path, "dist", "spotube-linux-" "${CliEnv.channel == BuildChannel.nightly ? "nightly" : versionWithoutBuildNumber}" - "-x86_64.tar.xz", + "-${architecture == "x86" ? "x86_64" : "aarch64"}.tar.xz", )); await copyPath(bundleDirPath, tempDir); @@ -81,25 +90,27 @@ class LinuxBuildCommand extends Command with BuildCommandCommonSteps { "spotube-${pubspec.version}-linux.deb", ), ); - - final ogRpm = File( - join( - cwd.path, - "dist", - pubspec.version.toString(), - "spotube-${pubspec.version}-linux.rpm", - ), - ); - await ogDeb.copy( join(cwd.path, "dist", "Spotube-linux-x86_64.deb"), ); - await ogRpm.copy( - join(cwd.path, "dist", "Spotube-linux-x86_64.rpm"), - ); - await ogDeb.delete(); - await ogRpm.delete(); + + if (architecture == "x86") { + final ogRpm = File( + join( + cwd.path, + "dist", + pubspec.version.toString(), + "spotube-${pubspec.version}-linux.rpm", + ), + ); + + await ogRpm.copy( + join(cwd.path, "dist", "Spotube-linux-x86_64.rpm"), + ); + + await ogRpm.delete(); + } stdout.writeln("✅ Linux building done"); } diff --git a/cli/commands/build/linux_arm.dart b/cli/commands/build/linux_arm.dart deleted file mode 100644 index a09f0980..00000000 --- a/cli/commands/build/linux_arm.dart +++ /dev/null @@ -1,37 +0,0 @@ -import 'dart:async'; - -import 'package:args/command_runner.dart'; -import 'package:path/path.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 ${join(cwd.path, ".github", "Dockerfile")} ${cwd.path} " - "--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/ - """, - ); - } -} diff --git a/cli/commands/install-dependencies.dart b/cli/commands/install-dependencies.dart index dc519cc6..e26b8078 100644 --- a/cli/commands/install-dependencies.dart +++ b/cli/commands/install-dependencies.dart @@ -24,6 +24,13 @@ class InstallDependenciesCommand extends Command { ], mandatory: true, ); + + argParser.addOption( + "arch", + abbr: "a", + allowed: ["x86", "arm64", "all"], + defaultsTo: "x86", + ); } @override @@ -41,14 +48,6 @@ 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( """