mirror of
https://github.com/malmeloo/FindMy.py.git
synced 2026-04-17 21:53:57 +02:00
chore: migrate from poetry to uv
This commit is contained in:
47
.github/actions/setup-project/action.yml
vendored
47
.github/actions/setup-project/action.yml
vendored
@@ -1,48 +1,25 @@
|
||||
name: Common Python + Poetry Setup
|
||||
name: Common Python + UV Setup
|
||||
|
||||
inputs:
|
||||
dependency-groups:
|
||||
description: 'A comma-separated list of dependency groups to install'
|
||||
default: 'main'
|
||||
python-version:
|
||||
description: 'The Python version to use'
|
||||
default: '3.10'
|
||||
description: 'The Python version to install'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
||||
steps:
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
enable-cache: true
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ inputs.python-version }}
|
||||
|
||||
- name: Install poetry
|
||||
if: ${{ inputs.python-version != '' }}
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip install poetry
|
||||
poetry config virtualenvs.in-project true
|
||||
|
||||
- name: Get cache key
|
||||
id: cache-key
|
||||
shell: bash
|
||||
run: |
|
||||
key=$(echo "${{ inputs.dependency-groups }}" | sed 's/,/+/')
|
||||
echo "key=$key" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Get full Python version
|
||||
id: full-python-version
|
||||
shell: bash
|
||||
run: echo version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Load cached venv
|
||||
id: cache-dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: .venv
|
||||
key: venv-${{ runner.os }}-py${{ steps.full-python-version.outputs.version }}-grp${{ steps.cache-key.outputs.key }}-${{ hashFiles('**/poetry.lock') }}
|
||||
run: uv python install
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.cache-dependencies.outputs.cache-hit != 'true'
|
||||
shell: bash
|
||||
run: poetry install --with ${{ inputs.dependency-groups }}
|
||||
run: uv sync --all-extras --dev
|
||||
|
||||
7
.github/workflows/docs.yml
vendored
7
.github/workflows/docs.yml
vendored
@@ -17,14 +17,15 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: './.github/actions/setup-project'
|
||||
- name: Install uv and set the python version
|
||||
uses: astral-sh/setup-uv@v5
|
||||
with:
|
||||
dependency-groups: 'docs'
|
||||
python-version: ${{ matrix.python-version }}
|
||||
|
||||
- name: Build documentation
|
||||
run: |
|
||||
cd docs
|
||||
poetry run make html
|
||||
uv run make html
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
2
.github/workflows/pre-commit.yml
vendored
2
.github/workflows/pre-commit.yml
vendored
@@ -14,8 +14,6 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: './.github/actions/setup-project'
|
||||
with:
|
||||
dependency-groups: 'dev,test'
|
||||
|
||||
- uses: pre-commit/action@v3.0.1
|
||||
|
||||
|
||||
7
.github/workflows/publish.yml
vendored
7
.github/workflows/publish.yml
vendored
@@ -17,19 +17,16 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: './.github/actions/setup-project'
|
||||
with:
|
||||
dependency-groups: 'dev'
|
||||
|
||||
- name: Prepare README
|
||||
run: ./scripts/refactor_readme.py README.md
|
||||
|
||||
- name: Build package
|
||||
run: poetry build
|
||||
run: uv build
|
||||
|
||||
- name: Publish package
|
||||
run: |
|
||||
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
|
||||
poetry publish
|
||||
uv publish --token ${{ secrets.PYPI_API_TOKEN }}
|
||||
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v2
|
||||
|
||||
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@@ -17,14 +17,12 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: './.github/actions/setup-project'
|
||||
with:
|
||||
dependency-groups: 'dev'
|
||||
|
||||
- id: supported-versions
|
||||
name: Get supported versions
|
||||
run: |
|
||||
set -e
|
||||
echo "py-versions=$(poetry run ./scripts/supported_py_versions.py)" >> "$GITHUB_OUTPUT"
|
||||
echo "py-versions=$(uv run ./scripts/supported_py_versions.py)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -40,10 +38,9 @@ jobs:
|
||||
- uses: './.github/actions/setup-project'
|
||||
with:
|
||||
python-version: ${{ matrix.py-version }}
|
||||
dependency-groups: 'test'
|
||||
|
||||
- name: Run unit tests
|
||||
run: poetry run pytest
|
||||
run: uv run pytest
|
||||
|
||||
results:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user