name: CI Tests

on: [pull_request,push]

jobs:
  Ubuntu:

    runs-on: ubuntu-20.04

    name: Ubuntu

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Configuring
        run: |
          mkdir build && cd build
          cmake ..

      - name: Building
        run: |
          make -j$(nproc) -C build

  MSVC:

    runs-on: windows-latest

    name: MSVC

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Configuring
        run: |
          mkdir build; cd build
          cmake ..

      - name: Building
        run: |
          cmake --build build --config Debug -- -maxCpuCount

  MinGW-w64:

    runs-on: windows-latest

    name: MinGW-w64

    defaults:
      run:
        shell: msys2 {0}

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 1

      - name: Install MinGW-w64 packages
        uses: msys2/setup-msys2@v2
        with:
          update: true
          install: >-
            make
            mingw-w64-x86_64-cmake
            mingw-w64-x86_64-gcc

      - name: Configuring
        run: |
          mkdir build && cd build
          cmake .. -G"MSYS Makefiles"

      - name: Building
        run: |
          make -C build -j$(nproc)

  macos:

    runs-on: macos-latest

    name: macos

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Configuring
        run: |
          mkdir build && cd build
          cmake ..

      - name: Building
        run: |
          make -j$(sysctl -n hw.logicalcpu) -C build
