
name: CI MacOS

on:
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: macos-11
    
    strategy:
      matrix:
        build_type: [Debug, Release]
        compiler:
          - {cxx: "g++-11", c: "clang"}
          - {cxx: "clang++", c: "clang"}
        cxx_standard: [11, 14, 17, 20]

    steps:
    - uses: actions/checkout@v3
      with:
        submodules: recursive

    - name: Install libraries
      run: |
        brew install clang-format molten-vk

    - name: Install Ninja
      uses: ashutoshvarma/setup-ninja@master
      with:
        version: 1.11.0
      
    - name: Configure CMake
      run: cmake -B ${{github.workspace}}/build -GNinja
            -DSAMPLES_BUILD=ON
            -DSAMPLES_BUILD_ONLY_DYNAMIC=ON
            -DSAMPLES_BUILD_WITH_LOCAL_VULKAN_HPP=ON
            -DTESTS_BUILD=ON
            -DTESTS_BUILD_ONLY_DYNAMIC=ON
            -DTESTS_BUILD_WITH_LOCAL_VULKAN_HPP=ON
            -DVULKAN_HPP_RUN_GENERATOR=ON
            -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}
            -DCMAKE_C_COMPILER=${{matrix.compiler.c}}
            -DCMAKE_CXX_STANDARD=${{matrix.cxx_standard}}
            -DCMAKE_BUILD_TYPE=${{matrix.build_type}}

    - name: Build
      run: cmake --build ${{github.workspace}}/build --parallel
