name: ubuntu

on: [push, pull_request]

jobs:
  ubuntu:
    runs-on: ubuntu-20.04
    strategy:
      fail-fast: false
      matrix:
        build: [Debug, Release]
        compiler:
        - { cc: "gcc-9",    cxx: "g++-9" }
        - { cc: "gcc-10",   cxx: "g++-10" }
        - { cc: "clang-10", cxx: "clang++-10" }
        - { cc: "clang-11", cxx: "clang++-11" }
        - { cc: "clang-12", cxx: "clang++-12" }

    name: "${{matrix.compiler.cxx}}:${{matrix.build}}"
    steps:
    - uses: actions/checkout@v2

    - name: Configure CMake
      run: cmake -DCMAKE_BUILD_TYPE=${{matrix.build}} -DCMAKE_C_COMPILER=${{matrix.compiler.cc}} -DCMAKE_CXX_COMPILER=${{matrix.compiler.cxx}}

    - name: Build
      run: cmake --build . --config ${{matrix.build}}

    - name: Tests
      run: ctest --output-on-failure -C ${{matrix.build}}
