name: Compile and Test on macOS

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:
    runs-on: macos-latest

    env:
      CC: clang
      CXX: clang++

    steps:
    - uses: actions/checkout@v2

    - name: Install automake and pkg-config
      run: |
        brew install automake
        brew install pkg-config

    - name: Install zimg
      run: |
        git clone https://github.com/sekrit-twc/zimg --branch v2.9 --depth 1 ./zimg
        pushd ./zimg
        ./autogen.sh
        ./configure
        make -j2
        sudo make install -j2
        popd
        rm -rf ./zimg

    - name: Setup Python
      uses: actions/setup-python@v2
      with:
        # Version range or exact version of a Python version to use, using SemVer's version range syntax.
        python-version: 3.8

    - name: Install cython
      run: |
        python -m pip install --upgrade pip
        pip install cython

    - name: Set neccessary environment variables
      run: |
        PYTHON_BASE_PATH=$(command -v python | xargs dirname)/..
        echo "::set-env name=LD_LIBRARY_PATH::$LD_LIBRARY_PATH:$PYTHON_BASE_PATH/lib"
        echo "::set-env name=LIBRARY_PATH::$LIBRARY_PATH:$PYTHON_BASE_PATH/lib"
        echo "::set-env name=PKG_CONFIG_PATH::$PYTHON_BASE_PATH/lib/pkgconfig"

    - name: configure
      run: |
        ./autogen.sh
        ./configure

    - name: make
      run: make -j2

    - name: make install
      run: |
        sudo make install -j2
        pip install .

    - name: Run unittest
      run: python -m unittest discover -s ./test/

Add CI with clang on macOS
workflow: Add CI with clang on macOS
