Compare commits

...

2 Commits

Author SHA1 Message Date
J. Nick Koston
064ece1f4d [ci] PROBE: salt venv cache key (do not merge)
Chained off #16451. Every job in that PR's CI run cache-hit on the
existing dev caches (Linux-/macOS-/Windows-3.11/3.13/3.14-venv-...),
which means the uv install path the PR introduces was never actually
executed. This branch salts the cache key in the common job so every
downstream restore misses and forces the new ``uv pip install`` lines
to run on every (OS, Python) combo.

Probe only -- close once #16451 is validated.
2026-05-15 09:58:20 -07:00
J. Nick Koston
6d62b3af5f [ci] Use uv for pip installs across CI workflows
Follow-up to #16449 / #16448, extending the uv switch to the workflows
that actually dominate CI cost (every push + every PR):

* ``.github/actions/restore-python`` -- the composite action invoked by
  almost every downstream job as the venv cache-miss fallback. Installs
  setup-uv only when the venv cache misses and swaps ``pip install``
  for ``uv pip install`` (no ``--system``: ``VIRTUAL_ENV`` is set by the
  activate step, so installs land in the venv that downstream jobs
  expect to ``. venv/bin/activate``).

* ``.github/workflows/ci.yml`` ``common`` job -- the canonical venv
  builder whose cache feeds the rest of the workflow.

* ``.github/workflows/ci.yml`` ``integration-tests`` job -- has its
  own venv create path on cache miss for the 3.13 matrix entry.

* ``.github/workflows/ci-api-proto.yml`` -- single ``pip install``
  step; uses ``uv pip install --system`` since this workflow does not
  set up or restore a venv.

All four call sites use ``astral-sh/setup-uv@v8.1.0`` (SHA-pinned) with
``enable-cache: true`` for a persistent wheel cache across runs.

Cache-hit paths are unchanged -- setup-uv only runs on cache miss for
the venv-restoring jobs, so steady-state behavior matches today.
2026-05-15 09:53:27 -07:00
3 changed files with 42 additions and 10 deletions

View File

@@ -27,6 +27,14 @@ runs:
path: venv
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ inputs.cache-key }}
- name: Set up uv
# Only needed on cache miss to populate the venv. ``uv pip install``
# detects the activated venv via ``VIRTUAL_ENV`` so the venv layout
# downstream jobs rely on is preserved.
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true' && runner.os != 'Windows'
shell: bash
@@ -34,8 +42,8 @@ runs:
python -m venv venv
source venv/bin/activate
python --version
pip install -r requirements.txt -r requirements_test.txt
pip install -e .
uv pip install -r requirements.txt -r requirements_test.txt
uv pip install -e .
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true' && runner.os == 'Windows'
shell: bash
@@ -43,5 +51,5 @@ runs:
python -m venv venv
source ./venv/Scripts/activate
python --version
pip install -r requirements.txt -r requirements_test.txt
pip install -e .
uv pip install -r requirements.txt -r requirements_test.txt
uv pip install -e .

View File

@@ -26,6 +26,12 @@ jobs:
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: "3.11"
- name: Set up uv
# ``--system`` (below) installs into the setup-python interpreter;
# no venv is created or restored by this workflow.
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Install apt dependencies
run: |
@@ -34,7 +40,7 @@ jobs:
sudo apt install -y protobuf-compiler
protoc --version
- name: Install python dependencies
run: pip install aioesphomeapi -c requirements.txt -r requirements_dev.txt
run: uv pip install --system aioesphomeapi -c requirements.txt -r requirements_dev.txt
- name: Generate files
run: script/api_protobuf/api_protobuf.py
- name: Check for changes

View File

@@ -39,7 +39,11 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Generate cache-key
id: cache-key
run: echo key="${{ hashFiles('requirements.txt', 'requirements_dev.txt', 'requirements_test.txt', '.pre-commit-config.yaml') }}" >> $GITHUB_OUTPUT
# PROBE: salt prefix forces every venv-cache restore in this
# workflow run to miss so the uv install path from #16451 is
# actually exercised across Linux/macOS/Windows x 3.11/3.13/3.14.
# DO NOT MERGE -- remove this salt before landing.
run: echo key="uvprobe-${{ hashFiles('requirements.txt', 'requirements_dev.txt', 'requirements_test.txt', '.pre-commit-config.yaml') }}" >> $GITHUB_OUTPUT
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
@@ -52,14 +56,22 @@ jobs:
path: venv
# yamllint disable-line rule:line-length
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ steps.cache-key.outputs.key }}
- name: Set up uv
# Only needed on cache miss to populate the venv. ``uv pip install``
# detects the activated venv via ``VIRTUAL_ENV`` so downstream jobs
# that ``. venv/bin/activate`` see an identical layout.
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv venv
. venv/bin/activate
python --version
pip install -r requirements.txt -r requirements_dev.txt -r requirements_test.txt pre-commit
pip install -e .
uv pip install -r requirements.txt -r requirements_dev.txt -r requirements_test.txt pre-commit
uv pip install -e .
pylint:
name: Check pylint
@@ -351,14 +363,20 @@ jobs:
with:
path: venv
key: ${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{ needs.common.outputs.cache-key }}
- name: Set up uv
# Only needed on cache miss to populate the venv.
if: steps.cache-venv.outputs.cache-hit != 'true'
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
- name: Create Python virtual environment
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv venv
. venv/bin/activate
python --version
pip install -r requirements.txt -r requirements_test.txt
pip install -e .
uv pip install -r requirements.txt -r requirements_test.txt
uv pip install -e .
- name: Register matcher
run: echo "::add-matcher::.github/workflows/matchers/pytest.json"
- name: Run integration tests