rriviere commited on
Commit
4fc7c95
·
1 Parent(s): dfe2f13

ci: add GitHub Actions workflow for CI/CD pipeline

Browse files

Adds a CI/CD workflow triggered on push to main:
- test job: installs dependencies and runs pytest
- deploy job: pushes to Hugging Face Spaces after tests pass

Files changed (1) hide show
  1. .github/workflows/ci_cd.yml +40 -0
.github/workflows/ci_cd.yml ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: CI/CD
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - name: Checkout du code
13
+ uses: actions/checkout@v4
14
+
15
+ - name: Configuration Python 3.12
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.12"
19
+
20
+ - name: Installation des dépendances
21
+ run: pip install -r requirements.txt
22
+
23
+ - name: Exécution des tests
24
+ run: pytest tests/ -v
25
+
26
+ deploy:
27
+ needs: test
28
+ runs-on: ubuntu-latest
29
+ steps:
30
+ - name: Checkout du code
31
+ uses: actions/checkout@v4
32
+
33
+ - name: Déploiement sur Hugging Face
34
+ env:
35
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
36
+ run: |
37
+ git config user.email "action@github.com"
38
+ git config user.name "GitHub Actions"
39
+ git remote add hf https://rriviere:$HF_TOKEN@huggingface.co/spaces/rriviere/attrition-api
40
+ git push hf main --force