Update CI/CD: Improve linter robustness and HF sync config
Browse files
.github/workflows/main.yaml
CHANGED
|
@@ -11,6 +11,7 @@ env:
|
|
| 11 |
IMAGE_NAME: ${{ github.repository }}
|
| 12 |
|
| 13 |
jobs:
|
|
|
|
| 14 |
build-and-push-image:
|
| 15 |
runs-on: ubuntu-latest
|
| 16 |
permissions:
|
|
@@ -30,7 +31,6 @@ jobs:
|
|
| 30 |
run: install.packages("lintr")
|
| 31 |
shell: Rscript {0}
|
| 32 |
|
| 33 |
-
# Check if file exists before linting to avoid errors
|
| 34 |
- name: Lint Plumber API
|
| 35 |
run: |
|
| 36 |
if (file.exists("src/plumber.R")) {
|
|
@@ -66,14 +66,15 @@ jobs:
|
|
| 66 |
cache-from: type=gha
|
| 67 |
cache-to: type=gha,mode=max
|
| 68 |
|
| 69 |
-
|
|
|
|
| 70 |
runs-on: ubuntu-latest
|
| 71 |
needs: build-and-push-image
|
| 72 |
steps:
|
| 73 |
- uses: actions/checkout@v3
|
| 74 |
with:
|
| 75 |
fetch-depth: 0
|
| 76 |
-
lfs: true
|
| 77 |
|
| 78 |
- name: Push to Hub
|
| 79 |
env:
|
|
@@ -83,7 +84,7 @@ sync-to-hub:
|
|
| 83 |
git config --global user.email "kirtan@example.com"
|
| 84 |
git config --global user.name "Kirtan001"
|
| 85 |
|
| 86 |
-
# 2. Force download of LFS files (
|
| 87 |
# We explicitly fetch and pull to ensure the runner has the binary data
|
| 88 |
git lfs install
|
| 89 |
git lfs fetch --all
|
|
@@ -93,5 +94,4 @@ sync-to-hub:
|
|
| 93 |
git remote add space https://Kirtan001:$HF_TOKEN@huggingface.co/spaces/Kirtan001/R_Bank_Marketing_UCI_Classification
|
| 94 |
|
| 95 |
# 4. Force push to Hugging Face
|
| 96 |
-
# We use -u to set upstream and force push
|
| 97 |
git push --force space HEAD:main
|
|
|
|
| 11 |
IMAGE_NAME: ${{ github.repository }}
|
| 12 |
|
| 13 |
jobs:
|
| 14 |
+
# JOB 1: Build and Push to GitHub Container Registry
|
| 15 |
build-and-push-image:
|
| 16 |
runs-on: ubuntu-latest
|
| 17 |
permissions:
|
|
|
|
| 31 |
run: install.packages("lintr")
|
| 32 |
shell: Rscript {0}
|
| 33 |
|
|
|
|
| 34 |
- name: Lint Plumber API
|
| 35 |
run: |
|
| 36 |
if (file.exists("src/plumber.R")) {
|
|
|
|
| 66 |
cache-from: type=gha
|
| 67 |
cache-to: type=gha,mode=max
|
| 68 |
|
| 69 |
+
# JOB 2: Sync to Hugging Face (Correctly indented as a separate job)
|
| 70 |
+
sync-to-hub:
|
| 71 |
runs-on: ubuntu-latest
|
| 72 |
needs: build-and-push-image
|
| 73 |
steps:
|
| 74 |
- uses: actions/checkout@v3
|
| 75 |
with:
|
| 76 |
fetch-depth: 0
|
| 77 |
+
lfs: true # Enable LFS support in checkout
|
| 78 |
|
| 79 |
- name: Push to Hub
|
| 80 |
env:
|
|
|
|
| 84 |
git config --global user.email "kirtan@example.com"
|
| 85 |
git config --global user.name "Kirtan001"
|
| 86 |
|
| 87 |
+
# 2. Force download of LFS files (Crucial Fix)
|
| 88 |
# We explicitly fetch and pull to ensure the runner has the binary data
|
| 89 |
git lfs install
|
| 90 |
git lfs fetch --all
|
|
|
|
| 94 |
git remote add space https://Kirtan001:$HF_TOKEN@huggingface.co/spaces/Kirtan001/R_Bank_Marketing_UCI_Classification
|
| 95 |
|
| 96 |
# 4. Force push to Hugging Face
|
|
|
|
| 97 |
git push --force space HEAD:main
|