Repository navigation
79 lines (69 loc) · 2.52 KB
/
Copy pathci.yml
File metadata and controls
79 lines (69 loc) · 2.52 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
name: ci
on:
push:
branches: [main, master]
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python-version }}
- name: Install the locked environment
run: |
python -m pip install --no-deps -r requirements.lock
python -m pip check
python -m pip install -e . --no-deps --no-build-isolation
python -m pip check
- name: Ruff check
run: ruff check src tests
- name: Ruff format
run: ruff format --check src tests
- name: Full test suite with branch coverage
run: |
python -m coverage erase
python -m coverage run --branch --source=quant_agent -m pytest -q
python -m coverage report --show-missing --fail-under=80
python -m coverage json -o coverage-full.json
- name: Artifact-consumption pure branch gate
run: |
python - <<'PY'
import json
from pathlib import Path
report = json.loads(Path("coverage-full.json").read_text(encoding="utf-8"))
expected = "src/quant_agent/adapters/standard.py"
entry = next(
(
value
for key, value in report["files"].items()
if key.replace("\\", "/") == expected
),
None,
)
if entry is None:
raise SystemExit("artifact-consumption core is missing from coverage JSON")
summary = entry["summary"]
covered = summary["covered_branches"]
total = summary["num_branches"]
if total == 0:
raise SystemExit("artifact-consumption core has no measured branches")
ratio = covered / total
print(f"artifact-consumption pure branches: {covered}/{total}={ratio:.2%}")
if ratio < 0.90:
raise SystemExit("artifact-consumption pure branch coverage is below 90%")
PY
- name: Upload coverage evidence
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: coverage-python-${{ matrix.python-version }}
path: coverage-*.json