name: Build on OSX

on:
  push:
    branches:
    - '*'
    paths:
    - .github/workflows/build-macos.yml
    - daemon/**
    - i18n/**
    - libi2pd/**
    - libi2pd_client/**
    - Makefile
    - Makefile.homebrew
    tags:
    - '*'
  pull_request:
    branches:
    - '*'

jobs:
  build:
    name: Build on ${{ matrix.target-name }}
    runs-on: ${{ matrix.target }}

    strategy:
      fail-fast: true
      matrix:
        include:
          - target: macos-15
            target-name: ARM64
          - target: macos-15-intel
            target-name: Intel x86_64

    steps:
    - name: Checkout
      uses: actions/checkout@v4

    - name: Install required formulae
      run: |
        find /usr/local/bin -lname '*/Library/Frameworks/Python.framework/*' -delete
        brew update
        brew install boost miniupnpc openssl@3.5

    - name: List installed formulae
      run: brew list

    - name: Build application
      run: make HOMEBREW=1 USE_UPNP=yes USE_STATIC=yes PREFIX=$GITHUB_WORKSPACE/output -j3

    - name: Print binary linking
      run: otool -L i2pd
    
