RamshaAnwar commited on
Commit
7161dc9
·
unverified ·
1 Parent(s): 85c3a7b

ci: add github actions for tests, coverage, and secret scanning (#15)

Browse files
Files changed (1) hide show
  1. .github/workflows/ci.yml +54 -0
.github/workflows/ci.yml ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: ci
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ runs-on: ubuntu-latest
8
+
9
+ services:
10
+ postgres:
11
+ image: pgvector/pgvector:pg16
12
+ env:
13
+ POSTGRES_USER: ci
14
+ POSTGRES_PASSWORD: ci
15
+ POSTGRES_DB: test
16
+ ports:
17
+ - 5432:5432
18
+ options: >-
19
+ --health-cmd "pg_isready -U ci"
20
+ --health-interval 5s
21
+ --health-timeout 5s
22
+ --health-retries 10
23
+
24
+ env:
25
+ TEST_DATABASE_URL: postgresql+psycopg://ci:ci@localhost:5432/test
26
+ JWT_SECRET_KEY: test-secret-test-secret-test-secret-123
27
+ GEMINI_API_KEY: test-key
28
+
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+
32
+ - name: Set up Python
33
+ uses: actions/setup-python@v5
34
+ with:
35
+ python-version: "3.11"
36
+ cache: "pip"
37
+
38
+ - name: Install dependencies
39
+ run: |
40
+ pip install -r requirements.txt
41
+ pip install -r requirements-dev.txt
42
+
43
+ - name: Run tests with coverage
44
+ run: pytest -q --cov=app --cov-fail-under=85
45
+
46
+ secrets:
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+ with:
51
+ fetch-depth: 0
52
+ - uses: gitleaks/gitleaks-action@v2
53
+ env:
54
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}