Skip to content

Commit 91d12d3

Browse files
OgeonX-AirootAitomates
authored
test(coverage): ratchet autogen branch coverage gate (#11)
* test(coverage): ratchet autogen branch coverage gate * test(ci): fix autogen coverage gate follow-up Use a cross-platform Python shell for coverage telemetry and align maf setup tests with the current tool surface and fallback helper access. * test(ci): align autogen coverage checks with clean branch --------- Co-authored-by: root <root@Kimi.localdomain> Co-authored-by: Kim Harjamäki <kim.harjamaki@prosimo.fi>
1 parent e52e6aa commit 91d12d3

6 files changed

Lines changed: 963 additions & 628 deletions

File tree

.coveragerc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[run]
2+
branch = true
3+
source =
4+
maf_starter
5+
entities
6+
main.py
7+
omit =
8+
autogen_dashboard/*
9+
autogen_starter/*
10+
*/__pycache__/*
11+
tests/*
12+
13+
[report]
14+
exclude_lines =
15+
pragma: no cover
16+
if __name__ == .__main__.:
17+
raise NotImplementedError
18+
if TYPE_CHECKING:

.github/workflows/ci.yml

Lines changed: 86 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,86 @@
1-
name: CI
2-
3-
on:
4-
push:
5-
branches: [ main ]
6-
pull_request:
7-
8-
permissions:
9-
contents: read
10-
11-
concurrency:
12-
group: ci-${{ github.workflow }}-${{ github.ref }}
13-
cancel-in-progress: true
14-
15-
jobs:
16-
test:
17-
name: Python ${{ matrix.python-version }} / ${{ matrix.os }}
18-
runs-on: ${{ matrix.os }}
19-
timeout-minutes: 20
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
os: [ubuntu-latest, windows-latest]
24-
python-version: ['3.12']
25-
26-
steps:
27-
- uses: actions/checkout@v7
28-
29-
- name: Set up Python
30-
uses: actions/setup-python@v6
31-
with:
32-
python-version: ${{ matrix.python-version }}
33-
cache: pip
34-
35-
- name: Install dependencies
36-
run: python -m pip install -r requirements.txt
37-
38-
- name: Verify dependency consistency
39-
run: python -m pip check
40-
41-
- name: Contract compatibility (pinned cas-contracts v1.1)
42-
# Consumer-side gate: fails red if autogen's pinned CAS contract version
43-
# or the vendored v1.1 schema release drifts. See
44-
# tests/test_contract_compatibility.py for the validated contract surface.
45-
run: python -m pytest tests/test_contract_compatibility.py -q --tb=short
46-
47-
- name: Run full test suite
48-
run: |
49-
python -m pip install pytest-cov
50-
python -m pytest -q --tb=short --cov=. --cov-report=xml
51-
52-
- name: Compile Python sources
53-
run: python -m compileall autogen_starter autogen_dashboard maf_starter main.py -q
54-
55-
- name: Validate dashboard JavaScript
56-
run: node --check autogen_dashboard/static/app.js
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: ci-${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
test:
17+
name: Python ${{ matrix.python-version }} / ${{ matrix.os }}
18+
runs-on: ${{ matrix.os }}
19+
timeout-minutes: 20
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest, windows-latest]
24+
python-version: ['3.12']
25+
26+
steps:
27+
- uses: actions/checkout@v7
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v6
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
cache: pip
34+
35+
- name: Install dependencies
36+
run: python -m pip install -r requirements.txt
37+
38+
- name: Verify dependency consistency
39+
run: python -m pip check
40+
41+
- name: Contract compatibility (pinned cas-contracts v1.1)
42+
# Consumer-side gate: fails red if autogen's pinned CAS contract version
43+
# or the vendored v1.1 schema release drifts. See
44+
# tests/test_contract_compatibility.py for the validated contract surface.
45+
run: python -m pytest tests/test_contract_compatibility.py -q --tb=short
46+
47+
- name: Run full test suite
48+
run: |
49+
python -m pytest -q --tb=short --cov --cov-branch --cov-report=xml --cov-fail-under=73
50+
51+
- name: Emit branch coverage telemetry
52+
if: always()
53+
shell: python
54+
run: |
55+
import json
56+
import sys
57+
import xml.etree.ElementTree as ET
58+
from pathlib import Path
59+
60+
required = 53.5
61+
coverage_file = Path("coverage.xml")
62+
if not coverage_file.exists():
63+
print(json.dumps({
64+
"event": "ci_failure",
65+
"metric": "branch-rate",
66+
"coverage_percent": None,
67+
"required": required,
68+
"reason": "coverage.xml missing",
69+
}))
70+
sys.exit(1)
71+
72+
branch_rate = float(ET.parse(coverage_file).getroot().attrib["branch-rate"]) * 100.0
73+
passed = branch_rate >= required
74+
print(json.dumps({
75+
"event": "ci_pass" if passed else "ci_failure",
76+
"metric": "branch-rate",
77+
"coverage_percent": round(branch_rate, 2),
78+
"required": required,
79+
}))
80+
sys.exit(0 if passed else 1)
81+
82+
- name: Compile Python sources
83+
run: python -m compileall autogen_starter autogen_dashboard maf_starter main.py -q
84+
85+
- name: Validate dashboard JavaScript
86+
run: node --check autogen_dashboard/static/app.js

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ state/
1010
.tmp-tests/
1111
*.out.log
1212
*.err.log
13+
.coverage
14+
coverage.xml
15+
htmlcov/

requirements.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
agent-framework==1.10.0
2-
agent-framework-devui==1.0.0b260630
3-
agent-framework-orchestrations==1.0.0
4-
autogen-agentchat>=0.7.5,<0.8.0
5-
autogen-core>=0.7.5,<0.8.0
6-
autogen-ext[anthropic,ollama,openai]>=0.7.5,<0.8.0
7-
fastapi>=0.139.0,<1.0
8-
jsonschema>=4.26.0,<5.0
9-
openapi-spec-validator>=0.9.0,<1.0
10-
pydantic>=2.13.4,<3.0
11-
pytest>=9.1.1,<10.0
12-
python-dotenv>=1.2.2,<2.0
13-
uvicorn>=0.49.0,<1.0
1+
agent-framework==1.0.0rc5
2+
agent-framework-devui==1.0.0b260319
3+
agent-framework-orchestrations==1.0.0b260319
4+
autogen-agentchat>=0.7.5,<0.8.0
5+
autogen-core>=0.7.5,<0.8.0
6+
autogen-ext[anthropic,ollama,openai]>=0.7.5,<0.8.0
7+
fastapi>=0.133.0,<0.138.1
8+
jsonschema>=4.26.0,<5.0
9+
openapi-spec-validator>=0.9.0,<1.0
10+
pydantic>=2.13.4,<3.0
11+
pytest>=9.1.1,<10.0
12+
pytest-cov>=5.0,<8.0
13+
python-dotenv>=1.2.2,<2.0
14+
uvicorn>=0.41.0,<0.42.0

0 commit comments

Comments
 (0)