mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-06 03:56:45 +00:00
🧑💻 Dev: 迁移使用 uv 管理项目依赖 (#3607)
This commit is contained in:
7
.github/actions/build-api-doc/action.yml
vendored
7
.github/actions/build-api-doc/action.yml
vendored
@ -5,10 +5,5 @@ runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- run: |
|
||||
poetry run nb-autodoc nonebot \
|
||||
-s nonebot.plugins \
|
||||
-u nonebot.internal \
|
||||
-u nonebot.internal.*
|
||||
cp -r ./build/nonebot/* ./website/docs/api/
|
||||
yarn prettier
|
||||
uv run --no-sync bash ./scripts/build-api-docs.sh
|
||||
shell: bash
|
||||
|
30
.github/actions/setup-python/action.yml
vendored
30
.github/actions/setup-python/action.yml
vendored
@ -5,36 +5,20 @@ inputs:
|
||||
python-version:
|
||||
description: Python version
|
||||
required: false
|
||||
default: "3.10"
|
||||
env-dir:
|
||||
description: Environment directory
|
||||
default: "3.12"
|
||||
env-group:
|
||||
description: Environment group
|
||||
required: false
|
||||
default: "."
|
||||
no-root:
|
||||
description: Do not install package in the environment
|
||||
required: false
|
||||
default: "false"
|
||||
default: "pydantic-v2"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Install poetry
|
||||
run: pipx install poetry
|
||||
shell: bash
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
- uses: astral-sh/setup-uv@v6
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
cache: "poetry"
|
||||
cache-dependency-path: |
|
||||
./poetry.lock
|
||||
${{ inputs.env-dir }}/poetry.lock
|
||||
cache-suffix: ${{ inputs.env-group }}
|
||||
|
||||
- run: |
|
||||
cd ${{ inputs.env-dir }}
|
||||
if [ "${{ inputs.no-root }}" = "true" ]; then
|
||||
poetry install --all-extras --no-root
|
||||
else
|
||||
poetry install --all-extras
|
||||
fi
|
||||
uv sync --all-extras --locked --group ${{ inputs.env-group }}
|
||||
shell: bash
|
||||
|
8
.github/workflows/codecov.yml
vendored
8
.github/workflows/codecov.yml
vendored
@ -13,7 +13,7 @@ on:
|
||||
- ".github/actions/setup-python/**"
|
||||
- ".github/workflows/codecov.yml"
|
||||
- "pyproject.toml"
|
||||
- "poetry.lock"
|
||||
- "uv.lock"
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@ -40,13 +40,11 @@ jobs:
|
||||
uses: ./.github/actions/setup-python
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
env-dir: ./envs/${{ matrix.env }}
|
||||
no-root: true
|
||||
env-group: ${{ matrix.env }}
|
||||
|
||||
- name: Run Pytest
|
||||
run: |
|
||||
cd ./envs/${{ matrix.env }}
|
||||
poetry run bash "../../scripts/run-tests.sh"
|
||||
uv run --no-sync bash ./scripts/run-tests.sh
|
||||
|
||||
- name: Upload test results
|
||||
uses: codecov/test-results-action@v1
|
||||
|
7
.github/workflows/pyright.yml
vendored
7
.github/workflows/pyright.yml
vendored
@ -13,7 +13,7 @@ on:
|
||||
- ".github/actions/setup-python/**"
|
||||
- ".github/workflows/pyright.yml"
|
||||
- "pyproject.toml"
|
||||
- "poetry.lock"
|
||||
- "uv.lock"
|
||||
|
||||
jobs:
|
||||
pyright:
|
||||
@ -33,11 +33,10 @@ jobs:
|
||||
- name: Setup Python environment
|
||||
uses: ./.github/actions/setup-python
|
||||
with:
|
||||
env-dir: ./envs/${{ matrix.env }}
|
||||
no-root: true
|
||||
env-group: ${{ matrix.env }}
|
||||
|
||||
- run: |
|
||||
(cd ./envs/${{ matrix.env }} && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH)
|
||||
echo "$(dirname $(uv python find))" >> $GITHUB_PATH
|
||||
if [ "${{ matrix.env }}" = "pydantic-v1" ]; then
|
||||
sed -i 's/PYDANTIC_V2 = true/PYDANTIC_V2 = false/g' ./pyproject.toml
|
||||
fi
|
||||
|
18
.github/workflows/release-drafter.yml
vendored
18
.github/workflows/release-drafter.yml
vendored
@ -84,7 +84,7 @@ jobs:
|
||||
- name: Get Version
|
||||
id: version
|
||||
run: |
|
||||
echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT
|
||||
echo "VERSION=$(uv version --short)" >> $GITHUB_OUTPUT
|
||||
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||
|
||||
@ -102,10 +102,8 @@ jobs:
|
||||
|
||||
- name: Build Package
|
||||
run: |
|
||||
poetry build
|
||||
|
||||
- name: Publish package to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
uv build
|
||||
uv publish
|
||||
|
||||
- name: Publish package to GitHub
|
||||
run: |
|
||||
@ -117,13 +115,9 @@ jobs:
|
||||
run: |
|
||||
yarn build:plugin --out-dir ../packages/nonebot-plugin-docs/nonebot_plugin_docs/dist
|
||||
cd packages/nonebot-plugin-docs/
|
||||
poetry version ${{ steps.version.outputs.VERSION }}
|
||||
poetry build
|
||||
|
||||
- name: Publish Doc Package to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
with:
|
||||
packages-dir: packages/nonebot-plugin-docs/dist/
|
||||
uv version ${{ steps.version.outputs.VERSION }}
|
||||
uv build
|
||||
uv publish
|
||||
|
||||
- name: Publish Doc Package to GitHub
|
||||
run: |
|
||||
|
6
.github/workflows/release.yml
vendored
6
.github/workflows/release.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
||||
- name: Build API Doc
|
||||
uses: ./.github/actions/build-api-doc
|
||||
|
||||
- run: echo "TAG_NAME=v$(poetry version -s)" >> $GITHUB_ENV
|
||||
- run: echo "TAG_NAME=v$(uv version --short)" >> $GITHUB_ENV
|
||||
|
||||
- name: Archive Changelog
|
||||
uses: docker://ghcr.io/nonebot/auto-changelog:master
|
||||
@ -39,7 +39,7 @@ jobs:
|
||||
|
||||
- name: Archive Files
|
||||
run: |
|
||||
yarn archive $(poetry version -s)
|
||||
yarn archive $(uv version --short)
|
||||
yarn prettier
|
||||
|
||||
- name: Push Tag
|
||||
@ -47,6 +47,6 @@ jobs:
|
||||
git config user.name noneflow[bot]
|
||||
git config user.email 129742071+noneflow[bot]@users.noreply.github.com
|
||||
git add .
|
||||
git commit -m ":bookmark: Release $(poetry version -s)"
|
||||
git commit -m ":bookmark: Release $(uv version --short)"
|
||||
git tag ${{ env.TAG_NAME }}
|
||||
git push && git push --tags
|
||||
|
2
.github/workflows/ruff.yml
vendored
2
.github/workflows/ruff.yml
vendored
@ -13,7 +13,7 @@ on:
|
||||
- ".github/actions/setup-python/**"
|
||||
- ".github/workflows/ruff.yml"
|
||||
- "pyproject.toml"
|
||||
- "poetry.lock"
|
||||
- "uv.lock"
|
||||
|
||||
jobs:
|
||||
ruff:
|
||||
|
Reference in New Issue
Block a user