zhenxun_bot/.github/workflows/bot_check.yml
molanp a15303a891
重构插件商店更新逻辑&彻底修复工作流 (#1782)
* 修复bot-check工作流

* Update bot_check.yml

* 修复依赖问题

* 修复戳一戳自检鉴权

* 🚨 auto fix by pre-commit hooks

* 优化工作流执行顺序

* 更新插件测试

* 更新插件商店

* 🚨 auto fix by pre-commit hooks

* Update bot_check.yml

* Update bot_check.yml

* Update bot_check.yml

* 请求 @ThelevenFD 修复测试

* 🚨 auto fix by pre-commit hooks

* Update zhenxun/builtin_plugins/plugin_store/data_source.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

* 修复代码过长的问题

* 🚨 auto fix by pre-commit hooks

* 同步check.py

* Update test_check.py

* 🚨 auto fix by pre-commit hooks

---------

Co-authored-by: ThelevenFD <104363913+ThelevenFD@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
2024-12-19 09:15:39 +08:00

85 lines
2.5 KiB
YAML

name: 检查bot是否运行正常
on:
push:
branches: ["main"]
paths:
- zhenxun/**
- tests/**
- .github/workflows/bot_check.yml
- bot.py
pull_request:
branches: ["main"]
paths:
- zhenxun/**
- tests/**
- .github/workflows/bot_check.yml
- bot.py
jobs:
bot-check:
runs-on: ubuntu-latest
name: bot check
steps:
- uses: actions/checkout@v4
- name: Setup Python
id: setup_python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Poetry
run: pip install poetry
# Poetry cache depends on OS, Python version and Poetry version.
- name: Cache Poetry cache
id: cache-poetry
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }}
- name: Cache playwright cache
id: cache-playwright
uses: actions/cache@v3
with:
path: ~/.cache/ms-playwright
key: playwright-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}
- name: Cache Data cache
uses: actions/cache@v3
with:
path: data
key: data-cache-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}
- name: Install dependencies
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
rm -rf poetry.lock
poetry source remove aliyun
poetry install --no-root
- name: Install playwright
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: |
poetry run sudo apt-get update
poetry run sudo apt-get install -y libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-libav flite x264 libx264-dev
poetry run pip install playwright
poetry run playwright install-deps
poetry run playwright install
- name: Run tests
run: poetry run pytest --cov=zhenxun --cov-report xml
- name: Check bot run
id: bot_check_run
run: |
mv scripts/bot_check.py bot_check.py
sed -i "s|^.*\?DB_URL.*|DB_URL=\"${{ env.DB_URL }}\"|g" .env.dev
sed -i "s/^.*\?LOG_LEVEL.*/LOG_LEVEL=${{ env.LOG_LEVEL }}/g" .env.dev
poetry run python3 bot_check.py
env:
DB_URL: "sqlite://:memory:"
LOG_LEVEL: DEBUG