From 2a9a60197be46a9e02fd79c98e417d0019a51640 Mon Sep 17 00:00:00 2001 From: houseme Date: Sat, 10 May 2025 00:15:05 +0800 Subject: [PATCH] # Add aarch64-apple-darwin Build Target Support Added ARM64 macOS (Apple Silicon) build target support to the CI/CD pipeline by: 1. Including `aarch64-apple-darwin` as a new build variant in the build matrix 2. Adding proper exclusion rules to ensure the target only runs on macOS runners 3. Ensuring compatibility with the existing build scripts and packaging process This change enables native builds for Apple Silicon Macs, improving performance for users with M1/M2/M3/M4 processors while maintaining the same artifact organization and deployment process. --- .github/actions/setup/action.yml | 8 ++++++++ .github/workflows/build.yml | 14 +++++++++++--- scripts/build.py | 2 +- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index f74dc6fbe..73861f253 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -6,17 +6,25 @@ inputs: rust-version: required: true default: "stable" + description: "Rust version to use" cache-shared-key: required: true default: "" + description: "Cache key for shared cache" cache-save-if: required: true default: true + description: "Cache save condition" + run-os: + required: true + default: "ubuntu-latest" + description: "Running system" runs: using: "composite" steps: - name: Install system dependencies + if: inputs.run-os == 'ubuntu-latest' shell: bash run: | sudo apt update diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01e49f6c5..6e75fe72f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,21 +11,29 @@ on: jobs: build-rustfs: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: matrix: + os: [ ubuntu-latest, macos-latest ] variant: - # - { profile: dev, target: x86_64-unknown-linux-musl, glibc: "default" } - { profile: release, target: x86_64-unknown-linux-musl, glibc: "default" } - { profile: release, target: x86_64-unknown-linux-gnu, glibc: "default" } - # - { profile: release, target: x86_64-unknown-linux-gnu, glibc: "2.31" } + - { profile: release, target: aarch64-apple-darwin, glibc: "default" } + exclude: + - os: macos-latest + variant: { profile: release, target: x86_64-unknown-linux-gnu, glibc: "default" } + - os: ubuntu-latest + variant: { profile: release, target: aarch64-apple-darwin, glibc: "default" } + - os: macos-latest + variant: { profile: release, target: x86_64-unknown-linux-musl, glibc: "default" } steps: - uses: actions/checkout@v4 - uses: ./.github/actions/setup with: cache-shared-key: rustfs.${{ matrix.variant.profile }}.${{ matrix.variant.target }}.${{ matrix.variant.glibc }} + run-os: ${{ matrix.os }} - name: Download and Extract Static Assets run: | diff --git a/scripts/build.py b/scripts/build.py index 106a25fed..f1beb0789 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -34,7 +34,7 @@ def main(args: CliArgs): use_zigbuild = True use_old_glibc = True - if args.target and args.target == "x86_64-unknown-linux-musl": + if args.target and args.target != "x86_64-unknown-linux-gnu": shell("rustup target add " + args.target) cmd = ["cargo", "build"]