Files
huggingface--peft/.github/workflows/deploy_peft_shop_app.yml
T
wehub-resource-sync caf324b09d
tests / check_code_quality (push) Waiting to run
tests / tests (ubuntu-latest, 3.10) (push) Blocked by required conditions
tests / tests (ubuntu-latest, 3.11) (push) Blocked by required conditions
Deploy "method_comparison" Gradio to Spaces / deploy (push) Waiting to run
Deploy "PEFT shop" Gradio app to Spaces / deploy (push) Waiting to run
tests on transformers main / tests (push) Waiting to run
tests / tests (ubuntu-latest, 3.12) (push) Blocked by required conditions
tests / tests (ubuntu-latest, 3.13) (push) Blocked by required conditions
tests / tests (windows-latest, 3.10) (push) Blocked by required conditions
tests / tests (windows-latest, 3.11) (push) Blocked by required conditions
tests / tests (windows-latest, 3.12) (push) Blocked by required conditions
tests / tests (windows-latest, 3.13) (push) Blocked by required conditions
Secret Leaks / trufflehog (push) Waiting to run
CI security linting / zizmor latest via Cargo (push) Waiting to run
Build documentation / build (push) Failing after 0s
chore: import upstream snapshot with attribution
2026-07-13 13:24:42 +08:00

79 lines
3.2 KiB
YAML

name: Deploy "PEFT shop" Gradio app to Spaces
on:
push:
branches: [ main ]
paths:
# the app itself, and the data sources baked into its data.json: benchmark results and the capability script
- "method_comparison/peft-shop/**"
- "method_comparison/*/results/**"
- "scripts/generate_method_capabilities.py"
schedule:
# monthly refresh so that newly added PEFT methods reach the Space without a manual dispatch
- cron: "0 3 1 * *"
workflow_dispatch:
permissions: {}
jobs:
deploy:
# GH Environment for extra protection: https://github.com/huggingface/peft/settings/environments
environment: branch-protection-main
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
with:
python-version: "3.12"
- name: Install PEFT and app dependencies
run: |
# CPU-only torch keeps the install small and fast; the capability probes run on CPU anyway
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -e . gradio tqdm
- name: Build the app data
run: |
# data.json is generated at deploy time so that it always matches the deployed PEFT commit (see
# method_comparison/peft-shop/README.md); the app reads method_capabilities.json from the CWD and
# writes data.json into its own directory, where the deploy step below picks it up
python scripts/generate_method_capabilities.py --output method_capabilities.json
python method_comparison/peft-shop/app.py --rebuild --build-only
- name: Ensure Space exists
env:
HF_TOKEN: ${{ secrets.PEFT_INTERNAL_REPO_READ_WRITE }}
run: |
# pushing to a non-existent Space would fail, the Hub does not create repositories on git push
python -c "
from huggingface_hub import create_repo
create_repo('peft-internal-testing/PEFT-shop', repo_type='space', space_sdk='gradio', exist_ok=True)
"
- name: Authenticate via ~/.netrc
env:
HF_TOKEN: ${{ secrets.PEFT_INTERNAL_REPO_READ_WRITE }}
run: |
# netrc needs BOTH login and password entries
printf "machine huggingface.co\nlogin hf\npassword ${HF_TOKEN}\n" >> ~/.netrc
chmod 600 ~/.netrc
- name: Deploy PEFT shop app to HF Spaces
run: |
cd method_comparison/peft-shop
git init
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git remote add gradio-app https://huggingface.co/spaces/peft-internal-testing/PEFT-shop
git add .
# data.json is gitignored (see .gitignore) so it doesn't get committed into the PEFT repo during local
# dev; force-add it here so the self-contained data file actually ships with the Space
git add -f data.json
git commit -m "🚀 Deploy PEFT shop app from GH action"
git push -f gradio-app HEAD:main