name: macos

on:
  push:
    branches:
      - master
    tags:
      - 'v*'
  pull_request:
    branches:
      - master

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v5
      - name: Install Deps
        run: |
          brew uninstall cmake; \
          brew install \
            cmake \
            pkg-config \
            duktape \
            exiv2 \
            fmt \
            ffmpeg \
            wavpack \
            ffmpegthumbnailer \
            googletest \
            libexif \
            libmagic \
            libmatroska \
            libupnp \
            ossp-uuid \
            ninja \
            pugixml \
            jsoncpp \
            icu4c \
            spdlog \
            taglib

      - name: Build
        run: |
          cmake -S . -G Ninja -B build --preset=macos
          cmake --build build -j$(sysctl -n hw.physicalcpu) --verbose

      - name: Test
        run: |
          cd build
          ctest --output-on-failure
