name: CMake

on:
  push:
  pull_request:

#env:
  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  # BUILD_TYPE: Debug

jobs:
  build:
    # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
    # You can convert this to a matrix build if you need cross-platform coverage.
    # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [
          ubuntu-20.04, 
          ubuntu-22.04, 
          macos-12,
          macos-13,
          macos-14,
          windows-2019,
          windows-2022,
        ]  
        cpp_version: [11, 14, 17, 20]
        build_type: [Release, Debug]

    steps:
    - uses: actions/checkout@v2

    - name: Configure CMake
      run: cmake -B ${{github.workspace}}/build -DBUILD_TESTING=ON -DCMAKE_CXX_STANDARD=${{matrix.cpp_version}} -DCMAKE_BUILD_TYPE=${{matrix.build_type}}

    - name: Build
      run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}

    - name: Test
      working-directory: ${{github.workspace}}/build
      run: ctest -C ${{matrix.build_type}} --output-on-failure --verbose

