Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/pr-agent-context-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{ prompt_preamble }}

{{ opening_instructions }}

{{ copilot_comments_section }}

{{ review_comments_section }}

{{ failing_checks_section }}

{{ patch_coverage_section }}
76 changes: 74 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
matrix:
python-version: ["3.11", "3.12"]

env:
COVERAGE_FILE: .coverage.py${{ matrix.python-version }}

steps:
- uses: actions/checkout@v4

Expand All @@ -30,13 +33,22 @@ jobs:
uv pip install \
pydantic pyyaml jinja2 soundfile numpy scipy \
click rich jsonlines \
pytest pytest-asyncio
pytest pytest-asyncio pytest-cov

- name: Install package
run: uv pip install --no-deps -e .

- name: Run tests
run: .venv/bin/pytest tests/ -v --tb=short
run: .venv/bin/pytest tests/ -v --tb=short --cov avdp --cov-branch --cov-report=

- name: Upload raw coverage artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: pr-agent-context-coverage-py${{ matrix.python-version }}
path: .coverage*
include-hidden-files: true
if-no-files-found: ignore

lint:
name: "Lint & type-check"
Expand Down Expand Up @@ -66,3 +78,63 @@ jobs:

- name: mypy
run: .venv/bin/mypy avdp/ --ignore-missing-imports

coverage:
name: "Combine coverage & generate XML"
runs-on: ubuntu-latest
needs: [test]
if: always()

steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "latest"
enable-cache: true
python-version: "3.11"

- name: Install coverage
run: uv pip install coverage[toml]

- name: Download raw coverage artifacts
uses: actions/download-artifact@v4
with:
pattern: pr-agent-context-coverage-*
path: coverage-data
merge-multiple: true

- name: Combine coverage and generate XML
run: |
.venv/bin/coverage combine coverage-data/
.venv/bin/coverage report
.venv/bin/coverage xml

- name: Upload combined coverage XML
uses: actions/upload-artifact@v4
with:
name: coverage-xml
path: coverage.xml
if-no-files-found: warn

pr-agent-context:
name: "PR agent context"
if: ${{ always() && github.event_name == 'pull_request' }}
needs: [lint, test, coverage]
permissions:
contents: read
actions: read
pull-requests: write
uses: shaypal5/pr-agent-context/.github/workflows/pr-agent-context.yml@v4
Comment thread
shaypal5 marked this conversation as resolved.
with:
tool_ref: v4
target_patch_coverage: "100"
include_review_comments: true
include_failing_checks: true
include_patch_coverage: true
patch_coverage_source_mode: coverage_xml_artifact
coverage_report_artifact_name: coverage-xml
coverage_report_filename: coverage.xml
prompt_template_file: .github/pr-agent-context-template.md
debug_artifacts: true
55 changes: 55 additions & 0 deletions .github/workflows/pr-agent-context-refresh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: pr-agent-context-refresh

on:
pull_request_review:
types: [submitted, edited, dismissed]
pull_request_review_comment:
types: [created, edited, deleted]
check_run:
types: [completed]
status:

Comment thread
shaypal5 marked this conversation as resolved.
concurrency:
group: >-
${{ github.workflow }}-${{
github.event.pull_request.number ||
github.event.pull_request_review.pull_request.number ||
github.event.pull_request_review_comment.pull_request.number ||
github.event.check_run.head_sha ||
github.event.sha ||
github.sha
}}
cancel-in-progress: true

jobs:
pr-agent-context-refresh:
name: "PR agent context refresh"
if: >-
github.event_name == 'pull_request_review' ||
github.event_name == 'pull_request_review_comment' ||
(github.event_name == 'check_run' &&
github.event.action == 'completed' &&
toJson(github.event.check_run.pull_requests) != '[]') ||
(github.event_name == 'status' && github.event.state != 'pending')
Comment thread
shaypal5 marked this conversation as resolved.
permissions:
contents: read
actions: read
pull-requests: write
uses: shaypal5/pr-agent-context/.github/workflows/pr-agent-context.yml@v4
Comment thread
shaypal5 marked this conversation as resolved.
with:
tool_ref: v4
execution_mode: refresh
publish_mode: append
publish_all_clear_comments_in_refresh: false
wait_for_reviews_to_settle: true
target_patch_coverage: "100"
include_review_comments: true
include_failing_checks: true
include_patch_coverage: true
patch_coverage_source_mode: coverage_xml_artifact
coverage_report_artifact_name: coverage-xml
coverage_report_filename: coverage.xml
enable_cross_run_coverage_lookup: true
coverage_source_workflows: CI
prompt_template_file: .github/pr-agent-context-template.md
debug_artifacts: true
17 changes: 17 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,20 @@ ignore_missing_imports = true
[tool.pytest.ini_options]
testpaths = ["tests"]
asyncio_mode = "auto"

[tool.coverage.run]
source = ["avdp"]
branch = true
relative_files = true

[tool.coverage.paths]
source = [
"avdp",
"/home/runner/work/*/*/avdp",
]

[tool.coverage.report]
show_missing = true

[tool.coverage.xml]
output = "coverage.xml"
Loading