feat: add ARM64 (aarch64) architecture support for builds and packages
Some checks failed
CI/CD / lint (push) Successful in 46s
CI/CD / test (push) Successful in 1m3s
CI/CD / typecheck (push) Has started running
CI/CD / smoke (push) Has been cancelled
CI/CD / build (amd64) (push) Has been cancelled
CI/CD / build (arm64) (push) Has been cancelled
CI/CD / publish-rpm (amd64) (push) Has been cancelled
CI/CD / publish-rpm (arm64) (push) Has been cancelled
CI/CD / publish-deb (amd64) (push) Has been cancelled
CI/CD / publish-deb (arm64) (push) Has been cancelled

Add cross-architecture build support so the project can be developed on
ARM64 (Fedora aarch64 laptop) while still producing amd64 packages for
production. All build, package, publish, and install scripts are now
architecture-aware via shared arch-helper.sh detection.

- Add scripts/arch-helper.sh for shared architecture detection
- CI builds both amd64 and arm64 in matrix strategy
- nfpm.yaml uses NFPM_ARCH env var instead of hardcoded amd64
- Build scripts support MCPCTL_TARGET_ARCH for cross-compilation
- installlocal.sh auto-detects RPM/DEB and filters by architecture
- release.sh gains --both-arches flag for dual-arch releases
- Package cleanup is arch-scoped (won't clobber other arch's packages)
- build-mcpd.sh supports --platform and --multi-arch flags
- Add pnpm scripts: rpm:build:amd64, deb:build:arm64, release:both
- Conditional rpm/dpkg-deb checks for cross-distro compatibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Michal Rydlikowski
2026-03-13 23:01:51 +00:00
parent 588b2a9e65
commit 8ad7fe2748
11 changed files with 326 additions and 64 deletions

View File

@@ -250,11 +250,14 @@ jobs:
if: failure()
run: cat /tmp/mcplocal.log || true
# ── Build & package RPM ───────────────────────────────────
# ── Build & package (both amd64 and arm64) ──────────────
build:
runs-on: ubuntu-latest
needs: [lint, typecheck, test]
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
@@ -283,11 +286,18 @@ jobs:
- name: Install nfpm
run: |
# nfpm itself runs on the CI runner (always x86_64); it cross-packages
# for the target arch via NFPM_ARCH env var — no ARM nfpm binary needed.
curl -sL -o /tmp/nfpm.tar.gz "https://github.com/goreleaser/nfpm/releases/download/v2.45.0/nfpm_2.45.0_Linux_x86_64.tar.gz"
tar xzf /tmp/nfpm.tar.gz -C /usr/local/bin nfpm
- name: Bundle standalone binaries
- name: Bundle standalone binaries (${{ matrix.arch }})
env:
MCPCTL_TARGET_ARCH: ${{ matrix.arch }}
run: |
source scripts/arch-helper.sh
resolve_arch "$MCPCTL_TARGET_ARCH"
mkdir -p dist
# Stub for optional dep that Ink tries to import (only used when DEV=true)
# Copy instead of symlink — bun can't read directory symlinks
@@ -295,26 +305,30 @@ jobs:
rm -rf node_modules/react-devtools-core
cp -r src/cli/stubs/react-devtools-core node_modules/react-devtools-core
fi
bun build src/cli/src/index.ts --compile --outfile dist/mcpctl
bun build src/mcplocal/src/main.ts --compile --outfile dist/mcpctl-local
bun build src/cli/src/index.ts --compile ${BUN_TARGET:+--target "$BUN_TARGET"} --outfile dist/mcpctl
bun build src/mcplocal/src/main.ts --compile ${BUN_TARGET:+--target "$BUN_TARGET"} --outfile dist/mcpctl-local
- name: Package RPM
- name: Package RPM (${{ matrix.arch }})
env:
NFPM_ARCH: ${{ matrix.arch }}
run: nfpm pkg --packager rpm --target dist/
- name: Package DEB
- name: Package DEB (${{ matrix.arch }})
env:
NFPM_ARCH: ${{ matrix.arch }}
run: nfpm pkg --packager deb --target dist/
- name: Upload RPM artifact
uses: actions/upload-artifact@v3
with:
name: rpm-package
name: rpm-package-${{ matrix.arch }}
path: dist/mcpctl-*.rpm
retention-days: 7
- name: Upload DEB artifact
uses: actions/upload-artifact@v3
with:
name: deb-package
name: deb-package-${{ matrix.arch }}
path: dist/mcpctl*.deb
retention-days: 7
@@ -328,19 +342,22 @@ jobs:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Download RPM artifact
uses: actions/download-artifact@v3
with:
name: rpm-package
name: rpm-package-${{ matrix.arch }}
path: dist/
- name: Install rpm tools
run: sudo apt-get update && sudo apt-get install -y rpm
- name: Publish RPM to Gitea
- name: Publish RPM (${{ matrix.arch }}) to Gitea
env:
GITEA_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
GITEA_URL: http://${{ env.GITEA_REGISTRY }}
@@ -379,16 +396,19 @@ jobs:
runs-on: ubuntu-latest
needs: [build]
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
strategy:
matrix:
arch: [amd64, arm64]
steps:
- uses: actions/checkout@v4
- name: Download DEB artifact
uses: actions/download-artifact@v3
with:
name: deb-package
name: deb-package-${{ matrix.arch }}
path: dist/
- name: Publish DEB to Gitea
- name: Publish DEB (${{ matrix.arch }}) to Gitea
env:
GITEA_TOKEN: ${{ secrets.PACKAGES_TOKEN }}
GITEA_URL: http://${{ env.GITEA_REGISTRY }}