Skip to content

Commit

Permalink
chore: convert to UV (#3)
Browse files Browse the repository at this point in the history
* chore: convert to UV
  • Loading branch information
cofin authored Oct 22, 2024
1 parent d2596ba commit df84e65
Show file tree
Hide file tree
Showing 8 changed files with 2,163 additions and 2,009 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
config: pyproject.toml
args: -vv --latest --strip header
env:
OUTPUT: docs/CHANGELOG.rst
OUTPUT: docs/changelog.rst
151 changes: 122 additions & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install 3.9

- name: Install Pre-Commit
run: python -m pip install pre-commit && pre-commit install
- name: Create virtual environment
run: uv sync --all-extras --dev

- name: Install Pre-Commit hooks
run: uv run pre-commit install

- name: Load cached Pre-Commit Dependencies
id: cached-pre-commit-dependencies
Expand All @@ -27,34 +32,127 @@ jobs:
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Execute Pre-Commit
run: pre-commit run --show-diff-on-failure --color=always --all-files
run: uv run pre-commit run --show-diff-on-failure --color=always --all-files

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install 3.9

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run mypy
run: uv run mypy

pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

test:
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install 3.9

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run pyright
run: uv run pyright

slotscheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install 3.9

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Run slotscheck
run: uv run slotscheck dtos

test-linux:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 30
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: ${{ matrix.python-version }}
allow-python-prereleases: true
cache: true
- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Test
run: uv run pytest -m ""

test-windows:
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.12"]
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: pdm install
run: uv sync --all-extras --dev

- name: Test
run: pdm run pytest -m ""
run: uv run pytest -m ""

test-osx:
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
python-version: ["3.11", "3.12"]
timeout-minutes: 30
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Set up Python
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --all-extras --dev

- name: Test
run: uv run pytest -m ""

build-docs:
needs:
Expand All @@ -65,22 +163,17 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

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

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.12"
cache: true
- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: pdm install -G:docs
run: uv sync --all-extras --dev

- name: Build docs
run: pdm run make docs
run: uv run make docs

- name: Save PR number
env:
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,24 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.12"
cache: true
- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: pdm install -G:docs
run: uv sync --all-extras --dev

- name: Fetch gh pages
run: git fetch origin gh-pages --depth=1

- name: Build release docs
run: pdm run python tools/build_docs.py docs-build
run: uv run python tools/build_docs.py docs-build
if: github.event_name == 'release'

- name: Build dev docs
run: pdm run python tools/build_docs.py docs-build
run: uv run python tools/build_docs.py docs-build
if: github.event_name == 'push'

- name: Deploy
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,17 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4

- uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install uv
uses: astral-sh/setup-uv@v3

- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.12"
allow-python-prereleases: true
cache: true
- name: Set up Python
run: uv python install 3.12

- name: Install dependencies
run: uv sync --all-extras

- name: Build package
run: pdm build
run: uv build

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Loading

0 comments on commit df84e65

Please sign in to comment.