name: macOS Latest Build
on: [push, pull_request]
#on: workflow_dispatch

jobs:
  build:
    strategy:
      matrix:
        cmake_build: ['-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_BUILD_TYPE=Debug']
        cmake_options: ['', '-DENABLE_LINK=OFF', '-DENABLE_SDL=ON']
    runs-on: macos-latest

    steps:
      - name: Checkout the code
        uses: actions/checkout@v2
        with: 
          submodules: recursive
      - name: Install nix
        uses: cachix/install-nix-action@v22
        with:
          nix_path: nixpkgs=channel:nixos-unstable
      - name: Configure
        run: >-
          nix-shell --command 'cmake -B build -G Ninja ${{ matrix.cmake_build }} ${{ matrix.cmake_options }}'
      - name: Build
        run: >-
          nix-shell --command 'ninja -C build'