-
-
Notifications
You must be signed in to change notification settings - Fork 0
289 lines (237 loc) · 7.7 KB
/
Copy pathci.yml
File metadata and controls
289 lines (237 loc) · 7.7 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
name: CI - Semantic Foragecast Engine
on:
push:
branches: [ main, develop, claude/* ]
pull_request:
branches: [ main, develop ]
workflow_dispatch: # Allow manual triggering
jobs:
# Phase 1: Unit Tests
unit-tests:
name: Unit Tests - Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
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 }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov pytest-xdist
- name: Run Phase 1 unit tests
run: |
pytest tests/test_prep_audio.py -v --cov=prep_audio --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
# Phase 2: E2E Tests
e2e-tests:
name: E2E Tests - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
needs: unit-tests
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11']
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 }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Run E2E test suite
run: |
python tests/test_e2e_pipeline.py
- name: Upload E2E test results
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-test-results-py${{ matrix.python-version }}
path: |
tests/
!tests/__pycache__/
# Phase 3: Blender Integration Smoke Tests
blender-smoke-tests:
name: Blender Smoke Tests
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install Blender
run: |
sudo apt-get update
sudo apt-get install -y wget xz-utils
# Download Blender 4.0 LTS
BLENDER_VERSION="4.0.2"
BLENDER_URL="https://download.blender.org/release/Blender4.0/blender-${BLENDER_VERSION}-linux-x64.tar.xz"
wget -q $BLENDER_URL -O blender.tar.xz
tar -xf blender.tar.xz
# Add to PATH
echo "$(pwd)/blender-${BLENDER_VERSION}-linux-x64" >> $GITHUB_PATH
- name: Verify Blender installation
run: |
blender-4.0.2-linux-x64/blender --version
- name: Test Blender script syntax
run: |
# Just check if the script can be parsed by Blender
blender-4.0.2-linux-x64/blender --background --python-expr "import bpy; print('Blender Python OK')"
- name: Validate Blender scripts
run: |
# Check if scripts are valid Python
python -m py_compile blender_script.py
python -m py_compile grease_pencil.py
echo "✓ Blender scripts validated"
# Phase 4: Video Export Tests
video-export-tests:
name: Video Export Tests
runs-on: ubuntu-latest
needs: unit-tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Install FFmpeg
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
ffmpeg -version
- name: Run video export tests
run: |
pytest tests/test_export_video.py -v
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: video-export-artifacts
path: outputs/
# Phase 5: Linting and Code Quality
code-quality:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install linting tools
run: |
python -m pip install --upgrade pip
pip install flake8 pylint black isort mypy
- name: Run flake8
continue-on-error: true
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=15 --max-line-length=120 --statistics
- name: Check code formatting with black
continue-on-error: true
run: |
black --check --line-length=100 *.py
- name: Check import sorting with isort
continue-on-error: true
run: |
isort --check-only --profile=black *.py
# Phase 6: Security Scanning
security-scan:
name: Security Vulnerability Scan
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run safety check
continue-on-error: true
run: |
pip install safety
safety check --json || true
- name: Run bandit security scan
continue-on-error: true
run: |
pip install bandit
bandit -r . -f json -o bandit-report.json || true
- name: Upload security reports
if: always()
uses: actions/upload-artifact@v4
with:
name: security-reports
path: |
bandit-report.json
# Summary job
ci-summary:
name: CI Summary
runs-on: ubuntu-latest
needs: [unit-tests, e2e-tests, blender-smoke-tests, video-export-tests, code-quality, security-scan]
if: always()
steps:
- name: Check job statuses
run: |
echo "==================================================="
echo "CI Pipeline Summary - Semantic Foragecast Engine"
echo "==================================================="
echo ""
echo "Unit Tests: ${{ needs.unit-tests.result }}"
echo "E2E Tests: ${{ needs.e2e-tests.result }}"
echo "Blender Smoke Tests: ${{ needs.blender-smoke-tests.result }}"
echo "Video Export Tests: ${{ needs.video-export-tests.result }}"
echo "Code Quality: ${{ needs.code-quality.result }}"
echo "Security Scan: ${{ needs.security-scan.result }}"
echo ""
echo "==================================================="
# Fail if critical jobs failed
if [ "${{ needs.unit-tests.result }}" != "success" ]; then
echo "❌ Unit tests failed"
exit 1
fi
if [ "${{ needs.e2e-tests.result }}" != "success" ]; then
echo "❌ E2E tests failed"
exit 1
fi
echo "✅ All critical tests passed!"