-
Notifications
You must be signed in to change notification settings - Fork 1
335 lines (280 loc) · 8.69 KB
/
test.yml
File metadata and controls
335 lines (280 loc) · 8.69 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
name: DeepStack Test Suite
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
schedule:
# Run nightly tests at 2 AM UTC
- cron: '0 2 * * *'
# Permissions needed for test result publishing and PR comments
permissions:
contents: read
checks: write
pull-requests: write
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-asyncio pytest-xdist
- name: Run unit tests
run: |
pytest tests/unit/ -v -n auto \
--cov=core \
--cov-report=xml \
--cov-report=term-missing \
--junit-xml=test-results/unit-tests.xml
- name: Upload unit test results
uses: actions/upload-artifact@v4
if: always()
with:
name: unit-test-results
path: test-results/unit-tests.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unit
name: unit-tests
integration-tests:
name: Integration Tests
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-asyncio
- name: Run integration tests
run: |
pytest tests/integration/ -v \
--cov=core \
--cov-report=xml \
--cov-report=term-missing \
--cov-fail-under=0 \
--junit-xml=test-results/integration-tests.xml
- name: Upload integration test results
uses: actions/upload-artifact@v4
if: always()
with:
name: integration-test-results
path: test-results/integration-tests.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: integration
name: integration-tests
e2e-tests:
name: E2E Tests
runs-on: ubuntu-latest
needs: integration-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-asyncio pytest-bdd
- name: Run E2E tests
run: |
pytest tests/e2e/ -v \
--cov=core \
--cov-report=xml \
--cov-report=term-missing \
--cov-fail-under=0 \
--junit-xml=test-results/e2e-tests.xml
- name: Upload E2E test results
uses: actions/upload-artifact@v4
if: always()
with:
name: e2e-test-results
path: test-results/e2e-tests.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: e2e
name: e2e-tests
coverage-report:
name: Combined Coverage Report
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, e2e-tests]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-asyncio pytest-bdd pytest-xdist
- name: Run all tests with coverage
run: |
pytest tests/ -v \
--cov=core \
--cov-report=html \
--cov-report=xml \
--cov-report=term-missing \
--cov-fail-under=0 \
--junit-xml=test-results/all-tests.xml
- name: Upload HTML coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-html-report
path: htmlcov/
- name: Upload combined test results
uses: actions/upload-artifact@v4
if: always()
with:
name: all-test-results
path: test-results/all-tests.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: combined
name: combined-coverage
fail_ci_if_error: false # Don't fail on Codecov rate limits or network issues
- name: Comment coverage on PR
if: github.event_name == 'pull_request'
uses: py-cov-action/python-coverage-comment-action@v3
continue-on-error: true # Don't fail if coverage comment fails
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test-summary:
name: Test Summary
runs-on: ubuntu-latest
needs: [unit-tests, integration-tests, e2e-tests]
if: always()
steps:
- name: Download all test results
uses: actions/download-artifact@v4
with:
path: test-results
- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: 'test-results/**/*.xml'
check_name: 'Test Results'
comment_title: 'Test Summary'
- name: Test Summary Report
run: |
echo "## Test Execution Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Results by Category" >> $GITHUB_STEP_SUMMARY
echo "- Unit Tests: ${{ needs.unit-tests.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Integration Tests: ${{ needs.integration-tests.result }}" >> $GITHUB_STEP_SUMMARY
echo "- E2E Tests: ${{ needs.e2e-tests.result }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Coverage" >> $GITHUB_STEP_SUMMARY
echo "Combined coverage report available in artifacts" >> $GITHUB_STEP_SUMMARY
quality-gates:
name: Quality Gates
runs-on: ubuntu-latest
needs: coverage-report
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov coverage
- name: Check coverage threshold
run: |
pytest tests/ --cov=core --cov-fail-under=20
echo "Coverage meets minimum threshold"
- name: Check critical module coverage
run: |
pytest tests/unit/test_orchestrator.py tests/integration/test_orchestrator_integration.py \
--cov=core.orchestrator \
--cov-fail-under=70 || echo "Warning: Orchestrator coverage below target"
performance-tests:
name: Performance Tests
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-benchmark
- name: Run performance benchmarks
run: |
pytest tests/ -m benchmark --benchmark-only || echo "No benchmark tests found"
- name: Upload benchmark results
uses: actions/upload-artifact@v4
if: always()
with:
name: benchmark-results
path: .benchmarks/
security-scan:
name: Security Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install safety bandit
- name: Run safety check
run: |
safety check --json || echo "Security vulnerabilities found"
- name: Run bandit security scan
run: |
bandit -r core/ -f json -o bandit-report.json || echo "Security issues found"
- name: Upload security reports
uses: actions/upload-artifact@v4
if: always()
with:
name: security-reports
path: |
bandit-report.json