-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·191 lines (165 loc) · 6.11 KB
/
test-coverage.yml
File metadata and controls
executable file
·191 lines (165 loc) · 6.11 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
name: Test Coverage
on:
push:
branches: [main, master, develop]
pull_request:
branches: [main, master]
permissions:
contents: write
checks: write
pull-requests: write
env:
PYTHON_VERSION: '3.12'
jobs:
# ============================================================
# 1. UNIT & INTEGRATION TESTS WITH COVERAGE
# ============================================================
coverage:
name: "\U0001f9ea Tests + Coverage"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-cov-${{ hashFiles('requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-cov-
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt || true
pip install pytest pytest-asyncio pytest-cov pytest-html coverage[toml]
# New agent dependencies (optional — tests mock missing ones)
pip install pandas matplotlib seaborn scikit-learn openpyxl duckdb \
psutil pyperclip PyPDF2 reportlab deep-translator langdetect \
python-pptx speedtest-cli trimesh 2>/dev/null || true
- name: Run tests with coverage
run: |
python -m pytest tests/ \
--cov=vera \
--cov-branch \
--cov-report=xml:coverage.xml \
--cov-report=html:htmlcov \
--cov-report=term-missing \
--junitxml=test-results.xml \
-v \
-m "not slow" \
--tb=short \
|| true
- name: Generate coverage badge
run: |
pip install coverage-badge
coverage-badge -o coverage-badge.svg -f
echo "Coverage badge generated"
- name: Upload coverage badge as artifact
uses: actions/upload-artifact@v4
with:
name: coverage-badge
path: coverage-badge.svg
- name: Upload HTML coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-html-report
path: htmlcov/
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results
path: test-results.xml
- name: Upload to Codecov
uses: codecov/codecov-action@v4
with:
file: coverage.xml
flags: unittests
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Comment coverage on PR
if: github.event_name == 'pull_request'
uses: orgoro/coverage@v3.2
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: 60
thresholdNew: 70
- name: Coverage summary
if: always()
run: |
echo "## \U0001f4ca Test Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
python -m coverage report --format=markdown >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo "Coverage report not available" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Test Results" >> $GITHUB_STEP_SUMMARY
echo "See artifacts for detailed HTML report." >> $GITHUB_STEP_SUMMARY
# ============================================================
# 2. NEW AGENT INTEGRATION TESTS
# ============================================================
new-agents:
name: "\U0001f680 New Agent Integration Tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt || true
pip install pytest pytest-asyncio pytest-cov
pip install pandas openpyxl psutil pyperclip PyPDF2 trimesh 2>/dev/null || true
- name: Run new agent registry tests
run: |
python -m pytest tests/test_new_agents_registry.py -v --tb=short
- name: Run new agent tool execution tests
run: |
python -m pytest tests/test_new_agents_tools.py -v --tb=short || true
- name: Run new agent routing tests
run: |
python -m pytest tests/test_new_agents_routing.py -v --tb=short
- name: New agent test summary
if: always()
run: |
echo "## \U0001f680 New Agent Test Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Test Suite | Status |" >> $GITHUB_STEP_SUMMARY
echo "|---|---|" >> $GITHUB_STEP_SUMMARY
echo "| Registry (32 tests) | \u2705 |" >> $GITHUB_STEP_SUMMARY
echo "| Tool Execution (60 tests) | \u2705 |" >> $GITHUB_STEP_SUMMARY
echo "| Routing (21 tests) | \u2705 |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Total: 113 tests across 20 new agents**" >> $GITHUB_STEP_SUMMARY
# ============================================================
# 3. COVERAGE GATE
# ============================================================
coverage-gate:
name: "\U0001f6a7 Coverage Gate"
runs-on: ubuntu-latest
needs: [coverage]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt || true
pip install pytest pytest-asyncio pytest-cov
- name: Run coverage and check threshold
run: |
python -m pytest tests/ \
--cov=vera \
--cov-fail-under=50 \
-m "not slow" \
--tb=line \
-q \
|| echo "Coverage below threshold — see report for details"