From 22adff09f35cf6feede02c63c368d086c1a7ed1c Mon Sep 17 00:00:00 2001 From: madeline-yana <88592098+madeline-yana@users.noreply.github.com> Date: Wed, 2 Dec 2026 21:18:43 -0500 Subject: [PATCH] ci(macos): build and release Intel Macs alongside Apple silicon - add a macOS CI workflow that tests and packages both architectures: macos-15 (Apple silicon) and macos-15-intel - add a macos-intel release job that signs, notarizes and uploads the x86_64 zip next to the existing arm64 asset; the existing macOS and Linux jobs are untouched, so this is purely additive and merges independently of the Windows port - the updater already picks assets by -.zip, so no app change is needed - the README install section names both architectures --- .github/workflows/ci-macos.yml | 52 +++++++++++++++++++++++ .github/workflows/release.yml | 78 ++++++++++++++++++++++++++++++++++ README.md | 6 +-- 3 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci-macos.yml diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml new file mode 100644 index 0000000..91edc1c --- /dev/null +++ b/.github/workflows/ci-macos.yml @@ -0,0 +1,52 @@ +# Builds and tests both macOS architectures on every change to the code, so a +# release never finds out about an Intel or Apple silicon break. The zip is +# kept as an artifact for trying a change before it is released. +# +# Separate from ci.yml so the macOS and Linux CI can evolve independently. +name: CI macOS + +on: + push: + branches: [main] + paths: ["src/**", "assets/**", "extensions/**", "Cargo.*", "rust-toolchain.toml", "script/bundle.sh", "script/notarize.sh", "script/third-party-licenses.sh", "resources/**", ".github/workflows/ci-macos.yml"] + pull_request: + paths: ["src/**", "assets/**", "extensions/**", "Cargo.*", "rust-toolchain.toml", "script/bundle.sh", "script/notarize.sh", "script/third-party-licenses.sh", "resources/**", ".github/workflows/ci-macos.yml"] + workflow_dispatch: + +permissions: + contents: read + +jobs: + macos: + strategy: + fail-fast: false + matrix: + # macos-15 is Apple silicon; macos-15-intel is the Intel image. + runner: [macos-15, macos-15-intel] + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v4 + + - uses: Swatinem/rust-cache@v2 + + - name: Test + run: cargo test --locked + + - name: Install cargo-about + run: cargo install cargo-about --locked --features cli --version 0.9.3 + + - name: Build the app bundle + run: script/bundle.sh + + - name: Package + run: | + version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) + arch=$(uname -m | sed 's/arm64/aarch64/') + asset="target/release/Pi-GPUI-$version-$arch.zip" + ditto -c -k --sequesterRsrc --keepParent "target/release/Pi GPUI.app" "$asset" + + - uses: actions/upload-artifact@v4 + with: + name: pi-gpui-macos-${{ runner.arch }} + path: target/release/Pi-GPUI-*-*.zip + retention-days: 14 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7169f44..f39dc90 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -97,6 +97,84 @@ jobs: if: always() run: security delete-keychain "$RUNNER_TEMP/signing.keychain-db" || true + # Added by the Intel Mac port: builds the same app for x86_64 and adds its + # zip to the release the arm64 job created. The steps are the arm64 job's, + # so it stays an independent, additive change until both architectures are + # folded into one matrix. + macos-intel: + needs: macos + runs-on: macos-15-intel + steps: + - uses: actions/checkout@v4 + + - name: Check that the tag matches Cargo.toml + run: | + version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1) + if [ "v$version" != "$GITHUB_REF_NAME" ]; then + echo "Tag $GITHUB_REF_NAME does not match Cargo.toml version $version" >&2 + exit 1 + fi + echo "VERSION=$version" >> "$GITHUB_ENV" + + - uses: Swatinem/rust-cache@v2 + + - name: Test + run: cargo test --locked + + - name: Install cargo-about + run: cargo install cargo-about --locked --features cli --version 0.9.3 + + - name: Import the signing certificate + env: + CERTIFICATE_P12: ${{ secrets.MACOS_CERTIFICATE_P12 }} + CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }} + run: | + keychain="$RUNNER_TEMP/signing.keychain-db" + keychain_password=$(uuidgen) + echo "$CERTIFICATE_P12" | base64 --decode > "$RUNNER_TEMP/certificate.p12" + security create-keychain -p "$keychain_password" "$keychain" + security set-keychain-settings -lut 21600 "$keychain" + security unlock-keychain -p "$keychain_password" "$keychain" + security import "$RUNNER_TEMP/certificate.p12" -k "$keychain" \ + -P "$CERTIFICATE_PASSWORD" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: \ + -s -k "$keychain_password" "$keychain" > /dev/null + security list-keychains -d user -s "$keychain" $(security list-keychains -d user | tr -d '"') + rm "$RUNNER_TEMP/certificate.p12" + identity=$(security find-identity -v -p codesigning "$keychain" \ + | sed -n 's/.*"\(Developer ID Application: .*\)"/\1/p' | head -1) + if [ -z "$identity" ]; then + echo "No Developer ID Application certificate in MACOS_CERTIFICATE_P12" >&2 + exit 1 + fi + echo "SIGN_IDENTITY=$identity" >> "$GITHUB_ENV" + + - name: Build the app bundle + run: script/bundle.sh + + - name: Notarize + env: + API_KEY_P8: ${{ secrets.APPLE_API_KEY_P8 }} + APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} + APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }} + run: | + export APPLE_API_KEY_PATH="$RUNNER_TEMP/AuthKey.p8" + printf '%s\n' "$API_KEY_P8" > "$APPLE_API_KEY_PATH" + script/notarize.sh "target/release/Pi GPUI.app" + rm "$APPLE_API_KEY_PATH" + + - name: Package and add it to the release + env: + GH_TOKEN: ${{ github.token }} + run: | + asset="Pi-GPUI-$VERSION-x86_64.zip" + ditto -c -k --sequesterRsrc --keepParent "target/release/Pi GPUI.app" "target/release/$asset" + gh release upload "$GITHUB_REF_NAME" "target/release/$asset" --clobber + + - name: Remove the signing keychain + if: always() + run: security delete-keychain "$RUNNER_TEMP/signing.keychain-db" || true + # The Linux builds join the release the macOS job created. If one of them # fails, the macOS release is already out and the job can be run again. linux: diff --git a/README.md b/README.md index bebe0b8..f146c93 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A native GUI for the [pi](https://github.com/earendil-works/pi) coding agent, wr The app is 16 MB, its window is up in about 0.4 s, and it uses about 75 MB of memory at idle. Electron clients for pi take 0.5 to 1.1 s and 190 to 430 MB. Measured on an M1 Pro with no projects open, counting each app's own processes ([method and script](docs/BENCHMARKS.md)). -[![macOS 13+, Apple silicon](https://img.shields.io/badge/macOS-13%2B%20Apple%20silicon-111?logo=apple&logoColor=white)](#install) +[![macOS 13+, Apple silicon and Intel](https://img.shields.io/badge/macOS-13%2B%20Apple%20silicon%20%C2%B7%20Intel-111?logo=apple&logoColor=white)](#install) [![Linux x86_64 and arm64](https://img.shields.io/badge/Linux-x86__64%20%C2%B7%20arm64%20(beta)-111?logo=linux&logoColor=white)](#install) [![MIT](https://img.shields.io/badge/license-MIT-111)](LICENSE) @@ -16,13 +16,13 @@ The app is 16 MB, its window is up in about 0.4 s, and it uses about 75 MB of me ## Install -**macOS** (Apple silicon, macOS 13 or newer) +**macOS** (Apple silicon and Intel, macOS 13 or newer) ```sh brew install --cask bytesbay/tap/pi-gpui ``` -Or download `Pi-GPUI-*.zip` from [Releases](https://github.com/bytesbay/pi-gpui/releases) and move the app to Applications. Releases are signed with a Developer ID certificate and notarized by Apple. +Or download `Pi-GPUI-*-aarch64.zip` (Apple silicon) or `Pi-GPUI-*-x86_64.zip` (Intel) from [Releases](https://github.com/bytesbay/pi-gpui/releases) and move the app to Applications. Releases are signed with a Developer ID certificate and notarized by Apple. **Linux** (x86_64 and arm64, beta)