-
Notifications
You must be signed in to change notification settings - Fork 1
189 lines (154 loc) · 4.74 KB
/
Copy pathci.yml
File metadata and controls
189 lines (154 loc) · 4.74 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
lint-and-format:
name: Code Quality (Ruff)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync
- name: Run Ruff linting
run: uv run ruff check src/ tests/ --output-format=github
- name: Run Ruff formatting check
run: uv run ruff format src/ tests/ --check
test:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.13']
os: [ubuntu-latest]
fail-fast: false
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: test_dev_password
POSTGRES_USER: test_dev_user
POSTGRES_DB: test_dev_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5435:5432
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync
- name: Run tests with parallel execution
run: uv run pytest tests/ -v --tb=short -n auto --dist worksteal
env:
# Test database configuration
TEST_DATABASE_URL: postgresql+asyncpg://test_user:test_password@localhost:5432/test_db
- name: Run tests with coverage
run: uv run pytest tests/ --cov=src --cov-report=xml --cov-report=term-missing -n auto --dist worksteal
env:
TEST_DATABASE_URL: postgresql+asyncpg://test_user:test_password@localhost:5432/test_db
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
security:
name: Security Scan (Bandit)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync
- name: Run security scan with Bandit via Ruff
run: uv run ruff check src/ --select=S --output-format=github
type-check:
name: Type Checking (MyPy)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Install dependencies with dev extras
run: uv sync --extra dev
- name: Run MyPy type checking
run: uv run mypy src/ --ignore-missing-imports --no-strict-optional
continue-on-error: true # Allow type checking to be informational for now
build:
name: Build Check
runs-on: ubuntu-latest
needs: [lint-and-format, test, security]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Install dependencies
run: uv sync
- name: Verify application can start
run: |
# Basic import test to ensure no syntax errors
uv run python -c "
try:
from src.presentation.api.app import create_app
print('✅ Application imports successfully')
except ImportError as e:
print(f'❌ Import error: {e}')
exit(1)
except Exception as e:
print(f'⚠️ Import warning: {e}')
print('✅ Basic syntax check passed')
"