diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e97abec..72b7442 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,3 +98,39 @@ jobs: - name: Test run: cargo xtask test + + # The other half of each release: the same tests on the architectures + # the release builds for but the jobs above do not run on. + other-architectures: + name: Test (${{ matrix.name }}) + strategy: + fail-fast: false + matrix: + include: + - { name: Linux aarch64, runner: ubuntu-24.04-arm } + - { name: macOS x86_64, runner: macos-15-intel } + - { name: Windows aarch64, runner: windows-11-arm } + runs-on: ${{ matrix.runner }} + steps: + - if: runner.os == 'Windows' + run: git config --global core.autocrlf false + + - uses: actions/checkout@v5 + + - name: System libraries + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + pkg-config libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev \ + libx11-xcb-dev libxcb1-dev libfontconfig-dev libfreetype-dev \ + libvulkan-dev libasound2-dev libssl-dev libzstd-dev + + - uses: dtolnay/rust-toolchain@master + with: + toolchain: "1.97" + + - uses: Swatinem/rust-cache@v2 + + - name: Test + run: cargo xtask test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b3cc857..04712f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,10 +19,8 @@ env: jobs: release: - name: Build and publish - # The oldest supported runner: its glibc is what the binary needs at - # least, so building here runs on the most systems. - runs-on: ubuntu-22.04 + name: Check the tag and draft the release + runs-on: ubuntu-24.04 outputs: tag: ${{ steps.version.outputs.tag }} version: ${{ steps.version.outputs.version }} @@ -47,6 +45,34 @@ jobs: echo "tag=$tag" >> "$GITHUB_OUTPUT" echo "version=$version" >> "$GITHUB_OUTPUT" + # A draft, so nobody downloads from a release still missing half its + # builds; `publish` below makes it public once every build is in. + - name: Draft + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ steps.version.outputs.tag }} + run: | + if ! gh release view "$TAG" >/dev/null 2>&1; then + gh release create "$TAG" --draft --verify-tag \ + --title "disktree ${TAG#v}" --generate-notes + fi + + linux: + name: Build (Linux ${{ matrix.arch }}) + needs: release + strategy: + matrix: + include: + # The oldest supported runners: their glibc is what the binary + # needs at least, so building there runs on the most systems. + - { runner: ubuntu-22.04, arch: x86_64 } + - { runner: ubuntu-22.04-arm, arch: aarch64 } + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v5 + with: + ref: ${{ inputs.tag || github.ref }} + - name: System libraries run: | sudo apt-get update @@ -69,37 +95,39 @@ jobs: - name: Package id: package + env: + VERSION: ${{ needs.release.outputs.version }} + ARCH: ${{ matrix.arch }} run: | - name="disktree-${{ steps.version.outputs.version }}-x86_64-linux" + name="disktree-$VERSION-$ARCH-linux" mkdir -p "dist/$name" cp target/release/disktree "dist/$name/" strip "dist/$name/disktree" cp packaging/install.sh packaging/disktree.desktop.in \ assets/disktree.svg README.md LICENSE "dist/$name/" - echo "${{ steps.version.outputs.version }}" > "dist/$name/VERSION" + echo "$VERSION" > "dist/$name/VERSION" tar -C dist -czf "dist/$name.tar.gz" "$name" (cd dist && sha256sum "$name.tar.gz" > "$name.tar.gz.sha256") echo "archive=dist/$name.tar.gz" >> "$GITHUB_OUTPUT" - - name: Publish + - name: Upload env: GH_TOKEN: ${{ github.token }} - TAG: ${{ steps.version.outputs.tag }} + TAG: ${{ needs.release.outputs.tag }} ARCHIVE: ${{ steps.package.outputs.archive }} - run: | - if gh release view "$TAG" >/dev/null 2>&1; then - gh release upload "$TAG" "$ARCHIVE" "$ARCHIVE.sha256" --clobber - else - gh release create "$TAG" "$ARCHIVE" "$ARCHIVE.sha256" \ - --title "disktree ${TAG#v}" --generate-notes - fi + run: gh release upload "$TAG" "$ARCHIVE" "$ARCHIVE.sha256" --clobber - release-macos: - name: Build and publish (macOS) - # After the Linux job, which creates the release: two jobs racing to - # create it would leave one failing. + macos: + name: Build (macOS ${{ matrix.arch }}) needs: release - runs-on: macos-15 + strategy: + matrix: + include: + # `xtask bundle` names the zip after the machine it runs on, so + # each architecture builds on its own. + - { runner: macos-15, arch: aarch64 } + - { runner: macos-15-intel, arch: x86_64 } + runs-on: ${{ matrix.runner }} env: # Signing and notarizing happen only when the repository has these # secrets; without them the app is signed ad hoc, and a downloaded @@ -120,22 +148,6 @@ jobs: with: ref: ${{ inputs.tag || github.ref }} - - name: Version - id: version - # Through the environment, not spliced into the script: a tag typed - # into the dispatch form is text, never shell. - env: - TAG: ${{ inputs.tag || github.ref_name }} - run: | - tag="$TAG" - version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) - if [ "$tag" != "v$version" ]; then - echo "tag $tag does not match Cargo.toml version $version" >&2 - exit 1 - fi - echo "tag=$tag" >> "$GITHUB_OUTPUT" - echo "version=$version" >> "$GITHUB_OUTPUT" - - uses: dtolnay/rust-toolchain@master with: toolchain: "1.97" @@ -177,21 +189,27 @@ jobs: fi cargo xtask bundle "${args[@]}" - - name: Publish + - name: Upload env: GH_TOKEN: ${{ github.token }} - TAG: ${{ steps.version.outputs.tag }} + TAG: ${{ needs.release.outputs.tag }} + VERSION: ${{ needs.release.outputs.version }} + ARCH: ${{ matrix.arch }} run: | - zip="target/bundle/disktree-${{ steps.version.outputs.version }}-aarch64-macos.zip" + zip="target/bundle/disktree-$VERSION-$ARCH-macos.zip" (cd "$(dirname "$zip")" && shasum -a 256 "$(basename "$zip")" \ > "$(basename "$zip").sha256") gh release upload "$TAG" "$zip" "$zip.sha256" --clobber windows: - name: Build and publish (Windows) - # After the Linux job, which checks the tag and creates the release. + name: Build (Windows ${{ matrix.arch }}) needs: release - runs-on: windows-2025 + strategy: + matrix: + include: + - { runner: windows-2025, arch: x86_64 } + - { runner: windows-11-arm, arch: aarch64 } + runs-on: ${{ matrix.runner }} env: # The C runtime linked in, so disktree.exe also runs where the Visual # C++ runtime was never installed. For the tests too, so both steps @@ -219,8 +237,11 @@ jobs: - name: Package id: package shell: pwsh + env: + VERSION: ${{ needs.release.outputs.version }} + ARCH: ${{ matrix.arch }} run: | - $name = "disktree-${{ needs.release.outputs.version }}-x86_64-windows" + $name = "disktree-$env:VERSION-$env:ARCH-windows" New-Item -ItemType Directory -Force "dist/$name" | Out-Null Copy-Item target/release/disktree.exe, README.md, LICENSE "dist/$name/" Compress-Archive -Path "dist/$name" -DestinationPath "dist/$name.zip" @@ -229,10 +250,21 @@ jobs: [IO.File]::WriteAllText("dist/$name.zip.sha256", "$hash $name.zip`n") "archive=dist/$name.zip" >> $env:GITHUB_OUTPUT - - name: Publish + - name: Upload shell: bash env: GH_TOKEN: ${{ github.token }} TAG: ${{ needs.release.outputs.tag }} ARCHIVE: ${{ steps.package.outputs.archive }} run: gh release upload "$TAG" "$ARCHIVE" "$ARCHIVE.sha256" --clobber + + publish: + name: Publish + needs: [release, linux, macos, windows] + runs-on: ubuntu-24.04 + steps: + - name: Publish + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ needs.release.outputs.tag }} + run: gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" --draft=false --latest diff --git a/Cargo.lock b/Cargo.lock index ee104b2..90cdacb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1420,7 +1420,7 @@ dependencies = [ [[package]] name = "disktree-app" -version = "0.9.1" +version = "0.10.0" dependencies = [ "anyhow", "disktree-core", @@ -1434,7 +1434,7 @@ dependencies = [ [[package]] name = "disktree-core" -version = "0.9.1" +version = "0.10.0" dependencies = [ "chrono", "rayon", @@ -8645,7 +8645,7 @@ checksum = "ec7a2a501ed189703dba8b08142f057e887dfc4b2cc4db2d343ac6376ba3e0b9" [[package]] name = "xtask" -version = "0.9.1" +version = "0.10.0" [[package]] name = "y4m" diff --git a/Cargo.toml b/Cargo.toml index 4dbb405..fc427ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/disktree-app", "crates/disktree-core", "xtask"] [workspace.package] -version = "0.9.1" +version = "0.10.0" edition = "2024" rust-version = "1.97" license = "MIT" diff --git a/README.md b/README.md index 77dd0e0..e592624 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Omarchy theme and behaves like the rest of the desktop. ## Install -Download `disktree-*-x86_64-linux.tar.gz` from the +Download `disktree-*-x86_64-linux.tar.gz` (`aarch64-linux` on ARM) from the [latest release](https://github.com/tobi/disktree/releases/latest), unpack it, and run `./install.sh` inside (or just copy `disktree` onto your `PATH`). Or build it: @@ -46,12 +46,12 @@ can drive (Vulkan). Distributions often package an older Rust; ### macOS -Download `disktree-*-aarch64-macos.zip` from the -[latest release](https://github.com/tobi/disktree/releases/latest), unzip it, -and drag `disktree.app` into Applications. Apple silicon and macOS 11 or -newer. A release that was not signed and notarized is stopped by Gatekeeper -the first time: open it once, then choose **Open Anyway** in System Settings -› Privacy & Security. +Download `disktree-*-aarch64-macos.zip` (`x86_64-macos` for an Intel Mac) +from the [latest release](https://github.com/tobi/disktree/releases/latest), +unzip it, and drag `disktree.app` into Applications. macOS 11 or newer. A +release that was not signed and notarized is stopped by Gatekeeper the first +time: open it once, then choose **Open Anyway** in System Settings › Privacy +& Security. Or build it, with Rust 1.97 or newer and Xcode or its Command Line Tools. macOS does not come with Rust; install it with [rustup](https://rustup.rs). @@ -90,10 +90,11 @@ NOTARY_PROFILE= cargo xtask bundle \ ### Windows -On Windows 10 or 11, download `disktree-*-x86_64-windows.zip` from the same -release, unpack it anywhere and run `disktree.exe`. Or build it with Rust 1.97 -or newer, from [rustup](https://rustup.rs), and the MSVC toolchain (Visual -Studio Build Tools, C++ workload): +On Windows 10 or 11, download `disktree-*-x86_64-windows.zip` +(`aarch64-windows` on ARM) from the same release, unpack it anywhere and run +`disktree.exe`. Or build it with Rust 1.97 or newer, from +[rustup](https://rustup.rs), and the MSVC toolchain (Visual Studio Build +Tools, C++ workload): ```powershell git clone https://github.com/tobi/disktree