Skip to content

Commit

Permalink
cd: use new hosted github runners
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Jan 24, 2025
1 parent becba89 commit 85ebaf6
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 91 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/spotube-release-binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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}}
Expand Down
8 changes: 6 additions & 2 deletions cli/commands/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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"],
);
}
}
2 changes: 2 additions & 0 deletions cli/commands/build/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,6 @@ mixin BuildCommandCommonSteps on Command {
""",
);
}

String get architecture => argResults?.option("arch") as String;
}
55 changes: 33 additions & 22 deletions cli/commands/build/linux.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
}
Expand Down
37 changes: 0 additions & 37 deletions cli/commands/build/linux_arm.dart

This file was deleted.

15 changes: 7 additions & 8 deletions cli/commands/install-dependencies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ class InstallDependenciesCommand extends Command {
],
mandatory: true,
);

argParser.addOption(
"arch",
abbr: "a",
allowed: ["x86", "arm64", "all"],
defaultsTo: "x86",
);
}

@override
Expand All @@ -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(
"""
Expand Down

0 comments on commit 85ebaf6

Please sign in to comment.