-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (79 loc) · 2.3 KB
/
Copy pathci-python.yml
File metadata and controls
93 lines (79 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Python CI
on:
push:
branches: [main, master, dev, 'feat/**', 'fix/**', 'chore/**', 'hotfix/**']
paths:
- 'app/**'
- 'tests/**'
- 'alembic/**'
- 'pyproject.toml'
- '.github/workflows/ci-python.yml'
pull_request:
branches: [main, master, dev]
paths:
- 'app/**'
- 'tests/**'
- 'alembic/**'
- 'pyproject.toml'
env:
PYTHON_VERSION: '3.11'
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dev dependencies
run: |
uv venv .venv --python ${{ env.PYTHON_VERSION }}
uv pip install --python .venv/bin/python -e ".[dev]"
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
- name: ruff check
run: ruff check .
test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: techwatch_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5432/techwatch_test
DATABASE_SYNC_URL: postgresql://postgres:postgres@localhost:5432/techwatch_test
ADMIN_API_TOKEN: ci-test-token
CONFIG_ENCRYPTION_KEY: ""
LLM_API_KEY: ci-test-key
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
uv venv .venv --python ${{ env.PYTHON_VERSION }}
uv pip install --python .venv/bin/python -e ".[dev]"
echo "$GITHUB_WORKSPACE/.venv/bin" >> $GITHUB_PATH
- name: Run migrations
run: alembic upgrade head
- name: Run tests
run: pytest tests/ -v --cov=app --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
fail_ci_if_error: false