name: Python code quality check

on:
- push
- pull_request

jobs:

  flake8-lib-python:

    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: 3.8
    - name: Install
      run: |
        python -m pip install --upgrade pip
        pip install flake8==3.8.0
    - name: Run Flake8
      run: |
        cd lib/python
        flake8 --count --statistics --show-source --jobs=$(nproc) .

  flake8-wxgui:

    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: 3.8
    - name: Install
      run: |
        python -m pip install --upgrade pip
        pip install flake8==3.8.0
    - name: Run Flake8
      run: |
        cd gui/wxpython
        flake8 --count --statistics --show-source --jobs=$(nproc) .

  flake8-scripts:

    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: 3.8
    - name: Install
      run: |
        python -m pip install --upgrade pip
        pip install flake8==3.8.0
    - name: Run Flake8
      run: |
        cd scripts
        flake8 --count --statistics --show-source --jobs=$(nproc) .

  flake8-temporal-modules:

    runs-on: ubuntu-20.04

    steps:
    - uses: actions/checkout@v1
    - name: Set up Python
      uses: actions/setup-python@v1
      with:
        python-version: 3.8
    - name: Install
      run: |
        python -m pip install --upgrade pip
        pip install flake8==3.8.0
    - name: Run Flake8
      run: |
        cd temporal
        flake8 --count --statistics --show-source --jobs=$(nproc) .
