-
Notifications
You must be signed in to change notification settings - Fork 0
307 lines (289 loc) · 9.56 KB
/
Copy pathci.yaml
File metadata and controls
307 lines (289 loc) · 9.56 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
name: CI
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
version-consistency:
name: Version consistency
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Verify package/changelog version consistency
run: python scripts/verify_version_consistency.py --check-unreleased-link
readiness-checklist:
name: Production checklist (validate)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install checker dependency
run: pip install pyyaml
- name: Validate production readiness checklist shape
run: python scripts/production_readiness_gate.py --mode validate
openapi-compat:
name: API compatibility (OpenAPI)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Check OpenAPI compatibility
run: python scripts/check_openapi_compat.py --baseline schemas/openapi_baseline.json
- name: Verify generated API reference is up to date
run: python scripts/generate_api_reference.py --check
security-dependency-audit:
name: Security dependency audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Install pip-audit
run: pip install pip-audit
- name: Run dependency audit
run: pip-audit
security-secret-scan:
name: Security secret scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
security-sast:
name: Security SAST (bandit)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install bandit
run: pip install bandit
- name: Run bandit
run: bandit -r python/hpcopt/ -ll -ii
lint:
name: Lint (ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install ruff
run: pip install ruff
- name: Run ruff check
run: ruff check python/
typecheck:
name: Type-check (mypy)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run mypy
run: mypy python/hpcopt/
typecheck-critical:
name: Type-check critical packages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run mypy on critical paths
run: mypy python/hpcopt/api python/hpcopt/models python/hpcopt/simulate
test:
name: Tests (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
# gymnasium (small, pure-Python) lets the RL env tests run without
# pulling the full [rl] extra (torch/sb3 are ~2.5 GB and GPU-oriented).
run: pip install -e ".[dev]" "gymnasium>=0.29.0,<2.0"
- name: Run tests with coverage
run: pytest tests/ -v --cov=hpcopt --cov-report=term-missing --cov-report=xml:coverage.xml --cov-fail-under=86
- name: Build quality evidence bundle
if: matrix.python-version == '3.12'
run: |
mkdir -p outputs/quality-evidence
python scripts/check_coverage_thresholds.py \
--coverage-xml coverage.xml \
--global-fail-under 86 \
--package-threshold api=88 \
--package-threshold models=89 \
--package-threshold simulate=86 \
| tee outputs/quality-evidence/coverage-gates.txt
python scripts/check_docs_consistency.py | tee outputs/quality-evidence/docs-consistency.txt
python scripts/check_openapi_compat.py --baseline schemas/openapi_baseline.json | tee outputs/quality-evidence/openapi-compat.txt
python scripts/production_readiness_gate.py --mode validate | tee outputs/quality-evidence/readiness-validate.txt
- name: Upload coverage artifact
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.xml
- name: Upload quality evidence artifact
if: matrix.python-version == '3.12'
uses: actions/upload-artifact@v4
with:
name: quality-evidence
path: outputs/quality-evidence/
- name: Upload coverage to Codecov
if: matrix.python-version == '3.12'
uses: codecov/codecov-action@v4
with:
files: coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
rust-check:
name: Rust check + clippy + test + build
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cargo check
run: cargo check --workspace
- name: Clippy (deny warnings)
run: cargo clippy --workspace -- -D warnings
- name: Run tests
run: cargo test --workspace
- name: Build release
run: cargo build --release
cross-language-test:
name: Cross-language adapter parity
runs-on: ubuntu-latest
needs: [rust-check, test]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Python dependencies
run: pip install -e ".[dev]"
- name: Build Rust binaries
run: cargo build --release
working-directory: rust
- name: Run cross-language parity test
run: pytest tests/unit/test_cross_language_adapter_parity.py -v
load-test:
name: Load tests (main only)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run load tests
run: pytest tests/load/ -v -m load
e2e-smoke:
name: E2E smoke test
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -e ".[dev]"
- name: Run E2E pipeline smoke test
run: pytest tests/integration/test_e2e_pipeline.py -v -m integration
docker-build:
name: Docker build (no push)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: hpc-workload-optimizer:ci-${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
docker-smoke:
name: Docker container smoke test
runs-on: ubuntu-latest
needs: [docker-build]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false
load: true
tags: hpc-workload-optimizer:smoke
- name: Run container
run: |
docker run -d --name hpcopt-smoke -p 8080:8080 hpc-workload-optimizer:smoke
sleep 10
- name: Verify /health
run: curl --fail --retry 5 --retry-delay 2 http://localhost:8080/health
- name: Verify /ready
run: curl --fail http://localhost:8080/ready
- name: Verify prediction endpoint
run: |
curl --fail -X POST http://localhost:8080/v1/runtime/predict \
-H 'Content-Type: application/json' \
-d '{"requested_cpus": 8, "requested_runtime_sec": 1200}'
- name: Cleanup
if: always()
run: docker rm -f hpcopt-smoke || true
validate-dashboards:
name: Validate Grafana dashboards
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Validate dashboard JSON files
run: |
for f in configs/monitoring/dashboards/*.json; do
if [ -f "$f" ]; then
python -m json.tool "$f" > /dev/null || { echo "Invalid JSON: $f"; exit 1; }
echo "✓ $f"
fi
done
echo "Dashboard validation complete."