From 301e06fed65d1e9f65a9ffb3bb129de5b30478aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucca=20Baumg=C3=A4rtner?= <44930425+luccalb@users.noreply.github.com> Date: Sat, 28 Oct 2023 17:36:22 +0200 Subject: [PATCH] Feature/9 initial cicd pipeline (#38) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --------- Signed-off-by: Lucca Baumgärtner --- .github/workflows/python-app.yml | 69 ++++++ Documentation/Media/BDC_Features.drawio | 215 ++++++++++++++++++ .../Media/BDC_Features.drawio.license | 6 + Pipfile | 2 + src/test_dummy.py | 8 + 5 files changed, 300 insertions(+) create mode 100644 .github/workflows/python-app.yml create mode 100644 Documentation/Media/BDC_Features.drawio create mode 100644 Documentation/Media/BDC_Features.drawio.license create mode 100644 src/test_dummy.py diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml new file mode 100644 index 0000000..894bfd9 --- /dev/null +++ b/.github/workflows/python-app.yml @@ -0,0 +1,69 @@ +# SPDX-License-Identifier: MIT +# SPDX-FileCopyrightText: 2023 Lucca Baumgärtner + +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Python application + +on: [push, pull_request] + +permissions: + contents: read + +jobs: + license: + name: License check + runs-on: ubuntu-latest + steps: + - name: Checkout the code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Dump all dependencies + run: | + python -m pip install --upgrade pip + pip install pipenv + pipenv install + pipenv run pip freeze > requirements-all.txt + - name: Check copyright + id: license_check_report + uses: pilosus/action-pip-license-checker@v2 + with: + requirements: "requirements-all.txt" + fail: "Copyleft" + totals: true + headers: true + - name: Print copyright report + run: echo "${{ steps.license_check_report.outputs.report }}" + + build: + name: Lint and Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install flake8 pytest pipenv + # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + pipenv install + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pipenv run pytest diff --git a/Documentation/Media/BDC_Features.drawio b/Documentation/Media/BDC_Features.drawio new file mode 100644 index 0000000..b109f91 --- /dev/null +++ b/Documentation/Media/BDC_Features.drawio @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Documentation/Media/BDC_Features.drawio.license b/Documentation/Media/BDC_Features.drawio.license new file mode 100644 index 0000000..dbe713d --- /dev/null +++ b/Documentation/Media/BDC_Features.drawio.license @@ -0,0 +1,6 @@ +SPDX-License-Identifier: MIT +SPDX-FileCopyrightText: 2023 Lucca Baumgärtner +SPDX-FileCopyrightText: 2023 Sophie Heasman +SPDX-FileCopyrightText: 2023 Tetiana Kraft +SPDX-FileCopyrightText: 2023 Ruchita Nathani +SPDX-FileCopyrightText: 2023 Fabian-Paul Utech diff --git a/Pipfile b/Pipfile index 0f71bda..07baa54 100644 --- a/Pipfile +++ b/Pipfile @@ -7,8 +7,10 @@ verify_ssl = true name = "pypi" [dev-packages] +pytest = "==7.4.3" [packages] +numpy = "==1.26.1" [requires] python_version = "3.10" diff --git a/src/test_dummy.py b/src/test_dummy.py new file mode 100644 index 0000000..fb7df7b --- /dev/null +++ b/src/test_dummy.py @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: MIT +# SPDX-FileCopyrightText: 2023 Lucca Baumgärtner +def inc(x): + return x + 1 + + +def test_inc(): + assert inc(2) == 3