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@v4
      - name: Install Deps
        run: |
          brew install \
            cmake \
            duktape \
            exiv2 \
            fmt \
            ffmpeg \
            ffmpegthumbnailer \
            googletest \
            libexif \
            libmagic \
            libmatroska \
            libupnp \
            ossp-uuid \
            ninja \
            pugixml \
            spdlog \
            taglib

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

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