CICD run - 11 #11
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 Pipeline | |
| on: push | |
| jobs: | |
| project-testing: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@v3 | |
| - name: setup python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: install dependencies | |
| run: | | |
| pip install -r requirements.txt | |
| - name: run pipeline | |
| env: | |
| CAPSTONE_TEST: ${{ secrets.CAPSTONE_TEST }} | |
| run: | | |
| dvc repro | |
| - name: Run model tests | |
| env: | |
| CAPSTONE_TEST: ${{ secrets.CAPSTONE_TEST }} | |
| run: | | |
| python -m unittest tests/test_model.py | |
| - name: Promote model to production | |
| if: success() | |
| env: | |
| CAPSTONE_TEST: ${{ secrets.CAPSTONE_TEST }} | |
| run: python scripts/promote_model.py | |
| - name: Run FastAPI app tests | |
| if: success() | |
| env: | |
| CAPSTONE_TEST: ${{ secrets.CAPSTONE_TEST }} | |
| run: python -m unittest tests/test_fastapi_app.py | |
| # - name: Login to AWS ECR | |
| # if: success() | |
| # run: | | |
| # aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| # aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| # aws configure set region ${{ secrets.AWS_REGION }} | |
| # aws ecr get-login-password --region ${{ secrets.AWS_REGION }} | docker login --username AWS --password-stdin ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com | |
| # - name: Build Docker image | |
| # run: | | |
| # docker build -t ${{ secrets.ECR_REPOSITORY }}:latest . | |
| # - name: Tag Docker image | |
| # run: | | |
| # docker tag ${{ secrets.ECR_REPOSITORY }}:latest \ | |
| # ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ secrets.ECR_REPOSITORY }}:latest | |
| # - name: Check Docker Authentication | |
| # run: docker info | |
| # - name: Push Docker image to ECR | |
| # run: | | |
| # docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.${{ secrets.AWS_REGION }}.amazonaws.com/${{ secrets.ECR_REPOSITORY }}:latest |