# This is a basic workflow to help you get started with Actions

name: CI

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

jobs:
  job1:
    name: Build linux
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [ubuntu-18.04, ubuntu-20.04]
        python-version: [3.8, 3.x]
        compiler_v: [7,8,9]

    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: |
        sudo add-apt-repository ppa:ubuntu-toolchain-r/test  
        sudo apt-get update
        sudo apt-get install -y gcc-${{ matrix.compiler_v }} \
                                g++-${{ matrix.compiler_v }}
        python -m pip install --upgrade pip
        python -m pip install pytest numpy
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
        if [ "${{ matrix.compiler_v }}" == '7' ];then
          pip install -e .[compression]
        else
          pip install -e .
        fi
      env:
        PYTHONPATH: $PWD
        CC: gcc-${{ matrix.compiler_v }}
        CXX: g++-${{ matrix.compiler_v }}
    - name: Lint with flake8
      run: flake8 .
    - name: Run examples
      run: |
        python examples/use_classic.py
        python examples/use_modernised.py
    - name: Test with pytest
      run: py.test -vs tests
        
  job2:
    name: Build macOS
    runs-on: macos-latest
    strategy:
      matrix:
        python-version: [3.6-dev, 3.x]

    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
        python -m pip install pytest numpy
        if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
        pip install -e .
      env:
        PYTHONPATH: $PWD
    - name: Lint with flake8
      run: flake8 .
    - name: Run examples
      run: |
        python examples/use_classic.py
        python examples/use_modernised.py
    - name: Test with pytest
      run: py.test -vs tests


Create CI workflow using GitHub Actions
Create CI workflow using GitHub Actions
