Create .github/workflows/ci_cd_pipeline.yml
Browse files
.github/workflows/ci_cd_pipeline.yml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Wildfire MLOps CI & CD Pipeline
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
push:
|
| 5 |
+
branches: [ "master", "main" ]
|
| 6 |
+
pull_request:
|
| 7 |
+
branches: [ "master", "main" ]
|
| 8 |
+
|
| 9 |
+
jobs:
|
| 10 |
+
build-and-test:
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
|
| 13 |
+
steps:
|
| 14 |
+
# 1. Checkout Code
|
| 15 |
+
- uses: actions/checkout@v3
|
| 16 |
+
|
| 17 |
+
# 2. Set up Python
|
| 18 |
+
- name: Set up Python 3.9
|
| 19 |
+
uses: actions/setup-python@v4
|
| 20 |
+
with:
|
| 21 |
+
python-version: "3.9"
|
| 22 |
+
|
| 23 |
+
# 3. Install Dependencies
|
| 24 |
+
- name: Install Dependencies
|
| 25 |
+
run: |
|
| 26 |
+
python -m pip install --upgrade pip
|
| 27 |
+
pip install -r requirements.txt
|
| 28 |
+
|
| 29 |
+
# 4. Run Data Validation
|
| 30 |
+
- name: Run DeepChecks Drift Detection
|
| 31 |
+
run: python tests/test_model.py
|
| 32 |
+
|
| 33 |
+
# 5. Run API Unit Tests
|
| 34 |
+
- name: Run API Unit Tests
|
| 35 |
+
run: python tests/test_api.py
|
| 36 |
+
|
| 37 |
+
# 6. Build Docker Image (INTEGRATED STEP)
|
| 38 |
+
# Using your specific path: docker/Dockerfile
|
| 39 |
+
- name: Build Docker Image
|
| 40 |
+
run: docker build -f docker/Dockerfile -t wildfire_api:latest .
|
| 41 |
+
|
| 42 |
+
# 7. DISCORD NOTIF - SUCCESS
|
| 43 |
+
# Only runs if Tests passed AND Docker built successfully
|
| 44 |
+
- name: Discord Notification - Success
|
| 45 |
+
if: success()
|
| 46 |
+
uses: Ilshidur/action-discord@master
|
| 47 |
+
env:
|
| 48 |
+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
| 49 |
+
with:
|
| 50 |
+
args: '✅ BOOM! Tests Passed & Docker Image Built! System is Certified! 🚀🔥'
|
| 51 |
+
|
| 52 |
+
# 8. DISCORD NOTIF - FAILURE
|
| 53 |
+
- name: Discord Notification - Failure
|
| 54 |
+
if: failure()
|
| 55 |
+
uses: Ilshidur/action-discord@master
|
| 56 |
+
env:
|
| 57 |
+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
| 58 |
+
with:
|
| 59 |
+
args: '❌ ERROR! Build or Tests Failed! Check the logs! 💀⚠️'
|