From 3eb556758ae3edfaa78d519137cbdc88af1c4818 Mon Sep 17 00:00:00 2001 From: Akashdeep Dhar Date: Jan 06 2022 16:01:50 +0000 Subject: Add GitLab CI pipeline Signed-off-by: Akashdeep Dhar --- 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