Skip to content

Commit

Permalink
Use uv build (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhaus authored Sep 10, 2024
1 parent c21fbd2 commit e769b7c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 59 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,29 @@ jobs:
runs-on: "ubuntu-latest"
name: Check code quality
steps:
- uses: actions/checkout@v4
- name: Set up uv
# Install latest uv version using the installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: "Set up Python"
- name: ⤵️ Checkout repository
uses: actions/checkout@v4

- name: 🏗 Install uv
uses: astral-sh/setup-uv@v2

- name: 🏗 Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
- name: Restore uv cache

- name: 🏗 Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
restore-keys: |
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install the project
- name: 🏗 Install the project
run: uv sync --locked --dev

# Following steps cannot run by pre-commit.ci as repo = local
- name: Run mypy
run: uv run mypy deebot_client/
Expand Down
25 changes: 16 additions & 9 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ jobs:
permissions:
id-token: write
steps:
- name: 📥 Checkout the repository
- name: ⤵️ Checkout repository
uses: actions/checkout@v4

- name: Set up uv
- name: 🏗 Install uv
# Install latest uv version using the installer
run: curl -LsSf https://astral.sh/uv/install.sh | sh

- name: "Set up Python"
- name: 🏗 Set up Python
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"

- name: Restore uv cache
- name: 🏗 Restore uv cache
uses: actions/cache@v4
with:
path: /tmp/.uv-cache
Expand All @@ -40,13 +40,20 @@ jobs:
uv-${{ runner.os }}-${{ hashFiles('uv.lock') }}
uv-${{ runner.os }}
- name: Install the project
- name: 🏗 Install the project
run: uv sync --dev --locked

- name: 📦 Build package
run: |
. .venv/bin/activate
python -m build
run: uv build

- name: 📤 Publish package
- name: 🚀 Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
print-hash: true

- name: ✍️ Sign published artifacts
uses: sigstore/[email protected]
with:
inputs: ./dist/*.tar.gz ./dist/*.whl
release-signing-artifacts: true
35 changes: 18 additions & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,24 @@ dynamic = ["version"]
"Source Code" = "https://github.com/DeebotUniverse/client.py"
"Bug Reports" = "https://github.com/DeebotUniverse/client.py/issues"

[tool.uv]
dev-dependencies = [
"mypy==1.11.2",
"pre-commit==3.8.0",
"pycountry==24.6.1",
"pylint==3.2.7",
"pytest-asyncio==0.24.0",
"pytest-cov==5.0.0",
"pytest-docker-fixtures==1.3.19",
"pytest-timeout==2.3.1",
"pytest==8.3.3",
"testfixtures==8.3.0",
"types-cachetools>=5.5.0.20240820",
"types-mock>=5.1.0.20240425",
"types-pillow>=10.2.0.20240822",
]


[tool.hatch.build.targets.sdist]
include = [
"/deebot_client",
Expand Down Expand Up @@ -176,20 +194,3 @@ overgeneral-exceptions = [
"builtins.Exception",
]

[tool.uv]
dev-dependencies = [
"build>=1.2.1",
"mypy==1.11.2",
"pre-commit==3.8.0",
"pycountry==24.6.1",
"pylint==3.2.7",
"pytest-asyncio==0.24.0",
"pytest-cov==5.0.0",
"pytest-docker-fixtures==1.3.19",
"pytest-timeout==2.3.1",
"pytest==8.3.3",
"testfixtures==8.3.0",
"types-cachetools>=5.5.0.20240820",
"types-mock>=5.1.0.20240425",
"types-pillow>=10.2.0.20240822",
]
27 changes: 1 addition & 26 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e769b7c

Please sign in to comment.