diff --git a/.github/workflows/release-flatpak.yml b/.github/workflows/release-flatpak.yml index ff270581b..cf6194d1e 100644 --- a/.github/workflows/release-flatpak.yml +++ b/.github/workflows/release-flatpak.yml @@ -1,24 +1,43 @@ +# Flatpak bundle for GitHub Releases — Slint binary (crates/ workspace). +# +# Rewritten 2026-07-02 for the Tauri -> Slint migration (v2.0). Builds +# packaging/flatpak/com.blitzfc.qbz.yml (network manifest) with +# flatpak-builder and attaches the .flatpak bundle to the Release. +# Flathub proper is a separate repo/manifest updated at tag time via +# scripts/update-flathub.sh (offline sources). +# +# The cargo build runs on the HOST's resources even though it happens +# inside the flatpak sandbox, so this runner needs the same swap headroom +# as release-linux.yml (qbz_ui rustc peak ~30 GB). + name: release-flatpak on: workflow_dispatch: inputs: tag: - description: "Optional release tag to build (e.g. v0.1.0)" + description: "Optional release tag to build (e.g. v2.0.0). Empty = build HEAD, no Release publish." required: false type: string push: tags: - "v*" +concurrency: + group: release-flatpak-${{ github.ref }} + cancel-in-progress: false + jobs: build-flatpak: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 + timeout-minutes: 300 permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Resolve release version id: release @@ -30,56 +49,58 @@ jobs: VERSION="${{ inputs.tag }}" VERSION="${VERSION#v}" fi + PRERELEASE=false + if [[ "$VERSION" =~ -(rc|beta|alpha|pre) ]]; then + PRERELEASE=true + fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT" - - name: Sync version to build metadata + - name: Verify tag is on main + if: startsWith(github.ref, 'refs/tags/') + run: | + git fetch origin main + if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then + echo "::error::Tag ${GITHUB_REF#refs/tags/} is not on main. Releases are cut from main only." + exit 1 + fi + + # Keep the metainfo's top entry honest (version + date). + - name: Sync metainfo release entry if: steps.release.outputs.version != '' env: QBZ_VERSION: ${{ steps.release.outputs.version }} run: | - python - <<'PY' - import json - import os - import pathlib - import re - - version = os.environ["QBZ_VERSION"] - - def update_json(path, updater): - p = pathlib.Path(path) - data = json.loads(p.read_text(encoding="utf-8")) - updater(data) - p.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8") - - update_json("package.json", lambda d: d.__setitem__("version", version)) - - def update_lock(d): - d["version"] = version - packages = d.get("packages") - if isinstance(packages, dict) and "" in packages: - packages[""]["version"] = version - update_json("package-lock.json", update_lock) - - update_json("src-tauri/tauri.conf.json", lambda d: d.__setitem__("version", version)) - - cargo_path = pathlib.Path("src-tauri/Cargo.toml") - cargo_text = cargo_path.read_text(encoding="utf-8") - cargo_text = re.sub(r'(?m)^version = \"[^\"]+\"', f'version = \"{version}\"', cargo_text, count=1) - cargo_path.write_text(cargo_text, encoding="utf-8") - - # Update Flatpak metainfo.xml with version and date + python3 - <<'PY' + import os, pathlib, re from datetime import date - metainfo_path = pathlib.Path("packaging/flatpak/com.blitzfc.qbz.metainfo.xml") - metainfo_text = metainfo_path.read_text(encoding="utf-8") - today = date.today().isoformat() - metainfo_text = re.sub( + version = os.environ["QBZ_VERSION"] + p = pathlib.Path("packaging/flatpak/com.blitzfc.qbz.metainfo.xml") + text = p.read_text(encoding="utf-8") + text = re.sub( r'', - f'', - metainfo_text + f'', + text, + count=1, ) - metainfo_path.write_text(metainfo_text, encoding="utf-8") + p.write_text(text, encoding="utf-8") PY + - name: Free disk space and add swap + run: | + sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \ + /opt/hostedtoolcache /usr/local/share/boost /usr/share/swift \ + /usr/local/lib/node_modules || true + sudo docker system prune -af || true + if sudo fallocate -l 18G /swap_extra; then + sudo chmod 600 /swap_extra + sudo mkswap /swap_extra + sudo swapon /swap_extra + else + echo "::warning::could not allocate extra swap; build may OOM" + fi + free -h + - name: Install flatpak tooling run: | sudo apt-get update @@ -88,13 +109,10 @@ jobs: - name: Install runtimes run: | - # Install GNOME runtime and SDK first flatpak install --user -y --noninteractive flathub \ org.gnome.Platform//49 \ org.gnome.Sdk//49 - # Install SDK extensions - flatpak-builder will auto-resolve the correct version based on the SDK flatpak install --user -y --noninteractive flathub \ - org.freedesktop.Sdk.Extension.node24//25.08 \ org.freedesktop.Sdk.Extension.rust-stable//25.08 \ org.freedesktop.Sdk.Extension.llvm20//25.08 @@ -125,5 +143,5 @@ jobs: uses: softprops/action-gh-release@v2 with: files: dist/${{ steps.build_flatpak.outputs.bundle_name }} - prerelease: ${{ contains(steps.release.outputs.version, '-rc') }} - make_latest: ${{ contains(steps.release.outputs.version, '-rc') && 'false' || 'true' }} + prerelease: ${{ steps.release.outputs.prerelease }} + make_latest: ${{ steps.release.outputs.prerelease == 'true' && 'false' || 'true' }} diff --git a/.github/workflows/release-linux-aarch64.yml b/.github/workflows/release-linux-aarch64.yml index eb29dd4e7..a4e1456e3 100644 --- a/.github/workflows/release-linux-aarch64.yml +++ b/.github/workflows/release-linux-aarch64.yml @@ -1,29 +1,47 @@ -name: Linux ARM64 (aarch64) Build +# Linux aarch64 release — Slint binary (crates/ workspace). +# +# Rewritten 2026-07-02 for the Tauri -> Slint migration (v2.0). Same +# build-once-package-many shape as release-linux.yml (read that file's +# header); differences: native arm64 runner, no x86 target-features, its +# own rust-cache key (this workflow is the only writer), and it ATTACHES +# to the Release that release-linux.yml creates. +# +# CONTRACT: keeps publishing qbz_${VERSION}_aarch64.tar.gz, +# QBZ_${VERSION}_arm64.deb, QBZ-${VERSION}-1.aarch64.rpm, +# QBZ_${VERSION}_aarch64.AppImage — AUR/Gentoo/APT/website names. + +name: "Linux ARM64 (aarch64) Build" on: workflow_dispatch: inputs: tag: - description: "Optional release tag to build (e.g. v1.1.7)" + description: "Optional release tag to build (e.g. v2.0.0). Empty = build HEAD with the Cargo.toml version, no Release publish." required: false type: string push: tags: - "v*" -jobs: - build-linux-aarch64: - name: Build Linux ARM64 - runs-on: ubuntu-24.04-arm - continue-on-error: true - permissions: - contents: write +concurrency: + group: release-linux-aarch64-${{ github.ref }} + cancel-in-progress: false +jobs: + build: + runs-on: ubuntu-24.04-arm + timeout-minutes: 300 + continue-on-error: true + outputs: + version: ${{ steps.release.outputs.version }} + prerelease: ${{ steps.release.outputs.prerelease }} steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Determine version + - name: Resolve release version id: release run: | VERSION="" @@ -32,101 +50,190 @@ jobs: elif [[ -n "${{ inputs.tag }}" ]]; then VERSION="${{ inputs.tag }}" VERSION="${VERSION#v}" + else + VERSION="$(grep -m1 '^version = ' crates/Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" + fi + PRERELEASE=false + if [[ "$VERSION" =~ -(rc|beta|alpha|pre) ]]; then + PRERELEASE=true fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT" - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 24 - cache: npm + - name: Verify tag is on main + if: startsWith(github.ref, 'refs/tags/') + run: | + git fetch origin main + if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then + echo "::error::Tag ${GITHUB_REF#refs/tags/} is not on main. Releases are cut from main only." + exit 1 + fi - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable + - name: Free disk space and add swap + run: | + sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \ + /opt/hostedtoolcache /usr/local/share/boost /usr/share/swift \ + /usr/local/lib/node_modules || true + sudo docker system prune -af || true + if sudo fallocate -l 18G /swap_extra; then + sudo chmod 600 /swap_extra + sudo mkswap /swap_extra + sudo swapon /swap_extra + else + echo "::warning::could not allocate extra swap; build may OOM" + fi + free -h - name: Install system dependencies run: | sudo apt-get update - # Pin WebKitGTK to 2.44.0-2 to prevent EGL_BAD_PARAMETER crash in AppImage - # See: https://github.com/tauri-apps/tauri/issues/11994 sudo apt-get install -y \ - libwebkit2gtk-4.1-0=2.44.0-2 \ - libwebkit2gtk-4.1-dev=2.44.0-2 \ - libjavascriptcoregtk-4.1-0=2.44.0-2 \ - libjavascriptcoregtk-4.1-dev=2.44.0-2 \ - gir1.2-javascriptcoregtk-4.1=2.44.0-2 \ - gir1.2-webkit2-4.1=2.44.0-2 \ - libgtk-3-dev \ - libappindicator3-dev \ - librsvg2-dev \ - libasound2-dev \ - patchelf \ - build-essential \ - xdg-utils + mold nasm \ + libasound2-dev libjack-jackd2-dev \ + libfontconfig1-dev libfreetype-dev \ + libxkbcommon-dev libwayland-dev libxcb1-dev \ + libgl1-mesa-dev libegl1-mesa-dev \ + libdbus-1-dev libssl-dev \ + libharfbuzz-dev libjbig2dec0-dev libopenjp2-7-dev \ + libjpeg-dev zlib1g-dev libgumbo-dev - - name: Install frontend deps - run: npm ci + # Pinned nightly: matches build-slint.yml / release-linux.yml. + - name: Setup Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2026-06-23 - - name: Build frontend - run: npm run build + - name: Rust cache + uses: Swatinem/rust-cache@v2 + with: + workspaces: crates -> target + shared-key: slint-linux-aarch64 + cache-on-failure: true + # This workflow is the only aarch64 builder, so it owns its cache. + save-if: true - - name: Build Tauri (deb + rpm + appimage) + - name: Build (release, MIN memory tier) + env: + CARGO_INCREMENTAL: "0" + CARGO_BUILD_JOBS: "1" + CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "256" + CARGO_PROFILE_RELEASE_OPT_LEVEL: "2" + CARGO_PROFILE_RELEASE_STRIP: "none" + # No x86 target-features here (aarch64 baseline has NEON). + RUSTFLAGS: "-C link-arg=-fuse-ld=mold -Z threads=1" + run: | + cargo build --release --manifest-path crates/Cargo.toml -p qbz + cp crates/target/release/qbz qbz-unstripped + strip -o qbz crates/target/release/qbz + ls -la qbz qbz-unstripped + + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: qbz-linux-aarch64 + path: qbz + if-no-files-found: error + + - name: Upload unstripped binary (symbolication) + uses: actions/upload-artifact@v4 + with: + name: qbz-linux-aarch64-unstripped + path: qbz-unstripped + retention-days: 90 + + package: + needs: build + runs-on: ubuntu-24.04-arm + permissions: + contents: write + env: + VERSION: ${{ needs.build.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download binary + uses: actions/download-artifact@v4 + with: + name: qbz-linux-aarch64 + + - name: Install nfpm + run: | + echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | \ + sudo tee /etc/apt/sources.list.d/goreleaser.list + sudo apt-get update + sudo apt-get install -y nfpm + nfpm --version + + - name: Build deb + rpm (nfpm) + env: + QBZ_VERSION: ${{ env.VERSION }} + QBZ_ARCH: arm64 + QBZ_BINARY: ./qbz + run: | + chmod +x qbz + mkdir -p dist + nfpm package -f packaging/nfpm/nfpm.yaml -p deb \ + -t "dist/QBZ_${VERSION}_arm64.deb" + nfpm package -f packaging/nfpm/nfpm.yaml -p rpm \ + -t "dist/QBZ-${VERSION}-1.aarch64.rpm" + + - name: Build AppImage + run: | + APPDIR="QBZ.AppDir" + mkdir -p "$APPDIR/usr/bin" + cp qbz "$APPDIR/usr/bin/qbz" + cp packaging/linux/qbz.desktop "$APPDIR/qbz.desktop" + cp packaging/icons/256x256.png "$APPDIR/qbz.png" + cp packaging/icons/256x256.png "$APPDIR/.DirIcon" + ln -s usr/bin/qbz "$APPDIR/AppRun" + + curl -fsSL -o appimagetool \ + https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-aarch64.AppImage + chmod +x appimagetool + ARCH=aarch64 ./appimagetool --appimage-extract-and-run "$APPDIR" \ + "dist/QBZ_${VERSION}_aarch64.AppImage" + + # Tauri-updater bridge — see release-linux.yml for the rationale. + - name: Sign AppImage (Tauri-updater bridge) + if: startsWith(github.ref, 'refs/tags/') env: TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} - run: npm run tauri build -- --bundles deb,rpm,appimage - - - name: Collect artifacts - env: - VERSION: ${{ steps.release.outputs.version }} run: | - mkdir -p dist - cp -v src-tauri/target/release/bundle/deb/*.deb dist/ || true - cp -v src-tauri/target/release/bundle/rpm/*.rpm dist/ || true - cp -v src-tauri/target/release/bundle/appimage/*.AppImage dist/ || true - cp -v src-tauri/target/release/bundle/appimage/*.AppImage.sig dist/ || true + npx --yes @tauri-apps/cli@^2 signer sign \ + --private-key "$TAURI_SIGNING_PRIVATE_KEY" \ + --password "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" \ + "dist/QBZ_${VERSION}_aarch64.AppImage" + ls -la dist - # Create AUR tarball - ARCH=aarch64 - TARBALL_DIR="qbz_${VERSION}_${ARCH}" + - name: Build AUR/Gentoo tarball + run: | + # CONTRACT: same name + internal layout as the Tauri-era tarball. + TARBALL_DIR="qbz_${VERSION}_aarch64" mkdir -p "tarball-staging/${TARBALL_DIR}/icons/hicolor"/{32x32,48x48,64x64,128x128,256x256}/apps - - # Binary - cp src-tauri/target/release/qbz "tarball-staging/${TARBALL_DIR}/qbz" - - # Icons - cp src-tauri/icons/32x32.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/32x32/apps/qbz.png" - cp src-tauri/icons/128x128.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/48x48/apps/qbz.png" - cp src-tauri/icons/128x128.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/64x64/apps/qbz.png" - cp src-tauri/icons/128x128.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/128x128/apps/qbz.png" - cp src-tauri/icons/128x128@2x.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/256x256/apps/qbz.png" - - # Desktop file - cat > "tarball-staging/${TARBALL_DIR}/qbz.desktop" << 'EOF' - [Desktop Entry] - Name=QBZ - Comment=Native Qobuz client with hi-res audio support - Exec=qbz - Icon=qbz - Terminal=false - Type=Application - Categories=AudioVideo;Audio;Music;Player; - Keywords=music;audio;qobuz;hifi;streaming;audiophile; - EOF - - tar -czf "dist/qbz_${VERSION}_${ARCH}.tar.gz" -C tarball-staging "${TARBALL_DIR}" + cp qbz "tarball-staging/${TARBALL_DIR}/qbz" + chmod +x "tarball-staging/${TARBALL_DIR}/qbz" + cp packaging/icons/32x32.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/32x32/apps/qbz.png" + cp packaging/icons/48x48.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/48x48/apps/qbz.png" + cp packaging/icons/64x64.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/64x64/apps/qbz.png" + cp packaging/icons/128x128.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/128x128/apps/qbz.png" + cp packaging/icons/256x256.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/256x256/apps/qbz.png" + cp packaging/linux/qbz.desktop "tarball-staging/${TARBALL_DIR}/qbz.desktop" + tar -czvf "dist/qbz_${VERSION}_aarch64.tar.gz" -C tarball-staging "${TARBALL_DIR}" ls -la dist - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: qbz-linux-aarch64 + name: qbz-linux-aarch64-packages path: dist/* + # Attaches to the Release created by release-linux.yml. - name: Publish GitHub Release Assets if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: files: dist/* - prerelease: ${{ contains(steps.release.outputs.version, '-rc') }} - make_latest: ${{ contains(steps.release.outputs.version, '-rc') && 'false' || 'true' }} + prerelease: ${{ needs.build.outputs.prerelease }} + make_latest: ${{ needs.build.outputs.prerelease == 'true' && 'false' || 'true' }} diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 44b3b65ec..30a995255 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -1,30 +1,50 @@ +# Linux x86_64 release — Slint binary (crates/ workspace). +# +# Rewritten 2026-07-02 for the Tauri -> Slint migration (v2.0). Pattern: +# build once, package many. The build job produces the binary with the +# proven public-runner recipe from build-slint.yml (16 GB RAM + 18 GB extra +# swap covers the ~30 GB qbz_ui rustc peak, MIN memory tier, mold, pinned +# nightly); the package job turns it into deb/rpm (nfpm), AppImage, and the +# AUR/Gentoo/APT tarball, then creates the GitHub Release. +# +# CONTRACT (do not break): the release must keep publishing +# qbz_${VERSION}_amd64.tar.gz (dir qbz_${VERSION}_amd64/{qbz, qbz.desktop, icons/hicolor/...}) +# QBZ_${VERSION}_amd64.deb / QBZ-${VERSION}-1.x86_64.rpm / QBZ_${VERSION}_amd64.AppImage +# — release-aur.yml, release-gentoo.yml, qbz-apt and the website consume +# these names. +# +# Triggers: version tags (cut from main — enforced by the ancestry guard) +# + manual dispatch (guard skipped, for testing on any branch). + name: release-linux on: workflow_dispatch: inputs: tag: - description: "Optional release tag to build (e.g. v0.1.0)" + description: "Optional release tag to build (e.g. v2.0.0). Empty = build HEAD with the Cargo.toml version, no Release publish." required: false type: string push: tags: - "v*" +concurrency: + group: release-linux-${{ github.ref }} + cancel-in-progress: false + jobs: - build-linux: + build: runs-on: ubuntu-24.04 - permissions: - contents: write + timeout-minutes: 300 + outputs: + version: ${{ steps.release.outputs.version }} + prerelease: ${{ steps.release.outputs.prerelease }} steps: - name: Checkout uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 with: - node-version: 24 - cache: npm + fetch-depth: 0 - name: Resolve release version id: release @@ -35,118 +55,214 @@ jobs: elif [[ -n "${{ inputs.tag }}" ]]; then VERSION="${{ inputs.tag }}" VERSION="${VERSION#v}" + else + # Manual dispatch without a tag: test build at the Cargo.toml version. + VERSION="$(grep -m1 '^version = ' crates/Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" + fi + PRERELEASE=false + if [[ "$VERSION" =~ -(rc|beta|alpha|pre) ]]; then + PRERELEASE=true fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT" + echo "Building version $VERSION (prerelease=$PRERELEASE)" - - name: Sync version to build metadata - if: steps.release.outputs.version != '' - env: - QBZ_VERSION: ${{ steps.release.outputs.version }} + # Release tags must be cut from main. A tag on any other commit fires + # this workflow too (tags are not branch-scoped in Actions), so verify + # ancestry instead of trusting convention. Manual dispatch skips this + # (that is the testing path). + - name: Verify tag is on main + if: startsWith(github.ref, 'refs/tags/') run: | - python - <<'PY' - import json - import os - import pathlib - import re + git fetch origin main + if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then + echo "::error::Tag ${GITHUB_REF#refs/tags/} points to a commit that is NOT on main. Releases are cut from main only." + exit 1 + fi - version = os.environ["QBZ_VERSION"] + # Fail fast if the version bump was forgotten: the binary embeds the + # workspace version (About dialog, diagnostics), so a mismatched tag + # would ship a binary that reports the wrong version. + - name: Assert Cargo.toml version matches tag + if: startsWith(github.ref, 'refs/tags/') + env: + VERSION: ${{ steps.release.outputs.version }} + run: | + CARGO_VERSION="$(grep -m1 '^version = ' crates/Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" + if [[ "$CARGO_VERSION" != "$VERSION" ]]; then + echo "::error::crates/Cargo.toml workspace version ($CARGO_VERSION) != tag version ($VERSION). Bump it before tagging (see RELEASE_CHECKLIST)." + exit 1 + fi - def update_json(path, updater): - p = pathlib.Path(path) - data = json.loads(p.read_text(encoding="utf-8")) - updater(data) - p.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8") - - update_json("package.json", lambda d: d.__setitem__("version", version)) - - def update_lock(d): - d["version"] = version - packages = d.get("packages") - if isinstance(packages, dict) and "" in packages: - packages[""]["version"] = version - update_json("package-lock.json", update_lock) - - update_json("src-tauri/tauri.conf.json", lambda d: d.__setitem__("version", version)) - - cargo_path = pathlib.Path("src-tauri/Cargo.toml") - cargo_text = cargo_path.read_text(encoding="utf-8") - cargo_text = re.sub(r'(?m)^version = \"[^\"]+\"', f'version = \"{version}\"', cargo_text, count=1) - cargo_path.write_text(cargo_text, encoding="utf-8") - PY - - - name: Setup Rust - uses: dtolnay/rust-toolchain@stable + # The qbz_ui rustc needs ~30 GB (RSS+swap). Public runner: 16 GB RAM + # + ~4 GB stock swap; free disk by dropping preinstalled toolchains, + # then add 18 GB swap -> ~38 GB total. Same recipe as build-slint.yml. + - name: Free disk space and add swap + run: | + sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android \ + /opt/hostedtoolcache /usr/local/share/boost /usr/share/swift \ + /usr/local/lib/node_modules || true + sudo docker system prune -af || true + if sudo fallocate -l 18G /swap_extra; then + sudo chmod 600 /swap_extra + sudo mkswap /swap_extra + sudo swapon /swap_extra + else + echo "::warning::could not allocate extra swap; build may OOM" + fi + free -h - name: Install system dependencies run: | sudo apt-get update - # Pin WebKitGTK to 2.44.0-2 to prevent EGL_BAD_PARAMETER crash in AppImage - # See: https://github.com/tauri-apps/tauri/issues/11994 sudo apt-get install -y \ - libwebkit2gtk-4.1-0=2.44.0-2 \ - libwebkit2gtk-4.1-dev=2.44.0-2 \ - libjavascriptcoregtk-4.1-0=2.44.0-2 \ - libjavascriptcoregtk-4.1-dev=2.44.0-2 \ - gir1.2-javascriptcoregtk-4.1=2.44.0-2 \ - gir1.2-webkit2-4.1=2.44.0-2 \ - libgtk-3-dev \ - libappindicator3-dev \ - librsvg2-dev \ - libasound2-dev \ - patchelf + mold nasm \ + libasound2-dev libjack-jackd2-dev \ + libfontconfig1-dev libfreetype-dev \ + libxkbcommon-dev libwayland-dev libxcb1-dev \ + libgl1-mesa-dev libegl1-mesa-dev \ + libdbus-1-dev libssl-dev \ + libharfbuzz-dev libjbig2dec0-dev libopenjp2-7-dev \ + libjpeg-dev zlib1g-dev libgumbo-dev - - name: Install JS dependencies - run: npm ci + # Pinned nightly: matches build-slint.yml (same measured memory + # behavior, -Z threads support). Bump both files together. + - name: Setup Rust + uses: dtolnay/rust-toolchain@master + with: + toolchain: nightly-2026-06-23 - - name: Build DEB/RPM/AppImage + - name: Rust cache + uses: Swatinem/rust-cache@v2 + with: + workspaces: crates -> target + shared-key: slint-linux + cache-on-failure: true + # Releases only READ the cache; build-slint.yml owns writing it. + save-if: false + + - name: Build (release, MIN memory tier) + env: + CARGO_INCREMENTAL: "0" + CARGO_BUILD_JOBS: "1" + CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "256" + CARGO_PROFILE_RELEASE_OPT_LEVEL: "2" + # Keep symbols in this build: the unstripped binary is archived for + # crash symbolication, then stripped for every shipped artifact. + CARGO_PROFILE_RELEASE_STRIP: "none" + RUSTFLAGS: "-C target-feature=+aes,+ssse3 -C link-arg=-fuse-ld=mold -Z threads=1" + run: | + cargo build --release --manifest-path crates/Cargo.toml -p qbz + cp crates/target/release/qbz qbz-unstripped + strip -o qbz crates/target/release/qbz + ls -la qbz qbz-unstripped + + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: qbz-linux-x86_64 + path: qbz + if-no-files-found: error + + # Symbolication artifact: panic backtraces in shipped binaries are + # address-only (profile strips symbols); this copy resolves them. + - name: Upload unstripped binary (symbolication) + uses: actions/upload-artifact@v4 + with: + name: qbz-linux-x86_64-unstripped + path: qbz-unstripped + retention-days: 90 + + package: + needs: build + runs-on: ubuntu-24.04 + permissions: + contents: write + env: + VERSION: ${{ needs.build.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Download binary + uses: actions/download-artifact@v4 + with: + name: qbz-linux-x86_64 + + - name: Install nfpm + run: | + echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | \ + sudo tee /etc/apt/sources.list.d/goreleaser.list + sudo apt-get update + sudo apt-get install -y nfpm + nfpm --version + + - name: Build deb + rpm (nfpm) + env: + QBZ_VERSION: ${{ env.VERSION }} + QBZ_ARCH: amd64 + QBZ_BINARY: ./qbz + run: | + chmod +x qbz + mkdir -p dist + nfpm package -f packaging/nfpm/nfpm.yaml -p deb \ + -t "dist/QBZ_${VERSION}_amd64.deb" + nfpm package -f packaging/nfpm/nfpm.yaml -p rpm \ + -t "dist/QBZ-${VERSION}-1.x86_64.rpm" + + - name: Build AppImage + run: | + # Minimal AppDir: the measured runtime deps (alsa/fontconfig/ + # freetype/png/bz2/expat/zlib) are base-system libraries on every + # target distro, so nothing is bundled beyond the binary. + APPDIR="QBZ.AppDir" + mkdir -p "$APPDIR/usr/bin" + cp qbz "$APPDIR/usr/bin/qbz" + cp packaging/linux/qbz.desktop "$APPDIR/qbz.desktop" + cp packaging/icons/256x256.png "$APPDIR/qbz.png" + cp packaging/icons/256x256.png "$APPDIR/.DirIcon" + ln -s usr/bin/qbz "$APPDIR/AppRun" + + curl -fsSL -o appimagetool \ + https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage + chmod +x appimagetool + ARCH=x86_64 ./appimagetool --appimage-extract-and-run "$APPDIR" \ + "dist/QBZ_${VERSION}_amd64.AppImage" + + # Tauri-updater bridge: v1.2.x AppImage installs poll latest.json and + # verify artifacts with the Tauri minisign pubkey baked into the old + # binaries. Signing the Slint AppImage with the SAME private key lets + # them auto-update straight into v2 (the updater just swaps the + # AppImage file). release-updater-manifest.yml collects the .sig into + # latest.json. The Slint app itself has no auto-updater — this exists + # only to migrate old installs. + - name: Sign AppImage (Tauri-updater bridge) + if: startsWith(github.ref, 'refs/tags/') env: TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} - run: npm run tauri build -- --bundles deb,rpm,appimage - - - name: Collect artifacts - id: artifacts - env: - VERSION: ${{ steps.release.outputs.version }} run: | - mkdir -p dist - cp -v src-tauri/target/release/bundle/deb/*.deb dist/ || true - cp -v src-tauri/target/release/bundle/rpm/*.rpm dist/ || true - cp -v src-tauri/target/release/bundle/appimage/*.AppImage dist/ || true - cp -v src-tauri/target/release/bundle/appimage/*.AppImage.sig dist/ || true + npx --yes @tauri-apps/cli@^2 signer sign \ + --private-key "$TAURI_SIGNING_PRIVATE_KEY" \ + --password "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" \ + "dist/QBZ_${VERSION}_amd64.AppImage" + ls -la dist - # Create tarball for AUR with proper structure + - name: Build AUR/Gentoo tarball + run: | + # CONTRACT: release-aur.yml, the Gentoo binary ebuild, qbz-apt and + # the website hard-code this name and internal layout. TARBALL_DIR="qbz_${VERSION}_amd64" mkdir -p "tarball-staging/${TARBALL_DIR}/icons/hicolor"/{32x32,48x48,64x64,128x128,256x256}/apps - - # Binary - cp src-tauri/target/release/qbz "tarball-staging/${TARBALL_DIR}/qbz" - - # Icons (use available sizes, copy 128x128 for missing sizes) - cp src-tauri/icons/32x32.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/32x32/apps/qbz.png" - cp src-tauri/icons/128x128.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/48x48/apps/qbz.png" - cp src-tauri/icons/128x128.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/64x64/apps/qbz.png" - cp src-tauri/icons/128x128.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/128x128/apps/qbz.png" - cp src-tauri/icons/128x128@2x.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/256x256/apps/qbz.png" - - # Desktop file - cat > "tarball-staging/${TARBALL_DIR}/qbz.desktop" << 'EOF' - [Desktop Entry] - Name=QBZ - Comment=Native Qobuz client with hi-res audio support - Exec=qbz %u - Icon=qbz - Terminal=false - Type=Application - Categories=AudioVideo;Audio;Music;Player; - Keywords=music;audio;qobuz;hifi;streaming;audiophile;flac; - StartupWMClass=com.blitzfc.qbz - StartupNotify=true - MimeType=x-scheme-handler/qbz;x-scheme-handler/qobuzapp; - EOF - + cp qbz "tarball-staging/${TARBALL_DIR}/qbz" + chmod +x "tarball-staging/${TARBALL_DIR}/qbz" + cp packaging/icons/32x32.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/32x32/apps/qbz.png" + cp packaging/icons/48x48.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/48x48/apps/qbz.png" + cp packaging/icons/64x64.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/64x64/apps/qbz.png" + cp packaging/icons/128x128.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/128x128/apps/qbz.png" + cp packaging/icons/256x256.png "tarball-staging/${TARBALL_DIR}/icons/hicolor/256x256/apps/qbz.png" + cp packaging/linux/qbz.desktop "tarball-staging/${TARBALL_DIR}/qbz.desktop" tar -czvf "dist/qbz_${VERSION}_amd64.tar.gz" -C tarball-staging "${TARBALL_DIR}" - ls -la dist - name: Upload artifacts @@ -160,8 +276,8 @@ jobs: uses: softprops/action-gh-release@v2 with: files: dist/* - prerelease: ${{ contains(steps.release.outputs.version, '-rc') }} - make_latest: ${{ contains(steps.release.outputs.version, '-rc') && 'false' || 'true' }} + prerelease: ${{ needs.build.outputs.prerelease }} + make_latest: ${{ needs.build.outputs.prerelease == 'true' && 'false' || 'true' }} - name: Trigger APT repo update if: startsWith(github.ref, 'refs/tags/') diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml index 179c7fae4..eeea57819 100644 --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -1,16 +1,34 @@ +# macOS release — Slint binary (crates/ workspace). +# +# Rewritten 2026-07-02 for the Tauri -> Slint migration (v2.0). Builds the +# qbz binary per target, assembles a minimal QBZ.app bundle (Info.plist + +# icns + binary), ad-hoc signs it (same trust level as the unsigned Tauri +# builds), and packs a dmg with hdiutil. No Tauri updater: the .app.tar.gz +# + .sig updater assets are gone, dmg is the distribution. +# +# MEMORY NOTE: hosted macOS runners have ~7 GB RAM; the qbz_ui rustc peaks +# ~30 GB on Linux. macOS swaps dynamically to SSD so the build may survive +# (slowly) — if it proves unreliable, point runs-on at a self-hosted runner +# on the M2 Mini instead. continue-on-error keeps a mac failure from +# blocking the Linux release. + name: release-macos on: workflow_dispatch: inputs: tag: - description: "Optional release tag to build (e.g. v1.2.1)" + description: "Optional release tag to build (e.g. v2.0.0). Empty = build HEAD with the Cargo.toml version, no Release publish." required: false type: string push: tags: - "v*" +concurrency: + group: release-macos-${{ github.ref }} + cancel-in-progress: false + jobs: build-macos: strategy: @@ -21,19 +39,18 @@ jobs: arch: aarch64 - target: x86_64-apple-darwin artifact: qbz-macos-x86_64 - arch: x86_64 + # Historical dmg naming: intel assets ship as "x64". + arch: x64 runs-on: macos-latest + timeout-minutes: 360 + continue-on-error: true permissions: contents: write steps: - name: Checkout uses: actions/checkout@v4 - - - name: Setup Node - uses: actions/setup-node@v4 with: - node-version: 24 - cache: npm + fetch-depth: 0 - name: Resolve release version id: release @@ -44,91 +61,155 @@ jobs: elif [[ -n "${{ inputs.tag }}" ]]; then VERSION="${{ inputs.tag }}" VERSION="${VERSION#v}" + else + VERSION="$(grep -m1 '^version = ' crates/Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" + fi + PRERELEASE=false + if [[ "$VERSION" =~ -(rc|beta|alpha|pre) ]]; then + PRERELEASE=true fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT" - - name: Sync version to build metadata - if: steps.release.outputs.version != '' - env: - QBZ_VERSION: ${{ steps.release.outputs.version }} + - name: Verify tag is on main + if: startsWith(github.ref, 'refs/tags/') run: | - python3 - <<'PY' - import json - import os - import pathlib - import re + git fetch origin main + if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then + echo "::error::Tag ${GITHUB_REF#refs/tags/} is not on main. Releases are cut from main only." + exit 1 + fi - version = os.environ["QBZ_VERSION"] - - def update_json(path, updater): - p = pathlib.Path(path) - data = json.loads(p.read_text(encoding="utf-8")) - updater(data) - p.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8") - - update_json("package.json", lambda d: d.__setitem__("version", version)) - - def update_lock(d): - d["version"] = version - packages = d.get("packages") - if isinstance(packages, dict) and "" in packages: - packages[""]["version"] = version - update_json("package-lock.json", update_lock) - - update_json("src-tauri/tauri.conf.json", lambda d: d.__setitem__("version", version)) - - cargo_path = pathlib.Path("src-tauri/Cargo.toml") - cargo_text = cargo_path.read_text(encoding="utf-8") - cargo_text = re.sub(r'(?m)^version = \"[^\"]+\"', f'version = \"{version}\"', cargo_text, count=1) - cargo_path.write_text(cargo_text, encoding="utf-8") - PY + - name: Assert Cargo.toml version matches tag + if: startsWith(github.ref, 'refs/tags/') + env: + VERSION: ${{ steps.release.outputs.version }} + run: | + CARGO_VERSION="$(grep -m1 '^version = ' crates/Cargo.toml | sed 's/version = \"\(.*\)\"/\1/')" + if [[ "$CARGO_VERSION" != "$VERSION" ]]; then + echo "::error::crates/Cargo.toml workspace version ($CARGO_VERSION) != tag version ($VERSION)." + exit 1 + fi + # Same pinned nightly as the Linux builders (-Z threads support, + # consistent measured behavior). Bump all release workflows together. - name: Setup Rust - uses: dtolnay/rust-toolchain@stable + uses: dtolnay/rust-toolchain@master with: + toolchain: nightly-2026-06-23 targets: ${{ matrix.target }} - name: Rust cache uses: Swatinem/rust-cache@v2 with: - workspaces: src-tauri -> target - shared-key: macos-${{ matrix.target }} + workspaces: crates -> target + shared-key: slint-macos-${{ matrix.target }} + cache-on-failure: true + save-if: true - - name: Install JS dependencies - run: npm ci - - - name: Build macOS bundles + # MIN memory tier — the 7 GB hosted runner relies on macOS dynamic + # swap for the qbz_ui rustc peak. Binary is stripped by the workspace + # profile (strip = "symbols"), which rustc applies correctly to Mach-O. + - name: Build (release, MIN memory tier) env: - TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} - TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} - run: npm run tauri build -- --target ${{ matrix.target }} + CARGO_INCREMENTAL: "0" + CARGO_BUILD_JOBS: "1" + CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "256" + CARGO_PROFILE_RELEASE_OPT_LEVEL: "2" + RUSTFLAGS: "-Z threads=1" + run: | + cargo build --release --manifest-path crates/Cargo.toml \ + -p qbz --target ${{ matrix.target }} - - name: Collect artifacts + - name: Assemble QBZ.app env: - BUNDLE_DIR: src-tauri/target/${{ matrix.target }}/release/bundle - ARCH: ${{ matrix.arch }} + VERSION: ${{ steps.release.outputs.version }} run: | set -euo pipefail - mkdir -p dist - # DMG for manual distribution (filename already includes arch). - cp -v "$BUNDLE_DIR"/dmg/*.dmg dist/ - # .app.tar.gz + .sig for auto-updater. Rename with arch suffix so the - # two matrix jobs don't overwrite each other on the GitHub Release, - # and so release-updater-manifest.yml's regex picks them up - # ("aarch64.app.tar.gz$" / "(x64|x86_64).app.tar.gz$"). - cp -v "$BUNDLE_DIR/macos/QBZ.app.tar.gz" "dist/QBZ_${ARCH}.app.tar.gz" - cp -v "$BUNDLE_DIR/macos/QBZ.app.tar.gz.sig" "dist/QBZ_${ARCH}.app.tar.gz.sig" + APP="dist/QBZ.app" + mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" + cp "crates/target/${{ matrix.target }}/release/qbz" "$APP/Contents/MacOS/qbz" + chmod +x "$APP/Contents/MacOS/qbz" + cp packaging/icons/icon.icns "$APP/Contents/Resources/icon.icns" + cat > "$APP/Contents/Info.plist" < + + + + CFBundlePackageTypeAPPL + CFBundleIdentifiercom.blitzfc.qbz + CFBundleNameQBZ + CFBundleDisplayNameQBZ + CFBundleExecutableqbz + CFBundleIconFileicon + CFBundleShortVersionString${VERSION} + CFBundleVersion${VERSION} + LSMinimumSystemVersion11.0 + NSHighResolutionCapable + LSApplicationCategoryTypepublic.app-category.music + NSSupportsAutomaticGraphicsSwitching + CFBundleURLTypes + + + CFBundleURLNamecom.blitzfc.qbz + CFBundleURLSchemes + qbzqobuzapp + + + + + PLIST + # Ad-hoc signature: required for arm64 Macs to launch at all; + # matches the trust level of the previous unsigned Tauri builds. + codesign --force --deep -s - "$APP" + codesign --verify --verbose "$APP" + + - name: Build dmg + env: + VERSION: ${{ steps.release.outputs.version }} + ARCH: ${{ matrix.arch }} + run: | + hdiutil create -volname "QBZ" -srcfolder dist/QBZ.app -ov \ + -format UDZO "dist/QBZ_${VERSION}_${ARCH}.dmg" + ls -la dist + + # Tauri-updater bridge: v1.2.x installs poll latest.json and verify + # with the Tauri minisign pubkey baked into the old binaries. The + # updater expects QBZ_${ARCH}.app.tar.gz — keep producing it, signed + # with the SAME key, so old installs update straight into the Slint + # .app. release-updater-manifest.yml collects the .sig files. + - name: Package .app.tar.gz + sign (Tauri-updater bridge) + if: startsWith(github.ref, 'refs/tags/') + env: + ARCH: ${{ matrix.arch }} + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} + run: | + tar -czf "dist/QBZ_${ARCH}.app.tar.gz" -C dist QBZ.app + npx --yes @tauri-apps/cli@^2 signer sign \ + --private-key "$TAURI_SIGNING_PRIVATE_KEY" \ + --password "$TAURI_SIGNING_PRIVATE_KEY_PASSWORD" \ + "dist/QBZ_${ARCH}.app.tar.gz" ls -la dist - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact }} - path: dist/* + path: | + dist/*.dmg + dist/*.app.tar.gz + dist/*.app.tar.gz.sig + # Attaches to the Release created by release-linux.yml; same + # prerelease logic (the old workflow hardcoded prerelease: true). - name: Publish GitHub Release Assets if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: - files: dist/* - prerelease: true + files: | + dist/*.dmg + dist/*.app.tar.gz + dist/*.app.tar.gz.sig + prerelease: ${{ steps.release.outputs.prerelease }} + make_latest: ${{ steps.release.outputs.prerelease == 'true' && 'false' || 'true' }}