name: CMake

on:
  push:
    branches: [ master, asar_19, asar_2_beta ]
  pull_request:
    branches: [ master, asar_19, asar_2_beta ]

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

jobs:
  build:
    strategy:
      matrix:
        config: ['windows-msvc-2019']
        os: ['windows-2019']
        generator: ['-G "Visual Studio 16 2019"']
        toolset: ['-T v142']
        include:
          - config: ubuntu-20
            os: ubuntu-20.04
    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v2

    - name: Configure CMake
      run: cmake -S ${{github.workspace}}/src -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} ${{ matrix.generator }} ${{ matrix.toolset }}

    - name: Build
      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

    - name: Tests
      run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target run-tests
