name: macOS

on: [push, pull_request]

jobs:
  debug-test:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: cmake
      run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug -D CMAKE_BUILD_BENCHMARKS=ON -D CMAKE_BUILD_PROFILER=ON
    - name: build
      run: cmake --build build --parallel 10
    - name: test
      run: cd build ; ctest --output-on-failure
  
  release-test:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: cmake
      run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
    - name: build
      run: cmake --build build --parallel 10
    - name: test
      run: cd build ; ctest --output-on-failure
  
  undefined-test:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: cmake
      run: cmake -S . -B build -DCMAKE_CXX_FLAGS="-fsanitize=undefined -g"
    - name: build
      run: cmake --build build --parallel 10
    - name: test
      run: cd build ; ctest --output-on-failure
  
  tsan-test:
    runs-on: macos-latest
    steps:
    - uses: actions/checkout@v2
    - name: cmake
      run: cmake -S . -B build -DCMAKE_CXX_FLAGS="-fsanitize=thread -g"
    - name: build
      run: cmake --build build --parallel 10
    - name: test
      run: cd build ; ctest --output-on-failure

###############################################################################
# C++ 20 standard test:
###############################################################################

  release-test-cpp20:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: cmake
      run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20
    - name: build
      run: cmake --build build --parallel 10
    - name: test
      run: cd build ; ctest --output-on-failure
  
  tsan-test-cpp20:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: cmake
      run: cmake -S . -B build -DCMAKE_CXX_FLAGS="-fsanitize=thread -g" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20
    - name: build
      run: cmake --build build --parallel 10
    - name: test
      run: cd build ; ctest --output-on-failure


