Skip to content

Commit c4aa152

Browse files
committed
📦 Add multi-architecture support for package builds
- Add ARM64 (aarch64) target alongside existing AMD64 builds - Configure cross-compilation toolchain for ARM64 builds - Update package asset paths to work with target-specific builds - Remove global rustflags config in favor of per-build settings - Upload separate artifacts for each architecture (amd64/arm64) - Optimize man page upload to run only once per build matrix
1 parent 274dec6 commit c4aa152

File tree

3 files changed

+47
-16
lines changed

3 files changed

+47
-16
lines changed

.cargo/config.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/workflows/cicd.yml

Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,23 @@ jobs:
147147
name: 📦 Build Packages
148148
if: startsWith(github.ref, 'refs/tags/')
149149
needs: build-and-test
150-
runs-on: ubuntu-latest
150+
runs-on: ${{ matrix.os }}
151+
strategy:
152+
matrix:
153+
include:
154+
- build: linux-amd64
155+
os: ubuntu-latest
156+
target: x86_64-unknown-linux-gnu
157+
arch_suffix: amd64
158+
rpm_arch: x86_64
159+
rust_flags: "-C target-cpu=x86-64"
160+
161+
- build: linux-arm64
162+
os: ubuntu-latest
163+
target: aarch64-unknown-linux-gnu
164+
arch_suffix: arm64
165+
rpm_arch: aarch64
166+
rust_flags: "-C target-cpu=generic"
151167
outputs:
152168
version: ${{ steps.get_version.outputs.VERSION }}
153169
steps:
@@ -163,7 +179,15 @@ jobs:
163179
- name: 🦀 Install Rust
164180
uses: dtolnay/rust-toolchain@stable
165181
with:
166-
targets: x86_64-unknown-linux-gnu
182+
targets: ${{ matrix.target }}
183+
184+
- name: 📦 Setup cross-compilation (ARM64)
185+
if: matrix.target == 'aarch64-unknown-linux-gnu'
186+
run: |
187+
sudo apt-get update
188+
sudo apt-get install -y gcc-aarch64-linux-gnu
189+
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
190+
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
167191
168192
- name: 📦 Rust cache
169193
uses: Swatinem/rust-cache@v2
@@ -177,16 +201,18 @@ jobs:
177201
run: cargo install cargo-deb
178202

179203
- name: 🔨 Build .deb package
204+
env:
205+
RUSTFLAGS: ${{ matrix.rust_flags }}
180206
run: |
181-
echo "::group::Building .deb package"
182-
cargo deb
207+
echo "::group::Building .deb package for ${{ matrix.target }}"
208+
cargo deb --target ${{ matrix.target }}
183209
echo "::endgroup::"
184210
185211
- name: 📤 Upload DEB artifact
186212
uses: actions/upload-artifact@v4
187213
with:
188-
name: git-iris-deb
189-
path: ./target/debian/git-iris_${{ steps.get_version.outputs.VERSION }}-1_amd64.deb
214+
name: git-iris-deb-${{ matrix.arch_suffix }}
215+
path: ./target/${{ matrix.target }}/debian/git-iris_${{ steps.get_version.outputs.VERSION }}-1_${{ matrix.arch_suffix }}.deb
190216
if-no-files-found: error
191217
retention-days: 1
192218

@@ -195,24 +221,29 @@ jobs:
195221
run: cargo install cargo-generate-rpm
196222

197223
- name: 🔨 Build Release Binary for RPM
198-
run: cargo build --release
224+
env:
225+
RUSTFLAGS: ${{ matrix.rust_flags }}
226+
run: cargo build --release --target ${{ matrix.target }}
199227

200228
- name: 🔨 Build .rpm package
229+
env:
230+
RUSTFLAGS: ${{ matrix.rust_flags }}
201231
run: |
202-
echo "::group::Building .rpm package"
203-
cargo generate-rpm
232+
echo "::group::Building .rpm package for ${{ matrix.target }}"
233+
cargo generate-rpm --target ${{ matrix.target }}
204234
echo "::endgroup::"
205235
206236
- name: 📤 Upload RPM artifact
207237
uses: actions/upload-artifact@v4
208238
with:
209-
name: git-iris-rpm
210-
path: ./target/generate-rpm/git-iris-${{ steps.get_version.outputs.VERSION }}-1.x86_64.rpm
239+
name: git-iris-rpm-${{ matrix.arch_suffix }}
240+
path: ./target/generate-rpm/git-iris-${{ steps.get_version.outputs.VERSION }}-1.${{ matrix.rpm_arch }}.rpm
211241
if-no-files-found: error
212242
retention-days: 1
213243

214-
# Upload man page as artifact
244+
# Upload man page as artifact (only once)
215245
- name: 📤 Upload man page artifact
246+
if: matrix.build == 'linux-amd64'
216247
uses: actions/upload-artifact@v4
217248
with:
218249
name: git-iris-man

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,10 @@ Git-Iris is an AI-powered tool designed to generate meaningful and context-aware
117117
depends = "$auto"
118118
section = "utility"
119119
priority = "optional"
120+
# Assets will be resolved relative to target directory by cargo-deb when using --target
120121
assets = [
121122
[
122-
"target/release/git-iris",
123+
"release/git-iris",
123124
"usr/bin/",
124125
"755",
125126
],
@@ -136,8 +137,9 @@ assets = [
136137
]
137138

138139
[package.metadata.generate-rpm]
140+
# Assets will be resolved relative to target directory by cargo-generate-rpm when using --target
139141
assets = [
140-
{ source = "target/release/git-iris", dest = "/usr/bin/git-iris", mode = "755" },
142+
{ source = "release/git-iris", dest = "/usr/bin/git-iris", mode = "755" },
141143
{ source = "README.md", dest = "/usr/share/doc/git-iris/README", mode = "644" },
142144
{ source = "git-iris.1", dest = "/usr/share/man/man1/git-iris.1", mode = "644" },
143145
]

0 commit comments

Comments
 (0)