|
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 |
0 commit comments