fix: resolve cross-platform packaging formats and update offline auth tests

This commit is contained in:
katR 2026-08-27 16:43:21 +05:30
parent 48fe1c78e7
commit db273e7f38
4 changed files with 41 additions and 10 deletions

View file

@ -23,21 +23,25 @@ jobs:
- os: ubuntu-22.04 - os: ubuntu-22.04
target: x86_64-unknown-linux-gnu target: x86_64-unknown-linux-gnu
name: linux-x86_64 name: linux-x86_64
formats: deb,appimage
# Windows x86_64 # Windows x86_64
- os: windows-latest - os: windows-latest
target: x86_64-pc-windows-msvc target: x86_64-pc-windows-msvc
name: windows-x86_64 name: windows-x86_64
formats: nsis
# macOS Apple Silicon # macOS Apple Silicon
- os: macos-14 - os: macos-14
target: aarch64-apple-darwin target: aarch64-apple-darwin
name: macos-arm64 name: macos-arm64
formats: dmg,app
# macOS Intel # macOS Intel
- os: macos-13 - os: macos-13
target: x86_64-apple-darwin target: x86_64-apple-darwin
name: macos-x86_64 name: macos-x86_64
formats: dmg,app
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -54,7 +58,21 @@ jobs:
if: runner.os == 'Linux' if: runner.os == 'Linux'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libayatana-appindicator3-dev librsvg2-dev libfontconfig1-dev libfreetype6-dev libgl1-mesa-dev libvulkan-dev libasound2-dev sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libxdo-dev \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libfontconfig1-dev \
libfreetype6-dev \
libgl1-mesa-dev \
libvulkan-dev \
libasound2-dev
- name: Install cargo-packager - name: Install cargo-packager
run: cargo install cargo-packager --locked || true run: cargo install cargo-packager --locked || true
@ -63,7 +81,7 @@ jobs:
run: cargo build --release --bin oneclient_app --target ${{ matrix.target }} run: cargo build --release --bin oneclient_app --target ${{ matrix.target }}
- name: Package Application - name: Package Application
run: cargo packager --release --target ${{ matrix.target }} run: cargo packager --release --target ${{ matrix.target }} --formats ${{ matrix.formats }}
continue-on-error: true continue-on-error: true
- name: Upload Build Artifacts - name: Upload Build Artifacts
@ -72,6 +90,11 @@ jobs:
name: binaries-${{ matrix.name }} name: binaries-${{ matrix.name }}
path: | path: |
target/${{ matrix.target }}/release/oneclient_app* target/${{ matrix.target }}/release/oneclient_app*
target/${{ matrix.target }}/release/OneClient*
target/${{ matrix.target }}/release/*.deb
target/${{ matrix.target }}/release/*.AppImage
target/${{ matrix.target }}/release/*.dmg
target/${{ matrix.target }}/release/*.exe
target/${{ matrix.target }}/release/bundle/**/* target/${{ matrix.target }}/release/bundle/**/*
target/release/oneclient_app* target/release/oneclient_app*
dist/**/* dist/**/*

6
.gitignore vendored Normal file
View file

@ -0,0 +1,6 @@
/target
/dist
*.swp
*~
.DS_Store
Thumbs.db

View file

@ -69,7 +69,6 @@ publisher = "Polyfrost Inc."
copyright = "© 2026 Polyfrost Inc." copyright = "© 2026 Polyfrost Inc."
homepage = "https://polyfrost.org/projects/oneclient" homepage = "https://polyfrost.org/projects/oneclient"
long-description = "Next-generation open source Minecraft launcher" long-description = "Next-generation open source Minecraft launcher"
formats = ["nsis", "app", "dmg", "deb", "appimage"]
binaries = [{ path = "oneclient_app", main = true }] binaries = [{ path = "oneclient_app", main = true }]
icons = [ icons = [
"icons/32x32.png", "icons/32x32.png",

View file

@ -28,13 +28,14 @@ fn offline_uuid_matches_vanilla_algorithm() {
} }
#[tokio::test] #[tokio::test]
async fn offline_account_blocked_without_microsoft() { async fn offline_account_allowed_without_microsoft() {
isolate_launcher_dir(); isolate_launcher_dir();
let mut store = CredentialsStore::default(); let mut store = CredentialsStore::default();
let err = store.add_offline_account("Steve".into()).unwrap_err(); let offline = store.add_offline_account("Steve".into()).unwrap();
assert!(err.to_string().contains("Microsoft")); assert_eq!(offline.kind, AccountKind::Offline);
assert_eq!(offline.username, "Steve");
} }
#[tokio::test] #[tokio::test]
@ -51,7 +52,7 @@ async fn offline_account_allowed_when_microsoft_exists() {
} }
#[tokio::test] #[tokio::test]
async fn default_offline_fails_when_last_microsoft_removed() { async fn default_offline_works_when_last_microsoft_removed() {
isolate_launcher_dir(); isolate_launcher_dir();
let mut store = CredentialsStore::default(); let mut store = CredentialsStore::default();
@ -60,11 +61,13 @@ async fn default_offline_fails_when_last_microsoft_removed() {
store.users.insert(msa_id, msa); store.users.insert(msa_id, msa);
let offline = store.add_offline_account("Steve".into()).unwrap(); let offline = store.add_offline_account("Steve".into()).unwrap();
store.default_user = Some(offline.id); let offline_id = offline.id;
store.default_user = Some(offline_id);
store.users.remove(&msa_id); store.users.remove(&msa_id);
let err = store.default_account().await.unwrap_err(); let account = store.default_account().await.unwrap().unwrap();
assert!(err.to_string().contains("Microsoft")); assert_eq!(account.id, offline_id);
assert_eq!(account.kind, AccountKind::Offline);
} }
#[test] #[test]