xgb + docker + mlflow tracking #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI/CD Pipeline | |
| # This workflow runs on any push to any branch | |
| on: | |
| push: | |
| branches: | |
| - "**" # The '**' matches all branches | |
| jobs: | |
| # --- Continuous Integration Job --- | |
| # This job runs on every push to ensure code quality | |
| ci-pipeline: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install flake8 | |
| pip install -r requirements.txt | |
| - name: Lint with flake8 | |
| run: | | |
| # stop the build if there are Python syntax errors or undefined names | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
| flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
| # --- Continuous Deployment Job --- | |
| # This job ONLY runs when you push to the 'main' branch | |
| cd-pipeline: | |
| # It needs the 'ci-pipeline' job to succeed first | |
| needs: ci-pipeline | |
| runs-on: ubuntu-latest | |
| # This 'if' condition is the key: it only runs for the main branch | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| push: true | |
| tags: shaikhilhaam/olist-review-api:latest # Use your Docker Hub username here |