♻️ 将所有 poetry 替换为 uv

This commit is contained in:
suyiiyii 2024-12-22 21:15:32 +08:00
parent 6c8b37f085
commit 08c8bb955f
Signed by: suyiiyii
GPG Key ID: 044704CB29B8AD85
5 changed files with 21 additions and 17 deletions

View File

@ -6,6 +6,10 @@ inputs:
description: Python version description: Python version
required: false required: false
default: "3.10" default: "3.10"
install-deps:
description: Install dependencies
required: false
default: false
runs: runs:
using: "composite" using: "composite"
@ -20,3 +24,7 @@ runs:
with: with:
version: "latest" version: "latest"
enable-cache: true enable-cache: true
- name: Install dependencies
if: ${{ inputs.install-deps == true }}
run: uv sync --frozen

View File

@ -11,7 +11,7 @@ on:
- nonebot_bison/** - nonebot_bison/**
- tests/** - tests/**
- pyproject.toml - pyproject.toml
- poetry.lock - uv.lock
- docker.env.prod - docker.env.prod
- .github/** - .github/**
pull_request: pull_request:
@ -21,7 +21,7 @@ on:
- nonebot_bison/** - nonebot_bison/**
- tests/** - tests/**
- pyproject.toml - pyproject.toml
- poetry.lock - uv.lock
- docker.env.prod - docker.env.prod
- .github/** - .github/**
types: types:
@ -72,12 +72,10 @@ jobs:
uses: ./.github/actions/setup-python uses: ./.github/actions/setup-python
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
install-deps: "true"
- name: Install prerequisites
run: poetry install
- name: Run Pytest - name: Run Pytest
run: poetry run pytest --cov-report xml --cov=./nonebot_bison -k 'not compare and not render' -n auto run: uv run pytest --cov-report xml --cov=./nonebot_bison -k 'not compare and not render' -n auto
- name: Upload coverage report - name: Upload coverage report
uses: codecov/codecov-action@v5 uses: codecov/codecov-action@v5
@ -106,12 +104,10 @@ jobs:
uses: ./.github/actions/setup-python uses: ./.github/actions/setup-python
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
install-deps: true
- name: Install prerequisites
run: poetry install
- name: Run Pytest - name: Run Pytest
run: poetry run pytest --cov-report xml --cov=./nonebot_bison -k 'not compare' -n auto run: uv run pytest --cov-report xml --cov=./nonebot_bison -k 'not compare' -n auto
- name: Upload coverage report - name: Upload coverage report
uses: codecov/codecov-action@v5 uses: codecov/codecov-action@v5

View File

@ -11,7 +11,7 @@ on:
- nonebot_bison/** - nonebot_bison/**
- tests/** - tests/**
- pyproject.toml - pyproject.toml
- poetry.lock - uv.lock
- docker.env.prod - docker.env.prod
- .github/** - .github/**
pull_request: pull_request:
@ -21,7 +21,7 @@ on:
- nonebot_bison/** - nonebot_bison/**
- tests/** - tests/**
- pyproject.toml - pyproject.toml
- poetry.lock - uv.lock
- docker.env.prod - docker.env.prod
- .github/** - .github/**
types: types:
@ -55,7 +55,7 @@ jobs:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install prerequisites - name: Install prerequisites
run: poetry add pydantic@^1.10 && poetry install run: uv add pydantic==1.10 && uv sync --frozen
- name: Run Pytest - name: Run Pytest
run: poetry run pytest -k 'not compare and not render' -n auto run: uv run pytest -k 'not compare and not render' -n auto

View File

@ -16,7 +16,7 @@ jobs:
- name: Setup Python environment - name: Setup Python environment
uses: ./.github/actions/setup-python uses: ./.github/actions/setup-python
- run: echo "TAG_NAME=v$(poetry version -s)" >> $GITHUB_ENV - run: echo "TAG_NAME=v$(uvx --from=toml-cli toml get --toml-path=pyproject.toml project.version)" >> $GITHUB_ENV
- name: Archive Changelog - name: Archive Changelog
uses: docker://ghcr.io/nonebot/auto-changelog:master uses: docker://ghcr.io/nonebot/auto-changelog:master
@ -30,6 +30,6 @@ jobs:
git config user.name github-actions[bot] git config user.name github-actions[bot]
git config user.email github-actions[bot]@users.noreply.github.com git config user.email github-actions[bot]@users.noreply.github.com
git add . git add .
git commit -m ":bookmark: Release $(poetry version -s)" git commit -m ":bookmark: Release ${{ env.TAG_NAME }}"
git tag ${{ env.TAG_NAME }} git tag ${{ env.TAG_NAME }}
git push && git push --tags git push && git push --tags

View File

@ -54,7 +54,7 @@ jobs:
- name: Publish PyPI and Github - name: Publish PyPI and Github
run: | run: |
poetry publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi" uv publish --build -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} || echo "Already pushed to pypi"
gh release upload --clobber ${{ env.TAG_NAME }} dist/* gh release upload --clobber ${{ env.TAG_NAME }} dist/*
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}