添加 build macOS 工作流

This commit is contained in:
wisdgod
2025-01-28 16:15:30 +08:00
parent ab310736ea
commit 6c982483d5
3 changed files with 59 additions and 0 deletions

57
.github/workflows/build-darwin.yml vendored Normal file
View File

@@ -0,0 +1,57 @@
name: Build macOS Binaries
on:
workflow_dispatch:
jobs:
build:
name: Build macOS binaries
runs-on: macos-latest
steps:
- uses: actions/checkout@v4.2.2
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin,x86_64-apple-darwin
- name: Install dependencies
run: |
brew update
brew install openssl@3 protobuf pkg-config node
- name: Build x86_64 binary
run: |
RUSTFLAGS="-C link-arg=-s -C target-cpu=x86-64-v3" \
cargo build --release --target x86_64-apple-darwin
- name: Build arm64 binary
run: |
RUSTFLAGS="-C link-arg=-s -C target-cpu=apple-m1" \
cargo build --release --target aarch64-apple-darwin
- name: Create universal binary
run: |
lipo -create \
target/x86_64-apple-darwin/release/cursor-api \
target/aarch64-apple-darwin/release/cursor-api \
-output target/cursor-api-universal
- name: Upload x86_64 artifact
uses: actions/upload-artifact@v4.6.0
with:
name: cursor-api-x86_64-apple-darwin
path: target/x86_64-apple-darwin/release/cursor-api
- name: Upload arm64 artifact
uses: actions/upload-artifact@v4.6.0
with:
name: cursor-api-aarch64-apple-darwin
path: target/aarch64-apple-darwin/release/cursor-api
- name: Upload universal artifact
uses: actions/upload-artifact@v4.6.0
with:
name: cursor-api-universal-apple-darwin
path: target/cursor-api-universal

View File

@@ -11,6 +11,7 @@ RUN apt-get update && \
pkg-config \
libssl-dev \
protobuf-compiler \
openssl \
&& rm -rf /var/lib/apt/lists/*
# 设置环境变量 (如果需要)

View File

@@ -11,6 +11,7 @@ RUN apt-get update && \
pkg-config \
libssl-dev \
protobuf-compiler \
openssl \
&& rm -rf /var/lib/apt/lists/*
# 设置环境变量 (如果需要)