-
Notifications
You must be signed in to change notification settings - Fork 0
test(coverage): ratchet autogen branch coverage gate #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| [run] | ||
| branch = true | ||
| source = | ||
| maf_starter | ||
| entities | ||
| main.py | ||
| omit = | ||
| autogen_dashboard/* | ||
| autogen_starter/* | ||
| */__pycache__/* | ||
| tests/* | ||
|
|
||
| [report] | ||
| exclude_lines = | ||
| pragma: no cover | ||
| if __name__ == .__main__.: | ||
| raise NotImplementedError | ||
| if TYPE_CHECKING: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,56 +1,87 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Python ${{ matrix.python-version }} / ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 20 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest] | ||
| python-version: ['3.12'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v7 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: pip | ||
|
|
||
| - name: Install dependencies | ||
| run: python -m pip install -r requirements.txt | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| test: | ||
| name: Python ${{ matrix.python-version }} / ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 20 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest] | ||
| python-version: ['3.12'] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v7 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| cache: pip | ||
|
|
||
| - name: Install dependencies | ||
| run: python -m pip install -r requirements.txt | ||
|
|
||
| - name: Verify dependency consistency | ||
| run: python -m pip check | ||
|
|
||
| - name: Contract compatibility (pinned cas-contracts v1.1) | ||
| # Consumer-side gate: fails red if autogen's pinned CAS contract version | ||
| # or the vendored v1.1 schema release drifts. See | ||
| # tests/test_contract_compatibility.py for the validated contract surface. | ||
| run: python -m pytest tests/test_contract_compatibility.py -q --tb=short | ||
|
|
||
| - name: Run full test suite | ||
| run: | | ||
| python -m pytest -q --tb=short --cov --cov-branch --cov-report=xml --cov-fail-under=73 | ||
|
|
||
| - name: Verify dependency consistency | ||
| run: python -m pip check | ||
| - name: Emit branch coverage telemetry | ||
| if: always() | ||
| run: | | ||
| python - <<'PY' | ||
| import json | ||
| import sys | ||
| import xml.etree.ElementTree as ET | ||
| from pathlib import Path | ||
|
|
||
| - name: Contract compatibility (pinned cas-contracts v1.1) | ||
| # Consumer-side gate: fails red if autogen's pinned CAS contract version | ||
| # or the vendored v1.1 schema release drifts. See | ||
| # tests/test_contract_compatibility.py for the validated contract surface. | ||
| run: python -m pytest tests/test_contract_compatibility.py -q --tb=short | ||
| required = 54.6 | ||
| coverage_file = Path("coverage.xml") | ||
| if not coverage_file.exists(): | ||
| print(json.dumps({ | ||
| "event": "ci_failure", | ||
| "metric": "branch-rate", | ||
| "coverage_percent": None, | ||
| "required": required, | ||
| "reason": "coverage.xml missing", | ||
| })) | ||
| sys.exit(1) | ||
|
|
||
| - name: Run full test suite | ||
| run: | | ||
| python -m pip install pytest-cov | ||
| python -m pytest -q --tb=short --cov=. --cov-report=xml | ||
| branch_rate = float(ET.parse(coverage_file).getroot().attrib["branch-rate"]) * 100.0 | ||
| passed = branch_rate >= required | ||
| print(json.dumps({ | ||
| "event": "ci_pass" if passed else "ci_failure", | ||
| "metric": "branch-rate", | ||
| "coverage_percent": round(branch_rate, 2), | ||
| "required": required, | ||
| })) | ||
| sys.exit(0 if passed else 1) | ||
| PY | ||
|
|
||
| - name: Compile Python sources | ||
| run: python -m compileall autogen_starter autogen_dashboard maf_starter main.py -q | ||
|
|
||
| - name: Validate dashboard JavaScript | ||
| run: node --check autogen_dashboard/static/app.js | ||
| - name: Validate dashboard JavaScript | ||
| run: node --check autogen_dashboard/static/app.js | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,3 +10,6 @@ state/ | |
| .tmp-tests/ | ||
| *.out.log | ||
| *.err.log | ||
| .coverage | ||
| coverage.xml | ||
| htmlcov/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,14 @@ | ||
| agent-framework==1.10.0 | ||
| agent-framework-devui==1.0.0b260630 | ||
| agent-framework-orchestrations==1.0.0 | ||
| autogen-agentchat>=0.7.5,<0.8.0 | ||
| autogen-core>=0.7.5,<0.8.0 | ||
| autogen-ext[anthropic,ollama,openai]>=0.7.5,<0.8.0 | ||
| fastapi>=0.139.0,<1.0 | ||
| jsonschema>=4.26.0,<5.0 | ||
| openapi-spec-validator>=0.9.0,<1.0 | ||
| pydantic>=2.13.4,<3.0 | ||
| pytest>=9.1.1,<10.0 | ||
| python-dotenv>=1.2.2,<2.0 | ||
| uvicorn>=0.49.0,<1.0 | ||
| agent-framework==1.0.0rc5 | ||
| agent-framework-devui==1.0.0b260319 | ||
| agent-framework-orchestrations==1.0.0b260319 | ||
| autogen-agentchat>=0.7.5,<0.8.0 | ||
| autogen-core>=0.7.5,<0.8.0 | ||
| autogen-ext[anthropic,ollama,openai]>=0.7.5,<0.8.0 | ||
| fastapi>=0.133.0,<0.138.1 | ||
| jsonschema>=4.26.0,<5.0 | ||
| openapi-spec-validator>=0.9.0,<1.0 | ||
| pydantic>=2.13.4,<3.0 | ||
| pytest>=9.1.1,<10.0 | ||
| pytest-cov>=5.0,<8.0 | ||
| python-dotenv>=1.2.2,<2.0 | ||
| uvicorn>=0.41.0,<0.42.0 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This job still runs on
windows-latest, and this step does not override the default shell; GitHub's workflow syntax docs state that an unspecified Windowsrunstep usespwsh, while thispython - <<'PY'heredoc is Bash syntax, so the Windows matrix leg will fail parsing the telemetry step even when tests pass. Setshell: bashfor this step or useshell: python/a script file instead. See GitHub docs: https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshellUseful? React with 👍 / 👎.