zc2 0.0.29

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:
  macos:
    # Informational only (no merge gate). Gated like release.yml's build-macos:
    # the org has no macOS runner enrolled today, so an ungated job targeting
    # [self-hosted, macOS, ARM64] would sit queued forever. Set the repository
    # variable MACOS_CI=true once a runner is enrolled.
    if: ${{ vars.MACOS_CI == 'true' }}
    runs-on: [self-hosted, macOS, ARM64]
    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: 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