abdullah090809 commited on
Commit
821a97d
·
1 Parent(s): b4f32e7

add CI/CD pipeline

Browse files
Files changed (1) hide show
  1. .github/workflows/ci-cd.yml +70 -0
.github/workflows/ci-cd.yml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: CI/CD Pipeline
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ test:
10
+ runs-on: ubuntu-latest
11
+
12
+ services:
13
+ postgres:
14
+ image: postgres:15
15
+ env:
16
+ POSTGRES_USER: postgres
17
+ POSTGRES_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
18
+ POSTGRES_DB: job_tracker_test
19
+ ports:
20
+ - 5432:5432
21
+ options: >-
22
+ --health-cmd pg_isready
23
+ --health-interval 10s
24
+ --health-timeout 5s
25
+ --health-retries 5
26
+
27
+ env:
28
+ DATABASE_HOSTNAME: localhost
29
+ DATABASE_PORT: 5432
30
+ DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
31
+ DATABASE_NAME: job_tracker_test
32
+ DATABASE_USERNAME: postgres
33
+ SECRET_KEY: ${{ secrets.SECRET_KEY }}
34
+ ALGORITHM: HS256
35
+ ACCESS_TOKEN_EXPIRE_MINUTES: 30
36
+ GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
37
+
38
+ steps:
39
+ - name: Checkout code
40
+ uses: actions/checkout@v3
41
+
42
+ - name: Set up Python
43
+ uses: actions/setup-python@v4
44
+ with:
45
+ python-version: "3.11"
46
+
47
+ - name: Install dependencies
48
+ run: pip install -r requirements.txt
49
+
50
+ - name: Run tests
51
+ run: pytest --disable-warnings -v
52
+
53
+ deploy:
54
+ runs-on: ubuntu-latest
55
+ needs: test
56
+
57
+ steps:
58
+ - name: Checkout code
59
+ uses: actions/checkout@v3
60
+ with:
61
+ fetch-depth: 0
62
+ lfs: true
63
+
64
+ - name: Push to Hugging Face
65
+ env:
66
+ HF_TOKEN: ${{ secrets.HF_TOKEN }}
67
+ run: |
68
+ git config --global user.email "ci@github.com"
69
+ git config --global user.name "GitHub Actions"
70
+ git push https://abdullah090809:$HF_TOKEN@huggingface.co/spaces/abdullah090809/Job_Tracker_API master:main --force