From d1123f96ae3412e96c6ac79143a948376aab1224 Mon Sep 17 00:00:00 2001 From: Akashdeep Dhar Date: Jan 06 2022 16:16:48 +0000 Subject: Merge branch 'code-quality' into 'main' Add GitLab CI pipeline Closes #40 See merge request t0xic0der/obserware!56 --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a3043fc --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,54 @@ +# Obserware +# Copyright (C) 2021 Akashdeep Dhar + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Reference for CI pipeline file was taken from the following location +# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +image: python:latest + +variables: + PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" + +cache: + paths: + - .cache/pip + - venv/ + +before_script: + - echo "Following is the Python version" + - python3 --version + - echo "Installing venv wrapper and dependency manager" + - pip3 install virtualenv poetry + - echo "Setting up the virtual environment" + - virtualenv venv + - echo "Activating the virtual environment" + - source venv/bin/activate + - echo "Checking the validity of the pyproject.toml file" + - poetry check + - echo "Installing the project dependencies" + - poetry install + +check-code-quality: + script: + - echo "Checking the format of the code" + - black --check --diff obserware/ + - echo "Checking the import order of the dependencies" + - isort --profile black --check --diff obserware/ + +check-build-state: + script: + - echo "Checking the state of the build" + - poetry build diff --git a/obserware/sources/screens/cputwind/operations.py b/obserware/sources/screens/cputwind/operations.py index 599f29f..892aefb 100644 --- a/obserware/sources/screens/cputwind/operations.py +++ b/obserware/sources/screens/cputwind/operations.py @@ -22,8 +22,9 @@ from PyQt5.QtCore import QSize, QThread from PyQt5.QtWidgets import * from obserware import __version__ -from obserware.sources.readers.cputwind.provider import \ - return_mainscreen_onetimed_statistics +from obserware.sources.readers.cputwind.provider import ( + return_mainscreen_onetimed_statistics, +) from obserware.sources.screens.cputwind.interface import Ui_cputwind from obserware.sources.screens.cputwind.worker import Worker from obserware.sources.widgets.cputwdgt.operations import CPUTWdgt diff --git a/obserware/sources/screens/cputwind/worker.py b/obserware/sources/screens/cputwind/worker.py index 66c3085..2407862 100644 --- a/obserware/sources/screens/cputwind/worker.py +++ b/obserware/sources/screens/cputwind/worker.py @@ -21,8 +21,9 @@ import time from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot -from obserware.sources.readers.cputwind.provider import \ - return_mainscreen_threaded_statistics +from obserware.sources.readers.cputwind.provider import ( + return_mainscreen_threaded_statistics, +) class Worker(QObject): diff --git a/obserware/sources/screens/cyclwind/operations.py b/obserware/sources/screens/cyclwind/operations.py index 7db742d..021cfba 100644 --- a/obserware/sources/screens/cyclwind/operations.py +++ b/obserware/sources/screens/cyclwind/operations.py @@ -22,8 +22,9 @@ from PyQt5.QtCore import QSize, QThread from PyQt5.QtWidgets import * from obserware import __version__ -from obserware.sources.readers.cyclwind.provider import \ - return_mainscreen_onetimed_statistics +from obserware.sources.readers.cyclwind.provider import ( + return_mainscreen_onetimed_statistics, +) from obserware.sources.screens.cyclwind.interface import Ui_cyclwind from obserware.sources.screens.cyclwind.worker import Worker from obserware.sources.widgets.cyclwdgt.operations import CyclWdgt diff --git a/obserware/sources/screens/cyclwind/worker.py b/obserware/sources/screens/cyclwind/worker.py index 4aaedd0..d1c751a 100644 --- a/obserware/sources/screens/cyclwind/worker.py +++ b/obserware/sources/screens/cyclwind/worker.py @@ -21,8 +21,9 @@ import time from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot -from obserware.sources.readers.cyclwind.provider import \ - return_mainscreen_threaded_statistics +from obserware.sources.readers.cyclwind.provider import ( + return_mainscreen_threaded_statistics, +) class Worker(QObject): diff --git a/obserware/sources/screens/lgptwind/operations.py b/obserware/sources/screens/lgptwind/operations.py index 4ee5b71..bf13791 100644 --- a/obserware/sources/screens/lgptwind/operations.py +++ b/obserware/sources/screens/lgptwind/operations.py @@ -21,8 +21,9 @@ from PyQt5.QtCore import QSize from PyQt5.QtWidgets import * from obserware import __version__ -from obserware.sources.readers.lgptwind.provider import \ - return_mainscreen_onetimed_statistics +from obserware.sources.readers.lgptwind.provider import ( + return_mainscreen_onetimed_statistics, +) from obserware.sources.screens.lgptwind.interface import Ui_lgptwind from obserware.sources.widgets.lgptwdgt.operations import LgPtWdgt diff --git a/obserware/sources/screens/mainwind/operations.py b/obserware/sources/screens/mainwind/operations.py index f28f1b7..773925f 100644 --- a/obserware/sources/screens/mainwind/operations.py +++ b/obserware/sources/screens/mainwind/operations.py @@ -27,10 +27,14 @@ from PyQt5.QtWidgets import * from obserware import __version__ from obserware.sources.readers.mainwind.tab_information import ( - return_cpu_specifications_information, return_feature_flags_information, - return_obserware_information, return_software_information) -from obserware.sources.readers.mainwind.tab_performance import \ - return_bottombar_onetimed_statistics + return_cpu_specifications_information, + return_feature_flags_information, + return_obserware_information, + return_software_information, +) +from obserware.sources.readers.mainwind.tab_performance import ( + return_bottombar_onetimed_statistics, +) from obserware.sources.screens.cputwind.operations import CPUTWind from obserware.sources.screens.cyclwind.operations import CyclWind from obserware.sources.screens.lgptwind.operations import LgPtWind diff --git a/obserware/sources/screens/mainwind/worker.py b/obserware/sources/screens/mainwind/worker.py index 9cc98d1..cee8859 100644 --- a/obserware/sources/screens/mainwind/worker.py +++ b/obserware/sources/screens/mainwind/worker.py @@ -21,8 +21,11 @@ import time from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot -from obserware.sources.readers.mainwind import (tab_network, tab_performance, - tab_processes) +from obserware.sources.readers.mainwind import ( + tab_network, + tab_performance, + tab_processes, +) class Worker(QObject): diff --git a/obserware/sources/screens/phptwind/operations.py b/obserware/sources/screens/phptwind/operations.py index 557889d..5cee331 100644 --- a/obserware/sources/screens/phptwind/operations.py +++ b/obserware/sources/screens/phptwind/operations.py @@ -21,8 +21,9 @@ from PyQt5.QtCore import QSize from PyQt5.QtWidgets import * from obserware import __version__ -from obserware.sources.readers.phptwind.provider import \ - return_mainscreen_onetimed_statistics +from obserware.sources.readers.phptwind.provider import ( + return_mainscreen_onetimed_statistics, +) from obserware.sources.screens.phptwind.interface import Ui_phptwind from obserware.sources.widgets.phptwdgt.operations import PhPtWdgt diff --git a/obserware/sources/screens/procwind/operations.py b/obserware/sources/screens/procwind/operations.py index 0593be9..7705dfa 100644 --- a/obserware/sources/screens/procwind/operations.py +++ b/obserware/sources/screens/procwind/operations.py @@ -20,12 +20,15 @@ along with this program. If not, see . from PyQt5.QtWidgets import * from obserware import __version__ -from obserware.sources.readers.procwind.controller import (kill_process, - resume_process, - suspend_process, - terminate_process) -from obserware.sources.readers.procwind.provider import \ - return_mainscreen_onetimed_statistics +from obserware.sources.readers.procwind.controller import ( + kill_process, + resume_process, + suspend_process, + terminate_process, +) +from obserware.sources.readers.procwind.provider import ( + return_mainscreen_onetimed_statistics, +) from obserware.sources.screens.procwind.interface import Ui_procwind diff --git a/obserware/sources/screens/sostwind/worker.py b/obserware/sources/screens/sostwind/worker.py index f314ea7..1451268 100644 --- a/obserware/sources/screens/sostwind/worker.py +++ b/obserware/sources/screens/sostwind/worker.py @@ -21,8 +21,9 @@ import time from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot -from obserware.sources.readers.sostwind.provider import \ - return_mainscreen_threaded_statistics +from obserware.sources.readers.sostwind.provider import ( + return_mainscreen_threaded_statistics, +) class Worker(QObject):