Skip to content

Commit

Permalink
Update ci_cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
elamraniadnane1 authored May 14, 2024
1 parent bd6fff1 commit 3dd9bff
Showing 1 changed file with 48 additions and 42 deletions.
90 changes: 48 additions & 42 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ZenML Pipeline Execution
name: CI/CD Pipeline

on:
push:
Expand All @@ -9,47 +9,53 @@ on:
- main

jobs:
run-zenml-pipeline:
build-and-deploy:
runs-on: ubuntu-latest

services:
cassandra:
image: cassandra:latest
ports:
- 9042:9042
options: >
--health-cmd "cqlsh -e 'DESCRIBE KEYSPACES'"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run ZenML Pipeline
run: |
zenml up
zenml run
env:
CASSANDRA_CLUSTER: "localhost"

- name: Shutdown ZenML services
if: always()
run: zenml down

- name: Log Metrics to MLflow
run: |
pip install mlflow
mlflow server --backend-store-uri sqlite:///mlflow.db --default-artifact-root ./mlruns --host 0.0.0.0 --port 5000
env:
MLFLOW_TRACKING_URI: http://localhost:5000
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint code
run: |
pip install flake8
flake8 .
- name: Build Docker image for FastAPI
run: docker build -t fastapi-bert-predictor -f Dockerfile .

- name: Build Docker image for TensorFlow Serving
run: docker build -t bert-election2020-serving -f Dockerfile-tf-serving .

- name: Log in to Google Cloud
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GOOGLE_CLOUD_CREDENTIALS }}

- name: Configure Google Cloud
run: |
gcloud config set project ${{ secrets.GCP_PROJECT_ID }}
gcloud auth configure-docker
- name: Push Docker images to Google Container Registry
run: |
docker tag fastapi-bert-predictor gcr.io/${{ secrets.GCP_PROJECT_ID }}/fastapi-bert-predictor:latest
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/fastapi-bert-predictor:latest
docker tag bert-election2020-serving gcr.io/${{ secrets.GCP_PROJECT_ID }}/bert-election2020-serving:latest
docker push gcr.io/${{ secrets.GCP_PROJECT_ID }}/bert-election2020-serving:latest
- name: Deploy to Google Kubernetes Engine
run: |
gcloud container clusters get-credentials ${{ secrets.GKE_CLUSTER_NAME }} --zone ${{ secrets.GKE_ZONE }}
kubectl apply -f k8s/deployment.yml
kubectl apply -f k8s/service.yml

0 comments on commit 3dd9bff

Please sign in to comment.