Skip to content

update requirements #231

update requirements

update requirements #231

Workflow file for this run

---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#############################
# Start the job on all push #
#############################
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
###############
# Set the Job #
###############
jobs:
build_controller:
# Name the Job
name: Lint Code Base - Controller
# Set the agent to run on
runs-on: ubuntu-latest
###################
# Python versions #
###################
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
#########################
# Pick a Python version #
#########################
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
##############################
# Set up a Python virtualenv #
##############################
- name: Set up Python virtual environment
run: |
# Create a virtualenv
python -m venv python${{ matrix.python-version }}-venv-controller
# Activate virtualenv
source python${{ matrix.python-version }}-venv-controller/bin/activate
########################
# Install dependencies #
########################
- name: Install dependencies
run: |
# Activate virtualenv
source python${{ matrix.python-version }}-venv-controller/bin/activate
# Install dependencies required by the controller
sudo apt-get install graphviz libgraphviz-dev
# Upgrade pip
python -m pip install --upgrade pip
# Install linters and other python modules
pip install pylint pycodestyle flake8 black mypy isort setuptools wheel pytest
##############################
# Install controller modules #
##############################
- name: Install controller modules
run: |
# Activate virtualenv
source python${{ matrix.python-version }}-venv-controller/bin/activate
# Setup db_update library
cd db_update
python setup.py install
# Setup protos
cd ../control_plane/protos
python setup.py install
# Setup controller modules
cd ../../control_plane/controller
python setup.py install
cd ../../
################################
# Run Linter against code base #
################################
- name: Python Code Quality and Lint
run: |
# Activate virtualenv
source python${{ matrix.python-version }}-venv-controller/bin/activate
# Module to be tested
cd db_update
module="db_update" # control_plane/protos folder excluded
# pylint
echo Running: pylint $module --disable=similarities
pylint $module --disable=similarities
if [ "$?" = "0" ]; then echo "Pylint ok"; else echo "Pylint error"; exit $exit_code; fi
# pycodestyle
echo Running: pycodestyle $module
pycodestyle $module
if [ "$?" = "0" ]; then echo "pycodestyle ok"; else echo "pycodestyle error"; exit $exit_code; fi
# flake8
echo Running: flake8 $module
flake8 $module
if [ "$?" = "0" ]; then echo "Flake8 ok"; else echo "Flake8 error"; exit $exit_code; fi
# black
# echo Running: black --check $module
# black --check $module
# if [ "$?" = "0" ]; then echo "Black ok"; else echo "Black error"; exit $exit_code; fi
# mypy
# echo Running: mypy $module
# mypy $module
# if [ "$?" = "0" ]; then echo "mypy ok"; else echo "mypy error"; exit $exit_code; fi
# isort
echo Running: isort -rc $module -c --diff
isort -rc $module -c --diff --project db_update
if [ "$?" = "0" ]; then echo "isort ok"; else echo "isort error"; exit $exit_code; fi
cd ../
#
# Module to be tested
cd control_plane/controller/
module="controller" # control_plane/protos folder excluded
# pylint
echo Running: pylint $module --disable=similarities
pylint $module --disable=similarities
if [ "$?" = "0" ]; then echo "Pylint ok"; else echo "Pylint error"; exit $exit_code; fi
# pycodestyle
echo Running: pycodestyle $module
pycodestyle $module
if [ "$?" = "0" ]; then echo "pycodestyle ok"; else echo "pycodestyle error"; exit $exit_code; fi
# flake8
echo Running: flake8 $module
flake8 $module
if [ "$?" = "0" ]; then echo "Flake8 ok"; else echo "Flake8 error"; exit $exit_code; fi
# black
# echo Running: black --check $module
# black --check $module
# if [ "$?" = "0" ]; then echo "Black ok"; else echo "Black error"; exit $exit_code; fi
# mypy
# echo Running: mypy $module
# mypy $module
# if [ "$?" = "0" ]; then echo "mypy ok"; else echo "mypy error"; exit $exit_code; fi
# isort
echo Running: isort -rc $module -c --diff
isort -rc $module -c --diff --project controller
if [ "$?" = "0" ]; then echo "isort ok"; else echo "isort error"; exit $exit_code; fi
cd ../../
build_node_manager:
# Name the Job
name: Lint Code Base - Node Manager
# Set the agent to run on
runs-on: ubuntu-latest
###################
# Python versions #
###################
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
#########################
# Pick a Python version #
#########################
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
##############################
# Set up a Python virtualenv #
##############################
- name: Set up Python virtual environment
run: |
# Create a virtualenv
python -m venv python${{ matrix.python-version }}-venv-node-mgr
# Activate virtualenv
source python${{ matrix.python-version }}-venv-node-mgr/bin/activate
########################
# Install dependencies #
########################
- name: Install dependencies
run: |
# Activate virtualenv
source python${{ matrix.python-version }}-venv-node-mgr/bin/activate
# Upgrade pip
python -m pip install --upgrade pip
# Install linters and other python modules
pip install pylint pycodestyle flake8 black mypy isort setuptools wheel pytest
################################
# Install node manager modules #
################################
- name: Install node manager modules
run: |
# Activate virtualenv
source python${{ matrix.python-version }}-venv-node-mgr/bin/activate
# Setup protos
cd control_plane/protos
python setup.py install
# Setup node-manager modules
cd ../../control_plane/node-manager
python setup.py install
cd ../../
################################
# Run Linter against code base #
################################
- name: Python Code Quality and Lint
run: |
# Activate virtualenv
source python${{ matrix.python-version }}-venv-node-mgr/bin/activate
# Module to be tested
cd control_plane/node-manager
module="node_manager" # control_plane/protos folder excluded
# pylint
echo Running: pylint $module --disable=similarities
pylint $module --disable=similarities
if [ "$?" = "0" ]; then echo "Pylint ok"; else echo "Pylint error"; exit $exit_code; fi
# pycodestyle
echo Running: pycodestyle $module
pycodestyle $module
if [ "$?" = "0" ]; then echo "pycodestyle ok"; else echo "pycodestyle error"; exit $exit_code; fi
# flake8
echo Running: flake8 $module
flake8 $module
if [ "$?" = "0" ]; then echo "Flake8 ok"; else echo "Flake8 error"; exit $exit_code; fi
# black
# echo Running: black --check $module
# black --check $module
# if [ "$?" = "0" ]; then echo "Black ok"; else echo "Black error"; exit $exit_code; fi
# mypy
# echo Running: mypy $module
# mypy $module
# if [ "$?" = "0" ]; then echo "mypy ok"; else echo "mypy error"; exit $exit_code; fi
# isort
echo Running: isort -rc $module -c --diff
isort -rc $module -c --diff --project node_manager
if [ "$?" = "0" ]; then echo "isort ok"; else echo "isort error"; exit $exit_code; fi
cd ../../