mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Migrate to UV (#1748)
* Switch to using `uv` for dependency management and update related project workflows and scripts * Expand contributing documentation with instructions for using `uv`, including dependency management, testing, linting, and docs workflows. * Add changelog entry for migration to `uv` for dependency management and workflows
This commit is contained in:
parent
7201e82238
commit
ce4ddb77f4
9 changed files with 3203 additions and 149 deletions
23
.github/workflows/pypi-release.yml
vendored
23
.github/workflows/pypi-release.yml
vendored
|
|
@ -10,25 +10,22 @@ jobs:
|
|||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python 3.11
|
||||
uses: actions/setup-python@v5
|
||||
- name: Set up Python 3.14
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.11"
|
||||
python-version: "3.14"
|
||||
|
||||
- name: Install build dependencies
|
||||
run: python -m pip install --upgrade build
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
|
||||
- name: Resolve version
|
||||
id: package-version
|
||||
run: echo "value=$(echo ${{ github.ref }} | sed -e 's/refs\/tags\/v//')" >> $GITHUB_OUTPUT
|
||||
|
||||
# - name: Bump version
|
||||
# run: hatch version ${{ steps.package-version.outputs.value }}
|
||||
|
||||
- name: Build source distribution
|
||||
run: python -m build .
|
||||
- name: Build distribution
|
||||
run: uv build
|
||||
|
||||
- name: Try install wheel
|
||||
run: |
|
||||
|
|
@ -39,7 +36,7 @@ jobs:
|
|||
venv/bin/pip install ../dist/aiogram-*.whl
|
||||
venv/bin/python -c "import aiogram; print(aiogram.__version__)"
|
||||
- name: Publish artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: dist
|
||||
path: dist/*
|
||||
|
|
@ -55,7 +52,7 @@ jobs:
|
|||
id-token: write
|
||||
steps:
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
|
|
|
|||
34
.github/workflows/tests.yml
vendored
34
.github/workflows/tests.yml
vendored
|
|
@ -58,18 +58,21 @@ jobs:
|
|||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: "pip"
|
||||
cache-dependency-path: pyproject.toml
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Install project dependencies
|
||||
run: |
|
||||
pip install -e .[dev,test,redis,mongo,proxy,i18n,fast,signature]
|
||||
uv sync --all-extras --group dev --group test
|
||||
|
||||
- name: Lint code
|
||||
run: |
|
||||
ruff check --output-format=github aiogram examples
|
||||
mypy aiogram
|
||||
black --check --diff aiogram tests
|
||||
uv run ruff check --output-format=github aiogram examples
|
||||
uv run mypy aiogram
|
||||
uv run black --check --diff aiogram tests
|
||||
|
||||
- name: Setup redis
|
||||
if: ${{ env.IS_WINDOWS == 'false' }}
|
||||
|
|
@ -91,10 +94,10 @@ jobs:
|
|||
flags="$flags --cov=aiogram --cov-config .coveragerc --cov-report=xml"
|
||||
[[ "$IS_WINDOWS" == "false" ]] && flags="$flags --redis redis://localhost:6379/0"
|
||||
[[ "$IS_UBUNTU" == "true" ]] && flags="$flags --mongo mongodb://mongo:mongo@localhost:27017"
|
||||
pytest $flags
|
||||
uv run pytest $flags
|
||||
|
||||
- name: Upload coverage data
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: coverage.xml
|
||||
|
|
@ -123,20 +126,23 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }}
|
||||
uses: actions/setup-python@v5
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
cache: "pip"
|
||||
cache-dependency-path: pyproject.toml
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v7
|
||||
with:
|
||||
enable-cache: true
|
||||
|
||||
- name: Install project dependencies
|
||||
run: |
|
||||
pip install -e .[dev,test,redis,mongo,proxy,i18n,fast,signature]
|
||||
uv sync --all-extras --group dev --group test
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
flags=""
|
||||
pytest $flags
|
||||
uv run pytest $flags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue