emilbm commited on
Commit
cc6e2d2
·
1 Parent(s): 5a5e912

Add GitHub Actions workflow for testing and deploying to Hugging Face Space

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy.yml +51 -0
.github/workflows/deploy.yml ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: test-and-deploy
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build-and-test:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout repository
15
+ uses: actions/checkout@v5
16
+
17
+ - name: Install uv
18
+ uses: astral-sh/setup-uv@v6
19
+ with:
20
+ version: "0.9.2"
21
+
22
+ - name: Set up Python
23
+ run: uv python install
24
+
25
+ - name: Install dependencies
26
+ run: uv sync --locked --all-extras --dev
27
+
28
+ - name: Run linting
29
+ run: make lint
30
+
31
+ - name: Run tests
32
+ run: make test
33
+
34
+ deploy-to-hf:
35
+ needs: build-and-test
36
+ runs-on: ubuntu-latest
37
+
38
+ steps:
39
+ - name: Checkout repository
40
+ uses: actions/checkout@v5
41
+ with:
42
+ fetch-depth: 0
43
+ lfs: true
44
+
45
+ - name: Deploy to Hugging Face Space
46
+ env:
47
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
48
+ HF_USERNAME: ${{ secrets.HF_USERNAME }}
49
+ HF_SPACE: ${{ secrets.HF_SPACE }}
50
+ run: |
51
+ git push --force https://$HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/$HF_USERNAME/$HF_SPACE main