ci: Added ci/cd pipelines
Overview
This MR implements comprehensive CI/CD pipelines and automated pre-commit hooks to align this project with the engineering
standards of ehrs-fastapi. The integration ensures code quality, security, and consistent developer workflow through
automated linting, type-checking, and testing.
Changes
1. CI/CD Pipeline Configuration (.gitlab-ci.yml)
Implemented a multi-stage GitLab CI pipeline using uv for high-performance dependency management:
-
Linting: Automated checks using
Ruff,Vulture(Dead Code detection with 85% confidence), andPyupgrade. -
Formatting: Enforces consistent code style with
Ruff Format. -
Type Checking: Project-wide static analysis using
Mypy(includingapp/andtests/). -
Testing: Automated
Pytestexecution with coverage reporting (60% threshold). -
Security: Integrated GitLab Security templates for
SAST,Secret Detection, andDependency Scanning.
2. Pre-commit Hooks Configuration (.pre-commit-config.yaml)
Enforced local developer standards to prevent "broken" code from being committed:
-
Semantic Commits: Integrated
Commitizento enforce the Conventional Commits (Angular) pattern. -
Static Analysis: Local triggers for
Ruff,Mypy, andBandit(Security). -
Local Validation: Local execution of
VultureandPytest-covto ensure quality before pushing.
3. Project Configuration Updates
-
pyproject.toml: UpdatedMypysettings to include thetests/directory and refined exclusion patterns. -
requirements.txt: Added necessary development dependencies includingvulture,pyupgrade,pytest-cov, andpytest-xdist.
How to use locally
To activate the new standards on your local machine, please run: Install new dev dependencies pip install -r requirements.txt
- Install the pre-commit hooks
- pre-commit install
- pre-commit install --hook-type commit-msg
Edited by Bhaskar Battula