Skip to content

Update README.md

Update README.md #19

Workflow file for this run

name: CI Pipeline
on: push
jobs:
test-and-package:
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:
DAGSHUB_PAT: ${{ secrets.DAGSHUB_PAT }}
run: |
dvc repro
- name: Run model tests
env:
DAGSHUB_PAT: ${{ secrets.DAGSHUB_PAT }}
run: |
python -m unittest tests/test_model.py
- name: Promote model to production
if: success()
env:
DAGSHUB_PAT: ${{ secrets.DAGSHUB_PAT }}
run: python scripts/promote_model.py
- name: Run Flask app tests
if: success()
env:
DAGSHUB_PAT: ${{ secrets.DAGSHUB_PAT }}
run: python -m unittest tests/test_flask_app.py
- name: Login to AWS ECR
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 ecr get-login-password --region eu-north-1 | docker login --username AWS --password-stdin 843369994444.dkr.ecr.eu-north-1.amazonaws.com
- name: Build Docker Image
run: |
docker build -t text-classification .
- name: Tag Docker Image
run: |
docker tag text-classification:latest 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:v3
- name: Push Docker Image to AWS ECR
run: |
docker push 843369994444.dkr.ecr.eu-north-1.amazonaws.com/text-classification:v3
# Deploy:
# runs-on: ubuntu-latest
# needs: test-and-package
# steps:
# Zip the required files
- name: Zip files for deployment
run: |
zip -r deployment.zip appspec.yml deploy/scripts/install_dependencies.sh deploy/scripts/start_docker.sh
# Upload the ZIP file to S3
- name: Upload ZIP to S3
if: success()
run: |
aws s3 cp deployment.zip s3://text-classification-appspec-bucket/deployment.zip
# Deploy to AWS CodeDeploy using the uploaded ZIP file
- name: Deploy to AWS CodeDeploy
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 deploy create-deployment \
--application-name MyDockerApp \
--deployment-config-name CodeDeployDefault.OneAtATime \
--deployment-group-name MyDeploymentGroup \
--s3-location bucket=text-classification-appspec-bucket,key=deployment.zip,bundleType=zip \
--file-exists-behavior OVERWRITE \
--region eu-north-1