Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: switch to uv #11

Merged
merged 7 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 10 additions & 26 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ on:
- mkdocs.yml
workflow_dispatch:

permissions:
contents: write

jobs:
deploy:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -26,30 +25,15 @@ jobs:
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install pipx
run: python -m pip install pipx

- name: Install poetry
run: pipx install poetry

- name: Setup a local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- name: Install uv
id: setup-uv
uses: astral-sh/setup-uv@v3

- uses: actions/cache@v4
name: Define a cache for the venv based on the dependencies lock file
with:
key: 3.12-${{ hashFiles('poetry.lock') }}
path: ./.venv
- name: Install Python 3.12
run: uv python install 3.12

- name: Install dependencies
run: poetry install
- name: Install the project
run: uv sync --all-extras --python 3.12

- name: Deploy docs
run: poetry run mkdocs gh-deploy --force
run: uv run mkdocs gh-deploy --force
35 changes: 11 additions & 24 deletions .github/workflows/lint-and-type-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- name: Install uv
id: setup-uv
uses: astral-sh/setup-uv@v3
with:
python-version: "3.12"
enable-cache: true

- name: Install pipx
run: python -m pip install pipx
- name: Install Python 3.12
run: uv python install 3.12

- name: Install poetry
run: pipx install poetry

- name: Setup a local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

- uses: actions/cache@v4
name: Define a cache for the venv based on the dependencies lock file
with:
key: ubuntu-latest-3.12-${{ hashFiles('poetry.lock') }}
path: ./.venv

- name: Install the project dependencies
run: poetry install --all-extras
- name: Install the project
run: uv sync --all-extras --python 3.12

- name: Run mypy
run: poetry run mypy .
run: uv run mypy .

- name: Run ruff lint
run: poetry run ruff check .
run: uv run ruff check .

- name: Run ruff format
run: poetry run ruff format --check .
run: uv run ruff format --check .
38 changes: 21 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,36 @@ on:
tags:
- 'v*.*.*'

permissions:
contents: write

jobs:
release:
name: Release
environment:
name: release
url: https://pypi.org/p/pynyaa
permissions:
id-token: write
contents: write
attestations: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Important for changelog

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
id: setup-uv
uses: astral-sh/setup-uv@v3

- name: Install pipx
run: python -m pip install pipx
- name: Install Python 3.12
run: uv python install 3.12

- name: Install Poetry
run: pipx install poetry
- name: Build
run: uv build

- name: Build project for distribution
run: poetry build
- uses: actions/attest-build-provenance@v1
with:
subject-path: "dist/*"

- name: Generate changelog with git-cliff
uses: tj-actions/git-cliff@v1
Expand All @@ -48,7 +52,7 @@ jobs:
draft: false
prerelease: false

- name: Publish to PyPI
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
37 changes: 11 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,29 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install pipx
run: python -m pip install pipx

- name: Install poetry
run: pipx install poetry
- name: Install uv
id: setup-uv
uses: astral-sh/setup-uv@v3

- name: Setup a local virtual environment
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

- uses: actions/cache@v4
name: Define a cache for the venv based on the dependencies lock file
with:
key: ${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
path: ./.venv
- name: Install Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}

- name: Install the project dependencies
run: poetry install
- name: Install the project
run: uv sync --all-extras --python ${{ matrix.python-version }}

- name: Run tests and generate coverage
run: |
poetry run coverage run -m pytest -vv
poetry run coverage xml
uv run coverage run -m pytest -vv
uv run coverage xml

- name: Build
run: poetry build
run: uv build

- name: Get version
id: version
Expand Down
Loading