From d322009306a3423bf70cde80dcb2731d452f46cd Mon Sep 17 00:00:00 2001 From: Bearice Ren Date: Wed, 8 Jul 2026 18:19:58 +0900 Subject: [PATCH] feat(ci): build Linux packages for aarch64 (arm64) too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Linux job now runs as a matrix on x86_64 (ubuntu-latest) and aarch64 (ubuntu-24.04-arm) native runners, so the .tar.gz, .deb, .rpm, and AppImage are each built for both architectures — no cross-compilation. Artifacts and release assets are named by arch (x86_64 / aarch64); build_linux.sh and the AppImage step already derive the arch from uname -m, so they pick up aarch64 automatically. The cargo cache key is scoped by arch to avoid poisoning one arch's cache with the other's native binaries. Co-Authored-By: Claude --- .github/workflows/rust.yaml | 40 +++++++++++++++++++++++++------------ CHANGELOG.md | 5 ++++- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index 1c0a305..d45ac26 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -121,9 +121,20 @@ jobs: # Build Linux binary and produce distro packages: # portable .tar.gz, .deb, .rpm, and a portable AppImage. + # Runs natively on x86_64 and arm64 runners so every package is built for + # its target arch (no cross-compilation). arm64 uses the free public + # ubuntu-24.04-arm runner; arch labels follow uname -m (x86_64 / aarch64). build-linux: - name: Build Linux packages - runs-on: ubuntu-latest + name: Build Linux packages (${{ matrix.arch }}) + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-latest + arch: x86_64 + - runner: ubuntu-24.04-arm + arch: aarch64 + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v4 - uses: actions/cache@v4 @@ -134,7 +145,10 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + # Caches are arch-specific (~/.cargo/bin and target/ hold native + # binaries), so scope the key by arch to avoid poisoning one arch's + # cache with the other's. + key: ${{ runner.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -155,7 +169,7 @@ jobs: cargo install --locked --force cargo-generate-rpm - name: Build .deb - run: cargo deb --no-strip --output RustCat-linux-x86_64.deb + run: cargo deb --no-strip --output RustCat-linux-${{ matrix.arch }}.deb - name: Build .rpm run: cargo generate-rpm @@ -164,7 +178,7 @@ jobs: shell: bash run: | mkdir -p rpm-out - cp target/generate-rpm/*.rpm rpm-out/RustCat-linux-x86_64.rpm + cp target/generate-rpm/*.rpm rpm-out/RustCat-linux-${{ matrix.arch }}.rpm - name: Build AppImage # Best-effort: linuxdeploy's CImg-based icon deploy cannot read .ico, @@ -212,29 +226,29 @@ jobs: - name: Upload Linux tarball uses: actions/upload-artifact@v4 with: - name: RustCat-linux-x86_64.tar.gz + name: RustCat-linux-${{ matrix.arch }}.tar.gz path: RustCat-*.tar.gz if-no-files-found: error - name: Upload Linux .deb uses: actions/upload-artifact@v4 with: - name: RustCat-linux-x86_64.deb - path: RustCat-linux-x86_64.deb + name: RustCat-linux-${{ matrix.arch }}.deb + path: RustCat-linux-${{ matrix.arch }}.deb if-no-files-found: error - name: Upload Linux .rpm uses: actions/upload-artifact@v4 with: - name: RustCat-linux-x86_64.rpm - path: rpm-out/RustCat-linux-x86_64.rpm + name: RustCat-linux-${{ matrix.arch }}.rpm + path: rpm-out/RustCat-linux-${{ matrix.arch }}.rpm if-no-files-found: error - name: Upload Linux AppImage if: always() uses: actions/upload-artifact@v4 with: - name: RustCat-x86_64.AppImage + name: RustCat-${{ matrix.arch }}.AppImage path: RustCat-*.AppImage if-no-files-found: ignore @@ -244,8 +258,8 @@ jobs: with: files: | RustCat-*.tar.gz - RustCat-linux-x86_64.deb - rpm-out/RustCat-linux-x86_64.rpm + RustCat-linux-*.deb + rpm-out/RustCat-linux-*.rpm RustCat-*.AppImage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index c8dbc23..5b7f909 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,10 @@ and this project adheres to - Distro packaging for Linux: `.deb` (cargo-deb), `.rpm` (cargo-generate-rpm), and a portable AppImage (linuxdeploy), all built in CI alongside the portable `.tar.gz` bundle -- `assets/rustcat.desktop` freedesktop entry and `build_linux.sh` build script +- Linux packages are built for both `x86_64` and `aarch64` (arm64) in CI, + using native GitHub arm64 runners — no cross-compilation +- `assets/rustcat.desktop` freedesktop entry, `assets/rustcat.png` launcher + icon, and `build_linux.sh` build script ### Changed