zc2 0.0.39

P2P compute broker with credit-based billing, WAL, and broker mesh support
name: macOS app

permissions:
  contents: read

on:
  push:
    branches:
      - master
    paths:
      - "macos/**"
      - "docs/agent-api/**"
      - ".github/workflows/macos.yml"
  pull_request:
    paths:
      - "macos/**"
      - "docs/agent-api/**"
      - ".github/workflows/macos.yml"

concurrency:
  group: macos-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ !startsWith(github.ref, 'refs/heads/master') }}

jobs:
  runner:
    uses: zakuro-ai/zakuro-infra/.github/workflows/pick-runner.yml@main
    permissions: { actions: read }
    secrets: inherit

  macos:
    # Informational only (no merge gate). Hosted macos-14 first, else the
    # enrolled self-hosted Mac.
    needs: runner
    runs-on: ${{ fromJSON(needs.runner.outputs.runner_macos) }}
    timeout-minutes: 20
    steps:
      # Same hygiene as release.yml: a previous job may have left a global git URL
      # rewrite that breaks this checkout.
      - name: Purge stale git URL rewrites (runner hygiene)
        shell: bash
        run: |
          git config --global --remove-section 'url.ssh://git@github.com/zakuro-ai/' 2>/dev/null || true
          git config --global --unset-all core.sshCommand 2>/dev/null || true

      - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0  # v7.0.0

      - name: Homebrew on PATH (LaunchAgent runners start with a minimal PATH)
        run: |
          for d in /opt/homebrew/bin /usr/local/bin; do [ -d "$d" ] && echo "$d" >> "$GITHUB_PATH"; done

      - name: Tooling
        run: |
          command -v xcodegen >/dev/null || brew install xcodegen
          xcodebuild -version
          swift --version

      - name: ZakuroAgentKit tests (swift test)
        run: swift test --package-path macos/Packages/ZakuroAgentKit

      - name: Generate the Xcode project
        run: xcodegen generate --spec macos/project.yml

      - name: Build app + widget (unsigned)
        run: >-
          xcodebuild build -project macos/Zakuro.xcodeproj -scheme Zakuro
          -configuration Release -destination 'generic/platform=macOS'
          -derivedDataPath macos/build CODE_SIGNING_ALLOWED=NO