From 948f96925f4bb52a488c9f1db6487398d461cda5 Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Sun, 24 Mar 2024 14:02:45 +0100 Subject: [PATCH] Use uv to install our tools (#86) * Use uv to install our tools * Create venv too * Be explicit * Fix path * Set venv explicitly * TIL pipx is preinstalled * Try caching Co-authored-by: Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> * Add changelog * Benchmark installation methods * Install uv using curl It's much faster: 0m3.533s vs 0m1.864s --------- Co-authored-by: Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- CHANGELOG.md | 6 ++++++ action.yml | 28 ++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19d7623..0a98e47 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), [#98](https://github.com/hynek/build-and-inspect-python-package/pull/98) +### Changed + +- The action now uses [*uv*](https://github.com/astral-sh/uv) to install its tools to speed up your CI runs. + [#86](https://github.com/hynek/build-and-inspect-python-package/pull/86) + + ## [2.0.2](https://github.com/hynek/build-and-inspect-python-package/compare/v2.0.1...v2.0.2) – 2024-03-16 ### Changed diff --git a/action.yml b/action.yml index 0286cae..6a526ca 100644 --- a/action.yml +++ b/action.yml @@ -29,18 +29,34 @@ runs: python-version: "3.x" update-environment: false + - name: Install uv + run: curl -LsSf https://astral.sh/uv/install.sh | sh + shell: bash + + - name: Find uv cache + run: echo "UV_CACHE=$(uv cache dir)" >>$GITHUB_ENV + shell: bash + + - name: Cache uv + uses: actions/cache@v4 + with: + path: ${{ env.UV_CACHE }} + key: ${{ runner.os }}-uv + - name: Create venv for tools - run: ${{ steps.python-baipp.outputs.python-path }} -Im venv /tmp/baipp + run: > + uv venv + /tmp/baipp + --python ${{ steps.python-baipp.outputs.python-path }} shell: bash - name: Install our tools run: > - /tmp/baipp/bin/python - -Im pip - --disable-pip-version-check - --no-python-version-warning - install -r ${{ github.action_path }}/requirements/tools.txt + uv pip sync + ${{ github.action_path }}/requirements/tools.txt shell: bash + env: + VIRTUAL_ENV: /tmp/baipp # Build SDist, then build wheel out of it if the user didn't forbid it. # Set 'SOURCE_DATE_EPOCH' based on the last commit for build