start.sh fixed (dos2unix) #59
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 - Sentiment API | |
| on: | |
| push: | |
| branches: | |
| - main | |
| # 👇 Les jobs ne s'exécutent que si des fichiers dans /api et sous-dossiers changent | |
| paths: | |
| - Project_07/deployment/api/** | |
| # 👇 Permet de lancer manuellement depuis GitHub | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| env: | |
| # MLflow + S3 bucket configuration | |
| MLFLOW_TRACKING_URI: ${{ secrets.MLFLOW_TRACKING_URI }} | |
| MLFLOW_S3_ENDPOINT_URL: ${{ secrets.MLFLOW_S3_ENDPOINT_URL }} | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # SMTP Configuration | |
| SMTP_SERVER: ${{ secrets.SMTP_SERVER }} | |
| SMTP_PORT: ${{ secrets.SMTP_PORT }} | |
| SMTP_EMAIL: ${{ secrets.SMTP_EMAIL }} | |
| SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }} | |
| SMTP_FROM_ALIAS: ${{ secrets.SMTP_FROM_ALIAS }} | |
| ADMIN_EMAIL: ${{ secrets.ADMIN_EMAIL }} | |
| # API Requests Configuration | |
| SENTIMENT_API_BASE_URL: ${{ secrets.SENTIMENT_API_BASE_URL }} | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r Project_07/deployment/api/requirements.txt | |
| pip install pytest | |
| - name: Run unit tests | |
| run: | | |
| pytest Project_07/deployment/api/tests | |
| build_and_push: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_HUB_LOG }} | |
| password: ${{ secrets.DOCKER_HUB_PWD }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./Project_07/deployment/api | |
| file: ./Project_07/deployment/api/Dockerfile | |
| push: true | |
| tags: docker.io/${{ secrets.DOCKER_HUB_LOG }}/sentiment_api:latest | |