From 10d2f0c585e5cf84cc96fbf943e29522409bc024 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Mon, 27 Jul 2026 21:34:27 -0700 Subject: [PATCH] ci: use astral-sh/setup-uv to speed up backend CI setup-backend (used in 17 job steps across 13 workflows) bootstrapped uv via `pip install --upgrade pip setuptools wheel uv` on every run, and only cached pip's download dir via actions/setup-python's `cache: pip` -- pip wasn't doing the actual installs (uv was), so that cache bought nothing. astral-sh/setup-uv ships a prebuilt uv binary instead of installing it via pip, and its own GitHub Actions cache (enable-cache: true) persists uv's resolution/wheel cache across runs, keyed on requirements/*.txt and pyproject.toml by default. Also drops the now-redundant pip/setuptools/wheel upgrade -- uv's build isolation installs anything a package's build backend declares (pyproject.toml's [build-system] already requires setuptools/wheel) without needing them preinstalled in the target environment. Also swaps the same `pip install uv` bootstrap in bump-python-package.yml. The uv step is skipped when install-superset: false (helm-lint-test), since otherwise there's nothing for it to install or cache and it fails the job. --- .github/actions/setup-backend/action.yml | 13 ++++++------- .github/workflows/bump-python-package.yml | 5 ++++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/actions/setup-backend/action.yml b/.github/actions/setup-backend/action.yml index c1134f7c74a..8c073c81624 100644 --- a/.github/actions/setup-backend/action.yml +++ b/.github/actions/setup-backend/action.yml @@ -5,10 +5,6 @@ inputs: description: 'Python version to set up. Accepts a version number, "current", or "next".' required: true default: 'current' - cache: - description: 'Cache dependencies. Options: pip' - required: false - default: 'pip' requirements-type: description: 'Type of requirements to install. Options: base, development, default' required: false @@ -43,7 +39,12 @@ runs: uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 with: python-version: ${{ steps.set-python-version.outputs.python-version }} - cache: ${{ inputs.cache }} + - name: Install uv + if: inputs.install-superset == 'true' + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 + with: + python-version: ${{ steps.set-python-version.outputs.python-version }} + enable-cache: true - name: Install dependencies env: INPUT_INSTALL_SUPERSET: ${{ inputs.install-superset }} @@ -52,8 +53,6 @@ runs: if [ "$INPUT_INSTALL_SUPERSET" = "true" ]; then sudo apt-get update && sudo apt-get -y install libldap2-dev libsasl2-dev - pip install --upgrade pip setuptools wheel uv - if [ "$INPUT_REQUIREMENTS_TYPE" = "dev" ]; then uv pip install --system -r requirements/development.txt elif [ "$INPUT_REQUIREMENTS_TYPE" = "base" ]; then diff --git a/.github/workflows/bump-python-package.yml b/.github/workflows/bump-python-package.yml index 17a620e5570..c53b53d057c 100644 --- a/.github/workflows/bump-python-package.yml +++ b/.github/workflows/bump-python-package.yml @@ -45,7 +45,10 @@ jobs: python-version: "3.11" - name: Install uv - run: pip install uv + uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0 + with: + python-version: "3.11" + enable-cache: true - name: supersetbot bump-python -p "${{ github.event.inputs.package }}" env: