Skip to content

Commit

Permalink
⚡ use official setup-uv action and more of uv (#31)
Browse files Browse the repository at this point in the history
* ⚡ use official `setup-uv` action and more of `uv`

* ⚡ run pre-commit directly with `uvx`

* ⚡ run nox directly with `uvx`

* 🚸 provide GITHUB_TOKEN for Python tests

* ⏪ do not use `uvx` for setting up nox

* ⏪ specify Python version for nox setup
  • Loading branch information
burgholzer authored Sep 14, 2024
1 parent fdc30c7 commit 0b6eabc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/reusable-python-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ jobs:
- name: Set up mold as linker
uses: rui314/setup-mold@v1
# set up uv for faster Python package management
- uses: yezz123/setup-uv@v4
# set up nox for convenient linting
- uses: wntrblm/nox@2024.04.15
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
python-versions: "3.12"
# run the nox lint session (assumes a nox session named "lint" exists, and `mypy` is configured in pre-commit)
version: "latest"
enable-cache: true
- name: Run mypy
run: nox -s lint -- mypy
run: uvx --with pre-commit-uv pre-commit run -a mypy
# run check-sdist to ensure the package sdist is correct
- name: Run check-sdist
run: |
pipx run check-sdist --inject-junk
run: uvx check-sdist --inject-junk
26 changes: 19 additions & 7 deletions .github/workflows/reusable-python-packaging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ jobs:
submodules: recursive
fetch-depth: 0
# set up uv for faster Python package management
- uses: yezz123/setup-uv@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
# build the source distribution
- name: Build SDist
run: pipx run build --sdist --installer uv
run: uv build --sdist
# check the metadata of the source distribution
- name: Check metadata
run: pipx run twine check dist/*
run: uvx twine check dist/*
# upload the source distribution as an artifact
- uses: actions/upload-artifact@v4
with:
Expand All @@ -51,13 +55,17 @@ jobs:
submodules: recursive
fetch-depth: 0
# set up uv for faster Python package management
- uses: yezz123/setup-uv@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
# build the wheel
- name: Build Wheel
run: pipx run build --wheel --installer uv
run: uv build --wheel
# check the metadata of the wheel
- name: Check metadata
run: pipx run twine check dist/*
run: uvx twine check dist/*
# upload the wheel as an artifact
- uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -102,7 +110,11 @@ jobs:
override_cache_key: wheels-${{ matrix.runs-on }}
# set up uv for faster Python package management
- if: matrix.runs-on != 'ubuntu-latest'
uses: yezz123/setup-uv@v4
name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
# run cibuildwheel to build wheels for the specified Python version
- uses: pypa/cibuildwheel@v2.20
- name: Verify clean directory
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/reusable-python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
runs-on: ${{ inputs.runs-on }}
env:
FORCE_COLOR: 3
GITHUB_TOKEN: ${{ github.token }}
steps:
# check out the repository (including submodules and all history)
- uses: actions/checkout@v4
Expand All @@ -50,7 +51,11 @@ jobs:
- name: Set up mold as linker (Linux only)
uses: rui314/setup-mold@v1
# set up uv for faster Python package management
- uses: yezz123/setup-uv@v4
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v2
with:
version: "latest"
enable-cache: true
# set up nox for convenient testing
- uses: wntrblm/nox@2024.04.15
with:
Expand Down

0 comments on commit 0b6eabc

Please sign in to comment.