Fixing Stage 1 issues
Browse files- .github/workflows/pipeline.yml +19 -28
.github/workflows/pipeline.yml
CHANGED
|
@@ -7,14 +7,14 @@ on:
|
|
| 7 |
branches: [ main ]
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
-
# STAGE 0: Quality Gate
|
| 11 |
code-quality:
|
| 12 |
name: Lint & Code Quality
|
| 13 |
runs-on: ubuntu-latest
|
| 14 |
steps:
|
| 15 |
-
- uses: actions/checkout@
|
| 16 |
- name: Set up Python
|
| 17 |
-
uses: actions/setup-python@
|
| 18 |
with:
|
| 19 |
python-version: '3.9'
|
| 20 |
- name: Check code formatting
|
|
@@ -22,18 +22,16 @@ jobs:
|
|
| 22 |
pip install flake8
|
| 23 |
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
|
| 24 |
|
| 25 |
-
# STAGE 1: Data Ingestion & Registration
|
| 26 |
data-ingestion:
|
| 27 |
name: Data Ingestion & Registration
|
| 28 |
needs: code-quality
|
| 29 |
runs-on: ubuntu-latest
|
| 30 |
-
|
| 31 |
-
run:
|
| 32 |
-
working-directory: ./Predictive_Maintenance
|
| 33 |
steps:
|
| 34 |
-
- uses: actions/checkout@
|
| 35 |
- name: Set up Python
|
| 36 |
-
uses: actions/setup-python@
|
| 37 |
with:
|
| 38 |
python-version: '3.9'
|
| 39 |
cache: 'pip'
|
|
@@ -44,18 +42,16 @@ jobs:
|
|
| 44 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 45 |
run: python src/data_ingestion.py
|
| 46 |
|
| 47 |
-
# STAGE 2: Data Preparation
|
| 48 |
data-prep:
|
| 49 |
name: Data Preparation
|
| 50 |
needs: data-ingestion
|
| 51 |
runs-on: ubuntu-latest
|
| 52 |
-
|
| 53 |
-
run:
|
| 54 |
-
working-directory: ./Predictive_Maintenance
|
| 55 |
steps:
|
| 56 |
-
- uses: actions/checkout@
|
| 57 |
- name: Set up Python
|
| 58 |
-
uses: actions/setup-python@
|
| 59 |
with:
|
| 60 |
python-version: '3.9'
|
| 61 |
cache: 'pip'
|
|
@@ -66,18 +62,16 @@ jobs:
|
|
| 66 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 67 |
run: python src/preprocessing.py
|
| 68 |
|
| 69 |
-
# STAGE 3: Model Training & Registration
|
| 70 |
model-training:
|
| 71 |
name: Model Training & Registration
|
| 72 |
needs: data-prep
|
| 73 |
runs-on: ubuntu-latest
|
| 74 |
-
|
| 75 |
-
run:
|
| 76 |
-
working-directory: ./Predictive_Maintenance
|
| 77 |
steps:
|
| 78 |
-
- uses: actions/checkout@
|
| 79 |
- name: Set up Python
|
| 80 |
-
uses: actions/setup-python@
|
| 81 |
with:
|
| 82 |
python-version: '3.9'
|
| 83 |
cache: 'pip'
|
|
@@ -92,23 +86,20 @@ jobs:
|
|
| 92 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 93 |
run: python src/register_model.py
|
| 94 |
|
| 95 |
-
# STAGE 4: Deployment
|
| 96 |
deploy-hosting:
|
| 97 |
name: Deploy to Streamlit / HF Spaces
|
| 98 |
needs: model-training
|
| 99 |
runs-on: ubuntu-latest
|
| 100 |
steps:
|
| 101 |
-
- uses: actions/checkout@
|
| 102 |
- name: Push to Hugging Face
|
| 103 |
env:
|
| 104 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 105 |
run: |
|
| 106 |
-
# Authenticating as your specific GitHub user
|
| 107 |
git config --global user.email "sriranjan.u@gmail.com"
|
| 108 |
git config --global user.name "sriranjan-u"
|
| 109 |
|
| 110 |
-
#
|
| 111 |
git remote add huggingface https://huggingface.co/spaces/Sriranjan/Car_Predictive_Maintenance
|
| 112 |
-
|
| 113 |
-
# Using subtree push so HF gets app.py at the root level, ignoring the parent folder
|
| 114 |
-
git subtree push --prefix Predictive_Maintenance huggingface main
|
|
|
|
| 7 |
branches: [ main ]
|
| 8 |
|
| 9 |
jobs:
|
| 10 |
+
# 🛡️ STAGE 0: Quality Gate
|
| 11 |
code-quality:
|
| 12 |
name: Lint & Code Quality
|
| 13 |
runs-on: ubuntu-latest
|
| 14 |
steps:
|
| 15 |
+
- uses: actions/checkout@v4
|
| 16 |
- name: Set up Python
|
| 17 |
+
uses: actions/setup-python@v5
|
| 18 |
with:
|
| 19 |
python-version: '3.9'
|
| 20 |
- name: Check code formatting
|
|
|
|
| 22 |
pip install flake8
|
| 23 |
flake8 src/ --count --select=E9,F63,F7,F82 --show-source --statistics
|
| 24 |
|
| 25 |
+
# 📦 STAGE 1: Data Ingestion & Registration
|
| 26 |
data-ingestion:
|
| 27 |
name: Data Ingestion & Registration
|
| 28 |
needs: code-quality
|
| 29 |
runs-on: ubuntu-latest
|
| 30 |
+
# Removed the working-directory block from here!
|
|
|
|
|
|
|
| 31 |
steps:
|
| 32 |
+
- uses: actions/checkout@v4
|
| 33 |
- name: Set up Python
|
| 34 |
+
uses: actions/setup-python@v5
|
| 35 |
with:
|
| 36 |
python-version: '3.9'
|
| 37 |
cache: 'pip'
|
|
|
|
| 42 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 43 |
run: python src/data_ingestion.py
|
| 44 |
|
| 45 |
+
# 🧹 STAGE 2: Data Preparation
|
| 46 |
data-prep:
|
| 47 |
name: Data Preparation
|
| 48 |
needs: data-ingestion
|
| 49 |
runs-on: ubuntu-latest
|
| 50 |
+
# Removed the working-directory block from here!
|
|
|
|
|
|
|
| 51 |
steps:
|
| 52 |
+
- uses: actions/checkout@v4
|
| 53 |
- name: Set up Python
|
| 54 |
+
uses: actions/setup-python@v5
|
| 55 |
with:
|
| 56 |
python-version: '3.9'
|
| 57 |
cache: 'pip'
|
|
|
|
| 62 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 63 |
run: python src/preprocessing.py
|
| 64 |
|
| 65 |
+
# 🧠 STAGE 3: Model Training & Registration
|
| 66 |
model-training:
|
| 67 |
name: Model Training & Registration
|
| 68 |
needs: data-prep
|
| 69 |
runs-on: ubuntu-latest
|
| 70 |
+
# Removed the working-directory block from here!
|
|
|
|
|
|
|
| 71 |
steps:
|
| 72 |
+
- uses: actions/checkout@v4
|
| 73 |
- name: Set up Python
|
| 74 |
+
uses: actions/setup-python@v5
|
| 75 |
with:
|
| 76 |
python-version: '3.9'
|
| 77 |
cache: 'pip'
|
|
|
|
| 86 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 87 |
run: python src/register_model.py
|
| 88 |
|
| 89 |
+
# 🚀 STAGE 4: Deployment
|
| 90 |
deploy-hosting:
|
| 91 |
name: Deploy to Streamlit / HF Spaces
|
| 92 |
needs: model-training
|
| 93 |
runs-on: ubuntu-latest
|
| 94 |
steps:
|
| 95 |
+
- uses: actions/checkout@v4
|
| 96 |
- name: Push to Hugging Face
|
| 97 |
env:
|
| 98 |
HF_TOKEN: ${{ secrets.HF_TOKEN }}
|
| 99 |
run: |
|
|
|
|
| 100 |
git config --global user.email "sriranjan.u@gmail.com"
|
| 101 |
git config --global user.name "sriranjan-u"
|
| 102 |
|
| 103 |
+
# Since the app.py is at the root, a standard force push is exactly what HF needs
|
| 104 |
git remote add huggingface https://huggingface.co/spaces/Sriranjan/Car_Predictive_Maintenance
|
| 105 |
+
git push --force https://Sriranjan:$HF_TOKEN@huggingface.co/spaces/Sriranjan/Car_Predictive_Maintenance main
|
|
|
|
|
|