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
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ffc1584
feat: 支持 Docker 测试容器构建
BigOrangeQWQ Sep 24, 2024
9d51994
feat: 升级到 Python 3.12
BigOrangeQWQ Sep 24, 2024
a8fd262
refactor: 重构 publish 插件
BigOrangeQWQ Sep 24, 2024
ea0854f
refactor: 新增 remove 插件
BigOrangeQWQ Sep 24, 2024
8de9239
refactor: 重构定时测试与验证相关功能
BigOrangeQWQ Sep 24, 2024
6132e66
test: 更新部分测试
BigOrangeQWQ Sep 24, 2024
e31d286
fix: 修复 import 的路径问题,将常量模块独立成文件
BigOrangeQWQ Sep 24, 2024
4d4ff69
fix: 修复一些问题
BigOrangeQWQ Sep 24, 2024
ff6b97c
chore: 将构建仓库指向 nonebot
BigOrangeQWQ Sep 24, 2024
4afeea7
test: 更新了 publish 相关的测试
BigOrangeQWQ Sep 26, 2024
36caf2e
fix: 修复了一系列问题,彻底支持了 author_id
BigOrangeQWQ Oct 12, 2024
ac1550a
test: 修改测试,使得代码可以通过
BigOrangeQWQ Oct 12, 2024
15e6e53
fix: 修复了跳过测试的插件名字无法被正确识别的问题
BigOrangeQWQ Oct 13, 2024
28f2c3b
fix: 修复了一系列问题
BigOrangeQWQ Oct 21, 2024
7951f9c
style: auto fix by pre-commit hooks
pre-commit-ci[bot] Oct 21, 2024
36f6c88
fix: 修改 Bot 的判定方式
BigOrangeQWQ Oct 21, 2024
bac9e04
refactor: 拆分 merge_data 函数
BigOrangeQWQ Oct 21, 2024
41c3d02
fix: 修复插件测试合并数据的问题
BigOrangeQWQ Oct 21, 2024
2c0befa
fix: 修复了一些问题
BigOrangeQWQ Oct 21, 2024
0e855e7
fix: 修复了一些问题
BigOrangeQWQ Oct 22, 2024
f0493e7
fix: 当 key 非空时运行单个插件测试
BigOrangeQWQ Oct 22, 2024
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
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ GITHUB_APPS
INPUT_CONFIG

# 插件测试结果
PLUGIN_TEST_RESULT
PLUGIN_TEST_OUTPUT
PLUGIN_TEST_METADATA
# PLUGIN_TEST_RESULT
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_OUTPUT
# PLUGIN_TEST_METADATA
48 changes: 48 additions & 0 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Plugin Test Container Builder

on:
push:
paths:
- 'docker/**'
workflow_dispatch:

jobs:
build:
name: Docker
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Docker
uses: docker/setup-buildx-action@v3

- name: Login to Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate Tags
uses: docker/metadata-action@v5
id: metadata
with:
images: ghcr.io/noneflow/nonetest
tags: |
type=semver,pattern={{version}}
type=raw,value=${{ matrix.python-version }}-{{branch}}

- name: Build and Publish
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 参数可以直接删掉。

push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
build-args: PYTHON_VERSION=${{ matrix.python-version }}
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Set up Python
uses: he0119/setup-python@main
with:
python-version: "3.11"
python-version: "3.12"

- name: Install prerequisites
run: poetry install
Expand All @@ -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.

这里的修改没有意义吧

name: Docker
runs-on: ubuntu-latest
needs: test
# needs: test
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout
Expand Down Expand Up @@ -64,6 +64,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
he0119 marked this conversation as resolved.
Show resolved Hide resolved
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11 as requirements-stage
FROM python:3.12 as requirements-stage

WORKDIR /tmp

Expand All @@ -12,7 +12,7 @@ ENV PATH="${PATH}:/root/.local/bin"

RUN poetry export -f requirements.txt --output requirements.txt --without-hashes

FROM python:3.11-slim-bullseye
FROM python:3.12-slim-bullseye

# 设置时区
ENV TZ=Asia/Shanghai
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ _✨ NoneBot 工作流管理机器人 ✨_

## 测试

在 [action-test](https://github.com/he0119/action-test) 仓库中测试。
在 [action-test](https://github.com/BigOrangeQWQ/action-test) 仓库中测试。
Copy link
Member

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.

23 changes: 23 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
ARG PYTHON_VERSION=3.10

FROM python:${PYTHON_VERSION} AS builder

RUN apt-get update -y \
&& apt-get install -y curl \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://install.python-poetry.org -o install-poetry.py

FROM python:${PYTHON_VERSION}-slim

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


COPY --from=builder install-poetry.py /tmp/install-poetry.py

RUN python install-poetry.py --yes

ENV PATH="${PATH}:/root/.local/bin"

CMD ["python", "plugin_test.py"]
Loading
Loading