From 0b6eabc6083793121777d2e18ff5e99e0878a329 Mon Sep 17 00:00:00 2001 From: Lukas Burgholzer Date: Sat, 14 Sep 2024 13:11:08 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20use=20official=20`setup-uv`=20actio?= =?UTF-8?q?n=20and=20more=20of=20`uv`=20(#31)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ⚡ 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 --- .github/workflows/reusable-python-linter.yml | 14 +++++----- .../workflows/reusable-python-packaging.yml | 26 ++++++++++++++----- .github/workflows/reusable-python-tests.yml | 7 ++++- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/.github/workflows/reusable-python-linter.yml b/.github/workflows/reusable-python-linter.yml index 0ddbcbb..87dae61 100644 --- a/.github/workflows/reusable-python-linter.yml +++ b/.github/workflows/reusable-python-linter.yml @@ -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 diff --git a/.github/workflows/reusable-python-packaging.yml b/.github/workflows/reusable-python-packaging.yml index 2275d16..1e08116 100644 --- a/.github/workflows/reusable-python-packaging.yml +++ b/.github/workflows/reusable-python-packaging.yml @@ -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: @@ -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: @@ -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 diff --git a/.github/workflows/reusable-python-tests.yml b/.github/workflows/reusable-python-tests.yml index 1d02554..905f7ca 100644 --- a/.github/workflows/reusable-python-tests.yml +++ b/.github/workflows/reusable-python-tests.yml @@ -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 @@ -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: