Spaces:
Sleeping
Sleeping
| name: MLOps CI/CD & Continuous Training Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| lint-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install Python Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff pytest anyio httpx pandas numpy scikit-learn joblib xgboost fastapi uvicorn pydantic | |
| - name: Run Ruff Linter | |
| run: ruff check src/ | |
| - name: Run Unit Tests | |
| run: pytest | |
| continuous-training-validation: | |
| needs: lint-and-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: 'pip' | |
| - name: Install Dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pandas numpy scikit-learn joblib xgboost fastapi uvicorn pydantic | |
| - name: Validate Model Retraining Performance | |
| run: python src/validate_retraining.py | |
| docker-build: | |
| needs: continuous-training-validation | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build Backend Container | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| tags: customer-segmentation-api:latest | |