name: Test Python Library
on: [push]

jobs:
  pip:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        python-version: [3.7, 3.8, 3.9]
        os: [ubuntu-latest, macos-latest]
    steps:
      - uses: actions/checkout@v2
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: ${{ matrix.python-version }}
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install pytest pandas scipy h5py vtk matplotlib pyyaml
      - name: Install and run unit tests
        run: |
          python -m pip install ./python --no-deps -vv --use-feature=in-tree-build
          COLUMNS=256 pytest python

  apt:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install pytest
        run: |
          python -m pip install --upgrade pip
          pip install pytest
      - name: Install dependencies
        run: >
          sudo apt-get update &&
          sudo apt-get install python3-pip python3-pytest python3-pandas python3-scipy
          python3-h5py python3-vtk7 python3-matplotlib python3-yaml -y
      - name: Run unit tests
        run: |
          export PYTHONPATH=${PWD}/python
          COLUMNS=256 python -m pytest python