-
-
Notifications
You must be signed in to change notification settings - Fork 6
196 lines (162 loc) · 5.49 KB
/
tests.yml
File metadata and controls
196 lines (162 loc) · 5.49 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
name: Tests
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
workflow_dispatch:
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Run tests with coverage
run: |
pytest --cov=src/empathy_os --cov-report=xml --cov-report=term-missing --cov-fail-under=53 -m "not network"
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
- name: Run new Phase 1 tests
run: |
pytest tests/unit/memory/test_long_term_security.py \
tests/unit/cli/test_cli_commands.py \
tests/unit/scanner/test_file_traversal.py \
tests/unit/cache/test_eviction_policies.py \
tests/integration/test_api_endpoints.py \
tests/unit/workflows/test_workflow_execution.py \
-v --tb=short
- name: Track per-file test results
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
run: |
python scripts/track_file_tests.py --coverage coverage.xml --limit 50
continue-on-error: true
- name: Upload file test tracking data
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: file-test-tracking
path: .empathy/file_tests.jsonl
continue-on-error: true
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: false
verbose: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install black ruff bandit[toml] mypy
- name: Check formatting with Black
run: black --check .
- name: Lint with Ruff
run: ruff check .
- name: Type check with MyPy
run: |
mypy src/empathy_os empathy_llm_toolkit --ignore-missing-imports --no-error-summary || true
continue-on-error: true # Non-blocking for now
- name: Security scan with Bandit
run: bandit -c .bandit -r src/ empathy_llm_toolkit/ coach_wizards/ empathy_software_plugin/ --severity-level medium --confidence-level medium
platform-compat:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Check cross-platform compatibility
id: compat
run: |
python scripts/check_platform_compat.py src/ --json > compat-report.json
python scripts/check_platform_compat.py src/ --fix
- name: Upload compatibility report
uses: actions/upload-artifact@v4
with:
name: platform-compat-report
path: compat-report.json
- name: Fail on errors (non-blocking for now)
run: |
ERRORS=$(python -c "import json; r=json.load(open('compat-report.json')); print(r['summary']['errors'])")
if [ "$ERRORS" -gt 0 ]; then
echo "::warning::Found $ERRORS cross-platform compatibility errors"
fi
continue-on-error: true
code-quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[software]
- name: Count tech debt markers
id: debt
run: |
# Count TODO, FIXME, HACK, XXX markers
DEBT_COUNT=$(grep -rE "(TODO|FIXME|HACK|XXX):" --include="*.py" src/ empathy_llm_toolkit/ empathy_software_plugin/ empathy_os/ 2>/dev/null | wc -l || echo 0)
echo "debt_count=$DEBT_COUNT" >> $GITHUB_OUTPUT
echo "Found $DEBT_COUNT tech debt markers"
# Warn if above threshold (configurable)
THRESHOLD=400
if [ "$DEBT_COUNT" -gt "$THRESHOLD" ]; then
echo "::warning::Tech debt count ($DEBT_COUNT) exceeds threshold ($THRESHOLD)"
fi
- name: Upload debt report
uses: actions/upload-artifact@v4
with:
name: tech-debt-report
path: |
patterns/tech_debt/
build:
runs-on: ubuntu-latest
needs: [test, lint]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-packages
path: dist/