Skip to content

Commit

Permalink
Update ci-cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
canstralian authored Feb 2, 2025
1 parent 390c802 commit c08c427
Showing 1 changed file with 34 additions and 42 deletions.
76 changes: 34 additions & 42 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI/CD Pipeline
name: CI/CD Pipeline for Streamlit and Hugging Face

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

jobs:
build-and-test:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, 3.10]

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8' # Specify your Python version here

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
pytest
- name: Run tests
run: |
pytest # Make sure you have pytest in your requirements.txt
deploy:
runs-on: ubuntu-latest
needs: build-and-test
if: github.ref == 'refs/heads/main'
needs: build

steps:
- name: Checkout code
uses: actions/checkout@v2

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

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Deploy to Hugging Face Spaces
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
run: |
git lfs install
git lfs pull
huggingface-cli login --token $HF_TOKEN
huggingface-cli repo create Canstralian/Transformers-Fine-Tuner --type=space --organization Canstralian --private
huggingface-cli repo upload Canstralian/Transformers-Fine-Tuner
- name: Checkout code
uses: actions/checkout@v2

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

- name: Install Streamlit
run: |
pip install streamlit
- name: Deploy to Hugging Face
env:
HUGGINGFACE_TOKEN: ${{ secrets.HF_TOKEN }} # Use the correct secret name
run: |
# Assuming you have a deployment script to deploy your app
streamlit run your_app.py --server.port 8501 --server.address 0.0.0.0

0 comments on commit c08c427

Please sign in to comment.