This project is a web-based To-Do list application built with Django, featuring basic capabilities like user accounts, authentication, an API, and an interactive UI (using Skeleton CSS and jQuery).
The primary focus of this repository is its robust CI/CD pipeline, showcasing automated testing, Dockerization, and deployment to Kubernetes using Helm and GitHub Actions.
The project features a comprehensive CI/CD workflow defined in GitHub Actions (.github/workflows/main.yml and reusable-deployment.yml). The pipeline is designed to ensure code quality, build container images, and deploy seamlessly to Kubernetes environments.
-
Triggers & Concurrency Control
- Automatically triggered on
pushandpull_requestto themainbranch. - Supports manual execution (
workflow_dispatch) with input variables to select the target OS (ubuntu-latest,windows-latest) and Python version (3.8,3.9) to deploy. - Concurrency is configured to cancel in-progress runs for the same pull request, ensuring only the latest code is tested.
- Automatically triggered on
-
Branch Protection & Quality Gates
- The
mainbranch is protected, requiring mandatory pull requests. - The
Python CIjob acts as a mandatory status check, ensuring tests pass before any merge is allowed.
- The
-
Python CI (
python-ci)- Uses a Matrix Strategy to run unit tests across multiple OS types (Ubuntu, Windows) and Python versions (3.8, 3.9).
- Generates test coverage reports.
- Performs code linting and complexity checks using
flake8. - Uploads necessary artifacts (Python, Helm charts, and Kind cluster configurations) for subsequent jobs.
-
Docker Build & Push (
docker-ci)- Authenticates with DockerHub using repository secrets.
- Builds a Docker container image for the Django application.
- Pushes the built image to DockerHub.
-
Helm Validation (
helm-ci)- Runs
helm lintandhelm templateto validate the Kubernetes manifests. - Packages the Helm chart for deployment.
- Runs
-
Deployments to Kubernetes (
deploy-helm-dev&deploy-helm-stg)- Utilizes a reusable deployment workflow (
reusable-deployment.yml) to dynamically spin up a Kubernetes Kind (Kubernetes IN Docker) cluster. - Development Environment: Automatically deploys the packaged Helm chart to the development environment.
- Staging Environment: Requires Manual Approval before deploying to the staging environment using specific environment values (
stg.yaml). - Injects necessary secrets (MySQL credentials, Django Secret Key, etc.) directly into the Helm release from GitHub Environment Secrets.
- Utilizes a reusable deployment workflow (
If you want to run the application locally on your machine (requires Python 3.8+ due to Django 4 compatibility):
-
Install dependencies:
pip install -r requirements.txt
-
Create the database schema:
python manage.py migrate
-
Start the development server (defaults to http://localhost:8000):
python manage.py runserver
You can now browse the API or start on the landing page.