name: OS X

on:
  push:
    branches: [ master ]
    tags: [ "*" ]
  pull_request:
    branches: [ master ]

jobs:
  osx:
    runs-on: macos-10.15
    continue-on-error: true

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

      - name: install homebrew packages
        run: |
          brew tap casacore/tap 
          brew install casacore --with-python

      - name: make virtualenv
        run: python3 -m venv venv

      - name: Install Python dependencies
        run: venv/bin/pip install --upgrade pip wheel delocate pytest

      - name: Compile and install python-casacore
        run: CFLAGS="-I/usr/local/include -L/usr/local/lib" venv/bin/pip install .

      - name: Run pytest
        run: venv/bin/pytest

      - name: make binary wheel
        run: venv/bin/python3 setup.py bdist_wheel

      - name: Delocate binary wheel
        run: venv/bin/delocate-wheel -v dist/*.whl

      - name: Publish OS X binary wheels
        uses: actions/upload-artifact@v2
        with:
          path: dist/*.whl
