name: macOS-x86_64

on: [push, pull_request]

jobs:
  build:

    runs-on: macos-latest

    steps:
    - uses: actions/checkout@v2
    - name: dependencies
      run: brew install pkgconfig libsoxr ccache expat
    - name: cache boost
      id: cache-boost
      uses: actions/cache@v2
      with:
        path: boost_1_75_0
        key: ${{ runner.os }}-boost
    - name: get boost
      if: steps.cache-boost.outputs.cache-hit != 'true'
      run: wget https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.bz2 && tar xjf boost_1_75_0.tar.bz2
    - name: cache ccache
      id: cache-ccache
      uses: actions/cache@v2
      with:
        path: /Users/runner/.ccache
        key: ${{ runner.os }}-ccache-${{ github.sha }}
        restore-keys: ${{ runner.os }}-ccache-
    #- name: ccache dump config
    #  run: ccache -p
    - name: cmake build
      run: cmake -S . -B build -DBOOST_ROOT=boost_1_75_0 -DCMAKE_BUILD_TYPE=Release -DWERROR=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS="-I/usr/local/include"
    - name: cmake make
      run: cmake --build build --parallel 3
