File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 }}
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
Original file line number Diff line number Diff line change @@ -7,8 +7,9 @@ First: This project expects the working root to be github repo `lgc-NB2Dev/works
77NOTE: 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
Original file line number Diff line number Diff line change @@ -44,3 +44,13 @@ build-backend = "hatchling.build"
4444
4545[tool .hatch .version ]
4646path = " 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"
You can’t perform that action at this time.
0 commit comments