From 34dce4287633ed64fcce776558c080c4c1b68493 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Thu, 12 Mar 2026 15:31:42 -0400 Subject: [PATCH 01/25] Update integration-tests.yml --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 637d14f..300bd0d 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -7,7 +7,7 @@ on: push: branches: [ "main", "dev" ] pull_request: - branches: [ "main", "dev" ] + branches: [ "main", "dev", "tests/tests-new-enpoints-and-crud" ] permissions: contents: read From 54bd4b3a7a5e905785b26febe28b807b415e9d10 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:43:32 -0400 Subject: [PATCH 02/25] Update docker_build.yml --- .github/workflows/docker_build.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index b50e15d..d37b9a3 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -4,10 +4,22 @@ on: push: branches: - main + pull_request: jobs: + # test: + # runs-on: ubuntu-latest + + # steps: + # - uses: actions/checkout@v4 + + # - name: Run tests + # run: | + # docker compose --env-file .env.test --profile test up --abort-on-container-exit --exit-code-from orders_service_test + build_and_push: runs-on: ubuntu-latest + # needs: test steps: - uses: actions/checkout@v4 @@ -31,7 +43,8 @@ jobs: - name: Build and push uses: docker/build-push-action@v6 with: - context: ./orders_serivice + context: ./orders_service + target: prod # context: . push: true tags: | From c47b590d95772ecc2c8b6a20fb8515a731fb7d32 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:50:36 -0400 Subject: [PATCH 03/25] Update pylint.yml --- .github/workflows/pylint.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 8fe4212..4ce4fb0 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -19,14 +19,16 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pylint + pip install pylint pylint-junit if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Analysing the code with pylint run: | pylint $(git ls-files '*.py') --exit-zero \ --reports=y \ --output-format=junit-xml:pylint.xml - - uses: actions/upload-artifact@v6 + + - name: upload artifact + uses: actions/upload-artifact@v6 with: name: pylint-report path: pylint.xml From 49a363559c3f3a4c126ab76e77b3fe8567e75ff5 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Fri, 13 Mar 2026 15:59:04 -0400 Subject: [PATCH 04/25] Update docker_build.yml --- .github/workflows/docker_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index d37b9a3..1a18bef 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -4,7 +4,7 @@ on: push: branches: - main - pull_request: + # pull_request: jobs: # test: From d8bacde7a2a9f875582f07225eae9a16867143a7 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Fri, 13 Mar 2026 16:11:31 -0400 Subject: [PATCH 05/25] Update README.md --- README.md | 130 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) diff --git a/README.md b/README.md index e762bfe..bf81464 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,132 @@ # python-CICD-pipeline Two Python microservices (Order + Analytics) that communicate via REST integrated with a postgresql relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. + +--- + + +## Table of Contents + +1. [Overview](#overview) +2. [Project Structure](#project-structure) +3. [Installation](#installation) + - [Creating & Activating a Python Environment](#creating--activating-a-python-environment) + - [Installing Dependencies](#installing-dependencies) +4. [Usage](#usage) +5. [License](#license) +6. [References](#references) + +--- +## Overview + +--- + +## Project Structure + + +``` +. +├──── models/ # holds all .pth model exports +├──── webdemo/ # code for website demo and info +| ├── index.html +| ├── methodology.html +| ├── challenges.html +| ├── results.html +| ├── future-work.html +| ├── server.js +| ├──── static/ +| | ├── app.js +| | ├── style.css +├── dataPreprocessing.py # Script to load and split RT-IoT2022 +└── requirments.txt/environment.yml # Dependencies/Environment needed for this project +``` + +--- + +## Installation + +### Creating & Activating a Python Environment + + +1. **Create** a new environment (example name: `myproject`): + ```bash + python -m venv myproject + ``` +2. **Activate** it: + Windows + ```bash + myproject\Scripts\activate + ``` + + MacOS / Linux + ```sh + source myproject/bin/activate + ``` + +### Installing Dependencies + +Within your **activated** conda environment: + +1. Update pip +```bash +python -m pip install --upgrade pip +``` + +2. Install dependencies via requirements file + +Prod Requirements file +```bash +pip install -r requirements.txt +``` + +Dev Requirements file +```bash +pip install -r requirements_dev.txt +``` + +*(Make sure you are in the new python environment so packages are installed there.)* + +**Typical Requirements** (already in `requirements.txt`): +- Python 3.11 (or similar) +- FastAPI +- SqlAlchemy +- pytest + +--- + +## Usage + +--- + +## Contributing + +1. **Fork** this repository. +2. **Create** a new branch for your feature/fix: + ```bash + git checkout -b feature-my-improvement + ``` +3. **Commit** your changes and push to your fork: + ```bash + git commit -m "Add my new feature" + git push origin feature-my-improvement + ``` +4. **Open a Pull Request** into the main branch. + +We welcome suggestions, bug reports, and community contributions! + +--- + +## License + +This project is licensed under the [MIT License](LICENSE). You’re free to use, modify, and distribute the code as allowed by that license. + +--- + +## References + + +--- + +_Thank you for visiting **python-CICD-pipeline**! If you have any questions or issues, feel free to open an [issue](../../issues) or reach out._ + + +--- From 17fb8dff0bd6080fc8556a2bd9601ce655f6e368 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Fri, 13 Mar 2026 16:13:23 -0400 Subject: [PATCH 06/25] Update README.md --- README.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index bf81464..cdf7e0f 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate python -m venv myproject ``` 2. **Activate** it: + Windows ```bash myproject\Scripts\activate @@ -73,15 +74,15 @@ python -m pip install --upgrade pip 2. Install dependencies via requirements file -Prod Requirements file -```bash -pip install -r requirements.txt -``` - -Dev Requirements file -```bash -pip install -r requirements_dev.txt -``` + Prod Requirements file + ```bash + pip install -r requirements.txt + ``` + + Dev Requirements file + ```bash + pip install -r requirements_dev.txt + ``` *(Make sure you are in the new python environment so packages are installed there.)* From 53942db9d7fad01b16c159c02ed6c682ff4d4b00 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 14:17:27 -0400 Subject: [PATCH 07/25] Update README.md project structure --- README.md | 52 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index cdf7e0f..ff468b4 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate 1. [Overview](#overview) 2. [Project Structure](#project-structure) 3. [Installation](#installation) - - [Creating & Activating a Python Environment](#creating--activating-a-python-environment) + - [Setting up Environment](#setting-up-environment) - [Installing Dependencies](#installing-dependencies) 4. [Usage](#usage) 5. [License](#license) @@ -23,30 +23,42 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ## Project Structure +#### General project structure per serivce ``` . -├──── models/ # holds all .pth model exports -├──── webdemo/ # code for website demo and info -| ├── index.html -| ├── methodology.html -| ├── challenges.html -| ├── results.html -| ├── future-work.html -| ├── server.js -| ├──── static/ -| | ├── app.js -| | ├── style.css -├── dataPreprocessing.py # Script to load and split RT-IoT2022 -└── requirments.txt/environment.yml # Dependencies/Environment needed for this project +{name}_service/ # the service folder +├──── alembic/ # holds all database migrations +├──── app/ # code for api and supporting elements +| ├─── main.py +| ├──── api/ +| | ├──── v1/ +| | | ├─── {service_routes}.py +| | | ├─── health.py # healthcheck routes +| ├──── core/ # configuration and database settings +| ├──── db_logic/ +| | | ├─── crud.py # service table crud logic +| ├──── dependencies/ +| ├──── models/ +| ├──── schemas/ +├──── tests/ +| ├──── factories/ +| ├──── integration_tests/ +| ├──── unit_tests/ +| | ├──── crud_tests/ +| | ├──── schema_tests/ +# misc +├── alembic.ini +├── Dockerfile +├── docker-entrypoint.sh +└── requirements.txt/requirements-dev.txt ``` --- ## Installation -### Creating & Activating a Python Environment +### Setting up Environment - 1. **Create** a new environment (example name: `myproject`): ```bash python -m venv myproject @@ -65,12 +77,12 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ### Installing Dependencies -Within your **activated** conda environment: +Within your **activated** environment: 1. Update pip -```bash -python -m pip install --upgrade pip -``` + ```bash + python -m pip install --upgrade pip + ``` 2. Install dependencies via requirements file From ff8da4840c2638dc9ea0ea96b86e5ec14ba160b2 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 14:26:35 -0400 Subject: [PATCH 08/25] Create LICENSE --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..abbc915 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Willow Connelly + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. From 0861b80e27f854aa91b55090947ebd070a0aaff9 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:44:40 -0400 Subject: [PATCH 09/25] Update README.md --- README.md | 64 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 44 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index ff468b4..2284942 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,11 @@ -# python-CICD-pipeline +# ♾️ python-CICD-pipeline + +![CI](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/tests.yml/badge.svg) +![Python](https://img.shields.io/badge/python-3.11-blue) +![Docker](https://img.shields.io/badge/docker-ready-blue) +![License](https://img.shields.io/badge/license-MIT-green) + + Two Python microservices (Order + Analytics) that communicate via REST integrated with a postgresql relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. --- @@ -6,24 +13,25 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ## Table of Contents -1. [Overview](#overview) -2. [Project Structure](#project-structure) -3. [Installation](#installation) +1. [Overview](#🔎-overview) +2. [Project Structure](#🏗️-project-structure) +3. [Installation](#⬇️-installation) - [Setting up Environment](#setting-up-environment) - [Installing Dependencies](#installing-dependencies) -4. [Usage](#usage) -5. [License](#license) -6. [References](#references) +4. [Usage](#usage) +5. [Contributing](#🤝-contributing) +6. [License](#📜-license) +7. [References](#📋-references) --- -## Overview +## 🔎 Overview --- -## Project Structure +## 🏗️ Project Structure -#### General project structure per serivce +#### General project structure per service ``` . {name}_service/ # the service folder @@ -50,12 +58,12 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ├── alembic.ini ├── Dockerfile ├── docker-entrypoint.sh -└── requirements.txt/requirements-dev.txt +└── requirements.txt / requirements-dev.txt ``` --- -## Installation +## ⬇️ Installation ### Setting up Environment @@ -96,21 +104,32 @@ Within your **activated** environment: pip install -r requirements_dev.txt ``` -*(Make sure you are in the new python environment so packages are installed there.)* +*(Make sure you are in the new python environment so that packages are installed there.)* **Typical Requirements** (already in `requirements.txt`): - Python 3.11 (or similar) -- FastAPI -- SqlAlchemy -- pytest +- FastAPI 0.128 +- SQLAlchemy 2.0 +- Pydantic 2.12 +- Alembic 1.18 --- ## Usage +#### Run services using Docker +In project root run: +```sh +docker compose up --build +``` + +Once running, each Service can be accessed locally via the generated links.
+Order API: http://localhost:8000
+Analytics API: http://localhost:8001 + --- -## Contributing +## 🤝 Contributing 1. **Fork** this repository. 2. **Create** a new branch for your feature/fix: @@ -122,19 +141,24 @@ Within your **activated** environment: git commit -m "Add my new feature" git push origin feature-my-improvement ``` -4. **Open a Pull Request** into the main branch. +4. **Open a Pull Request** into the `dev` branch. + +_NOTE:_ The `main` branch is protected and only updated through +approved pull requests from the `dev` branch.
+ +After review and testing, changes will be merged into `main` during the next release. We welcome suggestions, bug reports, and community contributions! --- -## License +## 📜 License This project is licensed under the [MIT License](LICENSE). You’re free to use, modify, and distribute the code as allowed by that license. --- -## References +## 📋 References --- From 30f01daeef66e1ed81f329284770be5c9b176ffc Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:46:54 -0400 Subject: [PATCH 10/25] Update and rename integration-tests.yml to tests.yml --- .github/workflows/{integration-tests.yml => tests.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{integration-tests.yml => tests.yml} (98%) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/tests.yml similarity index 98% rename from .github/workflows/integration-tests.yml rename to .github/workflows/tests.yml index 300bd0d..c78b55f 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/tests.yml @@ -1,7 +1,7 @@ # 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: integration-tests +name: tests on: push: From ba18cffd816f435844f1fa88757c2f16ad2e1717 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:49:28 -0400 Subject: [PATCH 11/25] Update README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2284942..047cf0d 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # ♾️ python-CICD-pipeline -![CI](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/tests.yml/badge.svg) +### CI / Quality Status ![Python](https://img.shields.io/badge/python-3.11-blue) -![Docker](https://img.shields.io/badge/docker-ready-blue) +![Tests](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/tests.yml/badge.svg) +![Docker Build](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml/badge.svg) +![Pylint](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/pylint.yml/badge.svg) ![License](https://img.shields.io/badge/license-MIT-green) - Two Python microservices (Order + Analytics) that communicate via REST integrated with a postgresql relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. --- From 3c9ee47e55072a7f0c63f8b120b8f5a738b45c71 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:49:55 -0400 Subject: [PATCH 12/25] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 047cf0d..83d9c60 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # ♾️ python-CICD-pipeline +Two Python microservices (Order + Analytics) that communicate via REST integrated with a postgresql relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. + ### CI / Quality Status ![Python](https://img.shields.io/badge/python-3.11-blue) ![Tests](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/tests.yml/badge.svg) @@ -7,7 +9,6 @@ ![Pylint](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/pylint.yml/badge.svg) ![License](https://img.shields.io/badge/license-MIT-green) -Two Python microservices (Order + Analytics) that communicate via REST integrated with a postgresql relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. --- From 5ca31cdb035bb8820f3395b1f7804d198bd5d084 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:52:22 -0400 Subject: [PATCH 13/25] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83d9c60..8a27698 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ### CI / Quality Status ![Python](https://img.shields.io/badge/python-3.11-blue) ![Tests](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/tests.yml/badge.svg) -![Docker Build](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml/badge.svg) +[![Docker image](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml/badge.svg)](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml) ![Pylint](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/pylint.yml/badge.svg) ![License](https://img.shields.io/badge/license-MIT-green) From e925e4753466fabf805a9e79b727ebb36704a178 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:55:38 -0400 Subject: [PATCH 14/25] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8a27698..e8368c6 100644 --- a/README.md +++ b/README.md @@ -15,15 +15,15 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ## Table of Contents -1. [Overview](#🔎-overview) -2. [Project Structure](#🏗️-project-structure) -3. [Installation](#⬇️-installation) +1. [Overview](#overview) +2. [Project Structure](#project-structure) +3. [Installation](#installation) - [Setting up Environment](#setting-up-environment) - [Installing Dependencies](#installing-dependencies) 4. [Usage](#usage) -5. [Contributing](#🤝-contributing) -6. [License](#📜-license) -7. [References](#📋-references) +5. [Contributing](#contributing) +6. [License](#license) +7. [References](#references) --- ## 🔎 Overview From c585677617975c14a198533e5b3b262e1dca8764 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 16:58:11 -0400 Subject: [PATCH 15/25] Update README.md --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e8368c6..fb4116c 100644 --- a/README.md +++ b/README.md @@ -26,10 +26,11 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate 7. [References](#references) --- + ## 🔎 Overview --- - + ## 🏗️ Project Structure @@ -64,7 +65,7 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ``` --- - + ## ⬇️ Installation ### Setting up Environment @@ -116,7 +117,7 @@ Within your **activated** environment: - Alembic 1.18 --- - + ## Usage #### Run services using Docker @@ -130,7 +131,7 @@ Order API: http://localhost:8000
Analytics API: http://localhost:8001 --- - + ## 🤝 Contributing 1. **Fork** this repository. @@ -153,13 +154,13 @@ After review and testing, changes will be merged into `main` during the next rel We welcome suggestions, bug reports, and community contributions! --- - + ## 📜 License This project is licensed under the [MIT License](LICENSE). You’re free to use, modify, and distribute the code as allowed by that license. --- - + ## 📋 References From bd051ddde8151fe90c4a70077e397d5c4b36e7ba Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 17:38:24 -0400 Subject: [PATCH 16/25] Update README.md --- README.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fb4116c..da1f93a 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # ♾️ python-CICD-pipeline - -Two Python microservices (Order + Analytics) that communicate via REST integrated with a postgresql relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. - -### CI / Quality Status ![Python](https://img.shields.io/badge/python-3.11-blue) ![Tests](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/tests.yml/badge.svg) [![Docker image](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml/badge.svg)](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml) ![Pylint](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/pylint.yml/badge.svg) ![License](https://img.shields.io/badge/license-MIT-green) +Two Python microservices (Order + Analytics) that communicate via REST integrated with a postgresql relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. + + --- @@ -29,6 +28,17 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ## 🔎 Overview + +### CI Pipeline +The repo includes a CI pipeline built using **Github Actions** to enforce validation and code quality that runs automatically. + +The pipeline performs the following: + +- Tests - runs unit and integration tests using Pytest on every push and PR request +- Pylint - Lints the code using Pylint on every push and PR request +- Docker Build - Builds and uploads the PROD docker image to DockerHub on every PR request to `main` +- CodeQL - Uses built-in Github CodeQL for static security analysis + --- ## 🏗️ Project Structure @@ -126,10 +136,16 @@ In project root run: docker compose up --build ``` -Once running, each Service can be accessed locally via the generated links.
+Once running, each Service can be accessed locally via the generated links: + Order API: http://localhost:8000
Analytics API: http://localhost:8001 +Interactive Swagger API docs: + +Order API Docs: http://localhost:8000/docs
+Analytics API Docs: http://localhost:8001/docs + --- ## 🤝 Contributing From e5e3689dda64e9e11bdb9574d7b950a50d09274b Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 18:04:47 -0400 Subject: [PATCH 17/25] Update README.md --- README.md | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index da1f93a..a0a3eff 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,17 @@ -# ♾️ python-CICD-pipeline +# ♾️ python CI/CD pipeline ![Python](https://img.shields.io/badge/python-3.11-blue) -![Tests](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/tests.yml/badge.svg) +Actions Status [![Docker image](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml/badge.svg)](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml) ![Pylint](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/pylint.yml/badge.svg) -![License](https://img.shields.io/badge/license-MIT-green) - -Two Python microservices (Order + Analytics) that communicate via REST integrated with a postgresql relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. +License: MIT + +![coverage](https://img.shields.io/badge/coverage-pending-lightgrey) +Two Python microservices (Order + Analytics) that communicate via REST integrated with a PostgreSQL relational database. Each service is Dockerized, unit-tested, and has a CI pipeline that runs tests and security scans. --- - ## Table of Contents 1. [Overview](#overview) @@ -34,16 +34,20 @@ The repo includes a CI pipeline built using **Github Actions** to enforce valida The pipeline performs the following: -- Tests - runs unit and integration tests using Pytest on every push and PR request -- Pylint - Lints the code using Pylint on every push and PR request -- Docker Build - Builds and uploads the PROD docker image to DockerHub on every PR request to `main` -- CodeQL - Uses built-in Github CodeQL for static security analysis - +- Tests - runs unit and integration tests using Pytest on every push and PR. +- Pylint - Lints the code using Pylint on every push and PR. +- Docker Build - Builds and uploads the PROD docker image to DockerHub on every PR to `main` +- CodeQL - Uses built-in GitHub CodeQL for static security analysis + +#### ✍️ Author + +LinkedIn: [Willow Connelly](https://www.linkedin.com/in/willow-connelly-28b197263/)
+GitHub: [WiIliu](https://github.com/wiIliu) + --- ## 🏗️ Project Structure - #### General project structure per service ``` . @@ -114,7 +118,7 @@ Within your **activated** environment: Dev Requirements file ```bash - pip install -r requirements_dev.txt + pip install -r requirements-dev.txt ``` *(Make sure you are in the new python environment so that packages are installed there.)* @@ -128,13 +132,19 @@ Within your **activated** environment: --- -## Usage +## 🚀 Usage #### Run services using Docker In project root run: ```sh docker compose up --build ``` +This starts: +- Orders Service +- Analytics Service +- PostgreSQL database + +> If developing locally, a `test` profile can be used to run the test containers. Once running, each Service can be accessed locally via the generated links: From 19cdd2a80fbb2fdf6980afbd0d287ad94e48f57f Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 18:06:28 -0400 Subject: [PATCH 18/25] Update README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a0a3eff..bcc22fb 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # ♾️ python CI/CD pipeline -![Python](https://img.shields.io/badge/python-3.11-blue) -Actions Status -[![Docker image](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml/badge.svg)](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml) -![Pylint](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/pylint.yml/badge.svg) -License: MIT +![Python](https://img.shields.io/badge/python-3.11-blue) +Actions Status +[![Docker image](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml/badge.svg)](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/docker_build.yml) +![Pylint](https://github.com/wiIliu/python-CICD-pipeline/actions/workflows/pylint.yml/badge.svg) +License: MIT ![coverage](https://img.shields.io/badge/coverage-pending-lightgrey) From 938717dee1741ce4e37da342ea418585b52dab6a Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 19:11:17 -0400 Subject: [PATCH 19/25] Create .pylintrc for linting --- .pylintrc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .pylintrc diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..a6564fd --- /dev/null +++ b/.pylintrc @@ -0,0 +1,18 @@ +[MASTER] +ignore=.venv,venv,migrations,alembic +jobs=0 + +[MESSAGES CONTROL] +# Disable "missing module docstring" message (C0114) +# Disable "missing class docstring" message (C0115) +# Disable "missing function docstring" message (C0116) +# Disable "too many public methods" message (R0904). +disable=C0114,C0115,C0116,R0904 + +[BASIC] +# variable names to always be accepted +good-names=i,j,k,e,DB,db + +[FORMAT] +# Maximum number of characters on a single line. +max-line-length=120 From ef322de37ade700d3bafd79a42f5aa414347c250 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 19:17:12 -0400 Subject: [PATCH 20/25] Update pylint.yml action --- .github/workflows/pylint.yml | 59 +++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 4ce4fb0..f41f92f 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -4,31 +4,48 @@ on: pull_request: branches: - main + push: + branches: + - dev + jobs: - build: + pylint: + name: pylint runs-on: ubuntu-latest strategy: matrix: python-version: ["3.11"] steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pylint pylint-junit - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - - name: Analysing the code with pylint - run: | - pylint $(git ls-files '*.py') --exit-zero \ - --reports=y \ - --output-format=junit-xml:pylint.xml + - uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - uses: dciborow/action-pylint@0.1.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + glob_pattern: "**/*.py" + pylint_rc: .pylintrc + reporter: github-pr-review + level: warning + + # - name: Generate pylint JUnit report + # run: | + # FILES=$(git ls-files '*.py') + # if [ -n "$FILES" ]; then + # pylint $FILES --output-format=junit-xml:pylint.xml + # fi - - name: upload artifact - uses: actions/upload-artifact@v6 - with: - name: pylint-report - path: pylint.xml + # - name: Upload artifact + # uses: actions/upload-artifact@v6 + # with: + # name: pylint-report + # path: pylint.xml From 46d25ca96416ee3459eaeddf47887607ba34dbb4 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 19:21:38 -0400 Subject: [PATCH 21/25] Update tests.yml --- .github/workflows/tests.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c78b55f..199ba13 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,13 +1,10 @@ -# 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: tests +name: Tests on: push: branches: [ "main", "dev" ] pull_request: - branches: [ "main", "dev", "tests/tests-new-enpoints-and-crud" ] + branches: [ "main", "dev" ] permissions: contents: read @@ -42,11 +39,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.11" + cache: "pip" - name: Install dependencies run: | python -m pip install --upgrade pip - pip install pytest pytest-cov alembic + pip install pytest-cov if [ -f orders_service/requirements-dev.txt ]; then pip install -r orders_service/requirements-dev.txt; fi - name: Wait for Postgres @@ -60,7 +58,7 @@ jobs: # env: # DATABASE_URL: postgresql://test:test@localhost:5432/test_db - - name: Integration tests with pytest + - name: Tests with pytest run: | mkdir -p logs LOGFILE="logs/pytest-$(date +'%Y-%m-%d_%H%M%S').log" From 90247aac9ecf0d2b3ca56703b1a8c766b105b459 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 19:22:11 -0400 Subject: [PATCH 22/25] Potential fix for code scanning alert no. 3: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/pylint.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index f41f92f..1cf0020 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -12,6 +12,9 @@ jobs: pylint: name: pylint runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write strategy: matrix: python-version: ["3.11"] From c386279e38afd6bcf8ecf265a014144986c6eed6 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 19:33:16 -0400 Subject: [PATCH 23/25] fix for code scanning alert no. 1: Workflow does not contain permissions Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .github/workflows/docker_build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index 1a18bef..f41ebe5 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -19,6 +19,8 @@ jobs: build_and_push: runs-on: ubuntu-latest + permissions: + contents: read # needs: test steps: From 2e448a790556e57d9cc598da559ec6c3d82ce8a5 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sat, 14 Mar 2026 19:35:41 -0400 Subject: [PATCH 24/25] Update docker_build.yml --- .github/workflows/docker_build.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker_build.yml b/.github/workflows/docker_build.yml index f41ebe5..b885c83 100644 --- a/.github/workflows/docker_build.yml +++ b/.github/workflows/docker_build.yml @@ -1,4 +1,4 @@ -name: Build and push Docker image +name: Docker on: push: @@ -34,14 +34,7 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - # - name: Set lowercase repo name - # run: | - # # echo "REPO=${GITHUB_REPOSITORY@L}" >> "${GITHUB_ENV}" - # echo "REPO=$(echo "${GITHUB_REPOSITORY##*/}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV" - # ${{ vars.DOCKER_USERNAME }}/${{ env.REPO }}/orders-service:${{ github.sha }} - - + - name: Build and push uses: docker/build-push-action@v6 with: From c55633bfca468d5c56ca1505f830485eca8f3b26 Mon Sep 17 00:00:00 2001 From: Willow Connelly <123427248+wiIliu@users.noreply.github.com> Date: Sun, 15 Mar 2026 13:51:04 -0400 Subject: [PATCH 25/25] Update README.md overview --- README.md | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bcc22fb..7244abd 100644 --- a/README.md +++ b/README.md @@ -28,17 +28,46 @@ Two Python microservices (Order + Analytics) that communicate via REST integrate ## 🔎 Overview +This repository contains two containerized RESTful backend microservices—an Orders Service and an Analytics Service—built using FastAPI and Docker with PostgreSQL integration. +The project also includes a CI/CD pipeline implemented with GitHub Actions that automatically runs tests, builds Docker images, and performs security analysis. + +Project Components: +- Orders Microservice +- Analytics Microservice +- PostgreSQL Database +- Alembic Migrations +- Multi-stage Docker Builds +- Docker Compose Orchestration +- GitHub Actions for CI + +The **Orders Microservice** implements a basic RESTful API (FastAPI) that performs CRUD operations against an `orders` database. (_Future work will include adding user authentication for additional security_) + +The **Analytics Microservice** will communicate via API calls with the orders service to retrieve order data and provide calculated statistical metrics. Some of these metrics include total orders, revenue statistics, average order value, and order distribution (_Future work will include creating a basic GUI to display these results in an interactive environment_) + +The services and database are coordinated using Docker Compose, allowing the entire system to be started with a single command. ### CI Pipeline -The repo includes a CI pipeline built using **Github Actions** to enforce validation and code quality that runs automatically. +The repository includes a CI pipeline built using **GitHub Actions** that run automatically to enforce validation, Docker image builds, and code quality. The pipeline performs the following: - - Tests - runs unit and integration tests using Pytest on every push and PR. - Pylint - Lints the code using Pylint on every push and PR. - Docker Build - Builds and uploads the PROD docker image to DockerHub on every PR to `main` - CodeQL - Uses built-in GitHub CodeQL for static security analysis +### Tech Stack +- FastAPI +- SQLAlchemy +- Pydantic +- Alembic +- PostgreSQL +- Docker +- GitHub Actions +- Pytest + +### Learning Goals +This project was constructed in order to gain hands-on experience with building a CI/CD pipeline from the ground-up. It was used as a method to gain experience in connecting microservices together to build scalable architecture. + #### ✍️ Author LinkedIn: [Willow Connelly](https://www.linkedin.com/in/willow-connelly-28b197263/)