Skip to content

Commit 1b7023c

Browse files
committed
agents & ci
1 parent f7a9ef6 commit 1b7023c

3 files changed

Lines changed: 33 additions & 4 deletions

File tree

.github/workflows/test.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
runs-on: ${{ matrix.os }}
2424
permissions:
2525
contents: read
26+
code-quality: write
2627
env:
2728
OS: ${{ matrix.os }}
2829
PYTHON_VERSION: ${{ matrix.python-version }}
@@ -38,5 +39,22 @@ jobs:
3839
shell: bash
3940
run: uv add "pydantic$PYDANTIC_VERSION"
4041

41-
- name: Run Pytest
42-
run: uv run pytest
42+
- name: Run pytest with coverage
43+
working-directory: plugins/${{ github.event.repository.name }}
44+
shell: bash
45+
env:
46+
PLUGIN_MODULE: ${{ github.event.repository.name }}
47+
run: >-
48+
uv run pytest
49+
--cov="${PLUGIN_MODULE//-/_}"
50+
--cov-branch
51+
--cov-report=xml:coverage.xml
52+
--cov-report=markdown-append:"$GITHUB_STEP_SUMMARY"
53+
54+
- name: Upload coverage report
55+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
56+
uses: actions/upload-code-coverage@v1
57+
with:
58+
file: plugins/${{ github.event.repository.name }}/coverage.xml
59+
language: Python
60+
label: code-coverage/pytest

AGENTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ First: This project expects the working root to be github repo `lgc-NB2Dev/works
77
NOTE: The following command are expected to be run under the plugin repo root rather than the workspace root.
88

99
```bash
10-
uv run scripts/gen_defs.py
11-
uv run pytest
10+
poe gen-defs # uv run scripts/gen_defs.py
11+
poe test [...] # pytest
12+
poe coverage [...] # pytest --cov=nonebot_plugin_picmenu_next --cov-report=term-missing
1213
```
1314

1415
## Structure

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,13 @@ build-backend = "hatchling.build"
4444

4545
[tool.hatch.version]
4646
path = "nonebot_plugin_picmenu_next/__init__.py"
47+
48+
[tool.poe.tasks]
49+
gen-defs.cmd = "uv run scripts/gen_defs.py"
50+
test.cmd = "pytest"
51+
coverage.cmd = "pytest --cov=nonebot_plugin_picmenu_next --cov-report=term-missing"
52+
53+
[tool.pytest.ini_options]
54+
asyncio_mode = "auto"
55+
asyncio_default_fixture_loop_scope = "session"
56+
asyncio_default_test_loop_scope = "session"

0 commit comments

Comments
 (0)