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: 重构 Noneflow #231

Merged
merged 21 commits into from
Oct 22, 2024
Merged

feat: 重构 Noneflow #231

merged 21 commits into from
Oct 22, 2024

Conversation

BigOrangeQWQ
Copy link
Member

架构:

  • 重构项目,例如将 Git/GitHub 相关操作独立出来
  • 通过 Docker in Docker 测试插件

商店:

  • author 以 id 为准,并能够自动更新用户名

交互:

  • 支持修改商店内插件信息
  • 通过候选框重新运行插件验证

Copy link

codecov bot commented Oct 13, 2024

Codecov Report

Attention: Patch coverage is 89.34221% with 128 lines in your changes missing coverage. Please review.

Project coverage is 91.16%. Comparing base (bf6ad1a) to head (f0493e7).
Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/github/plugins/remove/utils.py 54.38% 26 Missing ⚠️
src/plugins/github/models/github.py 82.50% 14 Missing ⚠️
src/plugins/github/plugins/publish/validation.py 77.77% 14 Missing ⚠️
src/plugins/github/plugins/remove/__init__.py 83.56% 12 Missing ⚠️
src/providers/docker_test.py 45.00% 11 Missing ⚠️
src/providers/store_test/store.py 91.96% 9 Missing ⚠️
src/plugins/github/models/issue.py 84.78% 7 Missing ⚠️
src/providers/validation/models.py 88.46% 6 Missing ⚠️
src/plugins/github/plugins/publish/utils.py 97.31% 5 Missing ⚠️
src/plugins/github/utils.py 83.87% 5 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #231      +/-   ##
==========================================
- Coverage   98.13%   91.16%   -6.98%     
==========================================
  Files          17       34      +17     
  Lines         966     1494     +528     
==========================================
+ Hits          948     1362     +414     
- Misses         18      132     +114     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@he0119 he0119 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

暂时还没看测试(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

其实可以直接叫 plugin_test.py 吧。

.github/workflows/main.yml Show resolved Hide resolved
@@ -32,10 +32,10 @@ jobs:
with:
token: ${{ secrets.CODECOV_TOKEN }}

docker:
noneflow-docker:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的修改没有意义吧

uses: docker/build-push-action@v5
with:
file: ./docker/Dockerfile
context: .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里把 context 放到 ./docker 就可以了吧,file 参数可以直接删掉。


WORKDIR /tmp

COPY ./docker/docker_plugin_test.py /tmp/plugin_test.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
COPY ./docker/docker_plugin_test.py /tmp/plugin_test.py
COPY ./docker_plugin_test.py /tmp/plugin_test.py

else:
test_result = await DockerPluginTest(
DOCKER_IMAGES, project_link, module_name, config
).run("3.10")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里同理,不应该写死。

"load": plugin_test_output,
"metadata": metadata,
},
test_env={test_env: True},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的 test_env 字典是什么意思来着?

ISSUE_FIELD_TEMPLATE = "### {}"
ISSUE_FIELD_PATTERN = r"### {}\s+"

SKIP_COMMENT = "/skip"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

怎么有两个 skip comment(

@@ -0,0 +1,19 @@
NONEFLOW_MARKER = "<!-- NONEFLOW -->"

BOT_MARKER = "[bot]"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个用不上了。

)
from githubkit.typing import Missing

IssuesEvent: TypeAlias = (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pydantic 如果不支持 type 的话,可以临时禁用这个规则。


# 通过环境变量传递插件配置
config = os.environ.get("PLUGIN_CONFIG")
data = os.environ.get("PLUGIN_DATA")

asyncio.run(test.run(key, config, data))
if key and (config or data):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个只要提供了 key,应该就是要单次运行吧。

@he0119 he0119 merged commit 33a52da into nonebot:main Oct 22, 2024
5 of 7 checks passed
@he0119 he0119 mentioned this pull request Oct 22, 2024
8 tasks
@he0119 he0119 added major enhancement New feature or request labels Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request major
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants