diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..36c9926 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,77 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +jobs: + backend: + name: Backend Quality Checks + runs-on: ubuntu-latest + + defaults: + run: + working-directory: backend + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install backend dependencies + run: pip install -r requirements.txt + + - name: Run Ruff + run: python -m ruff check . + + - name: Run Black check + run: python -m black . --check + + frontend: + name: Frontend Quality Checks + runs-on: ubuntu-latest + + defaults: + run: + working-directory: frontend + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "24" + + - name: Install frontend dependencies + run: npm ci + + - name: Run frontend lint + run: npm run lint + + - name: Build frontend + run: npm run build + + infrastructure: + name: Docker and Kubernetes Validation + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Build backend Docker image + run: docker build -t kmeans-backend ./backend + + - name: Build frontend Docker image + run: docker build -t kmeans-frontend ./frontend + + - name: Validate Kubernetes manifests + run: run: kubectl apply --dry-run=client --validate=false -f k8s/ \ No newline at end of file diff --git a/README.md b/README.md index f19dcf0..18cb845 100644 --- a/README.md +++ b/README.md @@ -70,12 +70,20 @@ The project is designed as an educational tool for learning machine learning fun * Enhanced centroid movement visualization * Inertia charts -* GitHub Actions CI/CD * Cluster assignment visualization improvements * Responsive UI * Dark mode * Linear Regression Visualizer +### 🔄 Continuous Integration + +* Automated backend quality checks +* Automated frontend linting +* Automated frontend production build verification +* Automated Docker image builds +* Automated Kubernetes manifest validation +* GitHub Actions CI workflow + --- ## 🛠️ Tech Stack @@ -100,7 +108,7 @@ The project is designed as an educational tool for learning machine learning fun * Docker Compose * Kubernetes * Ingress -* GitHub Actions (planned) +* GitHub Actions --- @@ -108,6 +116,9 @@ The project is designed as an educational tool for learning machine learning fun ```text KMeansVisualizer/ +.github/ +├── workflows/ +│ └── ci.yml ├── backend/ │ ├── schemas/ │ │ ├── __init__.py @@ -515,6 +526,27 @@ http://localhost:8000/docs --- +## 🔄 GitHub Actions CI + +The project includes an automated CI workflow executed on every push and pull request. + +### Automated Checks + +* Backend Ruff linting +* Backend Black formatting verification +* Frontend ESLint verification +* Frontend production build verification +* Backend Docker image build +* Frontend Docker image build +* Kubernetes manifest validation + +### Workflow File + +```text +.github/workflows/ci.yml +``` +--- + ## ✅ Code Quality ### Backend Code Formatting @@ -618,7 +650,7 @@ kubectl describe pod * `Liveness Probe` - Container health checks * `Readiness Probe` - Traffic readiness checks * `PowerShell Scripts` - Kubernetes automation -* `GitHub Actions` - CI/CD (planned) +* `GitHub Actions` - Continuous Integration --- @@ -649,4 +681,4 @@ This project demonstrates: * Infrastructure Automation * Kubernetes Operational Workflows * Deployment Automation -* CI/CD Automation (planned) \ No newline at end of file +* CI/CD Automation \ No newline at end of file