name: Windows

on:
  push:
    branches:
      - main
  pull_request:

jobs:
  msvc2019:
    runs-on: windows-2019
    strategy:
      matrix:
        build_type: [Debug, Release]
        architecture: [Win32, x64]

    steps:
      - uses: actions/checkout@v2
      - name: cmake
        run: cmake -S . -B build -A ${{ matrix.architecture }}
        if: matrix.build_type == 'Release'
      - name: cmake
        run: cmake -S . -B build -A ${{ matrix.architecture }}
        if: matrix.build_type == 'Debug'
      - name: build
        run: cmake --build build --config ${{ matrix.build_type }} --parallel 2
      - name: test
        run: cd build && ctest -j 2 -C ${{ matrix.build_type }} --output-on-failure

  msvc2019_latest:
    runs-on: windows-2019

    steps:
      - uses: actions/checkout@v2
      - name: cmake
        run: cmake -S . -B build -DCMAKE_CXX_FLAGS="/permissive- /std:c++latest /utf-8 /W4"
      - name: build
        run: cmake --build build --config Release --parallel 2
      - name: test
        run: cd build && ctest -j 2 -C Release --output-on-failure

  clang-cl-11:
    runs-on: windows-latest
    strategy:
      matrix:
        architecture: [Win32, x64]

    steps:
      - uses: actions/checkout@v2
      - name: cmake
        run: cmake -S . -B build -A ${{ matrix.architecture }} -T ClangCL
      - name: build
        run: cmake --build build --config Debug --parallel 2
      - name: test
        run: cd build && ctest -j 2 -C Debug --output-on-failure
