zc2 0.0.49

P2P compute broker with yen-denominated billing, WAL, and broker mesh support
name: macOS app

permissions:
  contents: read

on:
  # PR-only: one shared mac-zakuro runner, informational job, no deploy.
  # (The master push re-run was dropped; the PR already ran the same paths.)
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review, edited]
    paths:
      - "macos/**"
      - "docs/agent-api/**"
      - ".github/workflows/macos.yml"

concurrency:
  group: macos-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
  runner:
    uses: zakuro-ai/zakuro-infra/.github/workflows/pick-runner.yml@main
    permissions: { actions: read }
    secrets: inherit
    if: >-
      github.event_name != 'pull_request' || (
      github.event.pull_request.draft == false &&
      (github.event.action != 'edited' || github.event.changes.base != null) &&
      (github.base_ref == github.event.repository.default_branch || startsWith(github.base_ref, 'release/')))

  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