Skip to content
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

feat: 插件测试结果显示版本号和发布时间 #303

Merged
merged 2 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/lang/zh-CN/

## [Unreleased]

### Added

- 插件插件测试结果显示版本号和发布时间

### Fixed

- 修复 Docker Test 报错后仍无法运行的问题
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/github/plugins/publish/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@
"supported_adapters": "插件支持的适配器",
"metadata": "插件测试元数据",
"load": "插件是否成功加载",
"version": "插件版本号",
"time": "插件发布时间",
}
7 changes: 7 additions & 0 deletions src/plugins/github/plugins/publish/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def loc_to_name(loc: list[str | int]) -> str:
return " > ".join([_loc_to_name(str(item)) for item in loc])


def key_to_name(key: str) -> str:
return _loc_to_name(key)


env = jinja2.Environment(
loader=jinja2.FileSystemLoader(Path(__file__).parent / "templates"),
enable_async=True,
Expand All @@ -48,6 +52,7 @@ def loc_to_name(loc: list[str | int]) -> str:
env.filters["tags_to_str"] = tags_to_str
env.filters["supported_adapters_to_str"] = supported_adapters_to_str
env.filters["loc_to_name"] = loc_to_name
env.filters["key_to_name"] = key_to_name


async def render_comment(result: ValidationDict, reuse: bool = False) -> str:
Expand All @@ -64,6 +69,8 @@ async def render_comment(result: ValidationDict, reuse: bool = False) -> str:
"project_link",
"type",
"supported_adapters",
"time",
"version",
]

for key in data.copy():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
插件 <a href="{{ value }}">加载测试</a> 通过。
{%- endif %}
{% else %}
{{ key }}: {{ value }}。
{{ key|key_to_name }}: {{ value }}。
{%- endif %}
{% endmacro %}
5 changes: 1 addition & 4 deletions src/providers/validation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,7 @@ class PluginPublishInfo(PublishInfo, PyPIMixin):
skip_test: bool
"""是否跳过插件测试"""
version: str
"""插件版本号

从 PyPI 获取或者测试中获取
"""
"""插件版本号"""
test_config: str = ""
"""插件测试配置"""
test_output: str = ""
Expand Down
2 changes: 1 addition & 1 deletion tests/github/config/process/test_config_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async def test_process_config_check(

<details>
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://pypi.org/project/nonebot-plugin-treehelp/">nonebot-plugin-treehelp</a> 已发布至 PyPI。</li><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li><li>✅ 插件类型: application。</li><li>✅ 插件支持的适配器: nonebot.adapters.onebot.v11。</li><li>✅ 插件 <a href="https://github.com/owner/repo/actions/runs/123456">加载测试</a> 通过。</li></code></pre>
<pre><code><li>✅ 项目 <a href="https://pypi.org/project/nonebot-plugin-treehelp/">nonebot-plugin-treehelp</a> 已发布至 PyPI。</li><li>✅ 插件发布时间: 2021-08-01T00:00:00+00:00。</li><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li><li>✅ 插件类型: application。</li><li>✅ 插件支持的适配器: nonebot.adapters.onebot.v11。</li><li>✅ 插件版本号: 1.0.0。</li><li>✅ 插件 <a href="https://github.com/owner/repo/actions/runs/123456">加载测试</a> 通过。</li></code></pre>
</details>

---
Expand Down
4 changes: 2 additions & 2 deletions tests/github/publish/process/test_publish_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ async def test_adapter_process_publish_check(

<details>
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI。</li><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li></code></pre>
<pre><code><li>✅ 项目 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI。</li><li>✅ 插件发布时间: 2023-09-01T00:00:00+00:00Z。</li><li>✅ 项目 <a href="https://nonebot.dev">主页</a> 返回状态码 200。</li><li>✅ 标签: test-#ffffff。</li></code></pre>
</details>

---
Expand Down Expand Up @@ -1228,7 +1228,7 @@ async def test_skip_plugin_check(

<details>
<summary>详情</summary>
<pre><code><li>✅ 项目 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI。</li><li>✅ 标签: test-#ffffff。</li><li>✅ 插件 <a href="https://github.com/owner/repo/actions/runs/123456">加载测试</a> 已跳过。</li></code></pre>
<pre><code><li>✅ 项目 <a href="https://pypi.org/project/project_link/">project_link</a> 已发布至 PyPI。</li><li>✅ 插件发布时间: 2023-09-01T00:00:00+00:00Z。</li><li>✅ 标签: test-#ffffff。</li><li>✅ 插件版本号: 0.0.1。</li><li>✅ 插件 <a href="https://github.com/owner/repo/actions/runs/123456">加载测试</a> 已跳过。</li></code></pre>
</details>

---
Expand Down
Loading