mirror of
https://github.com/home-assistant/core.git
synced 2026-05-27 19:25:18 +02:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 51cddb88f5 | |||
| 748a9842af | |||
| 55786dbdfc | |||
| e88c03a437 | |||
| dbc0dc1ea6 | |||
| 31271876bf | |||
| d5c31332b5 | |||
| 3f0c93c26c | |||
| 07ed913ba2 | |||
| b7905b163f | |||
| c712b07da3 |
@@ -0,0 +1,42 @@
|
|||||||
|
name: Set up uv and managed Python
|
||||||
|
description: >-
|
||||||
|
Pins uv (avoids the raw.githubusercontent.com manifest fetch on cache miss)
|
||||||
|
and proactively installs the requested Python so cached venvs created with
|
||||||
|
`uv venv` resolve their interpreter symlinks in jobs that only restore the
|
||||||
|
venv. setup-uv alone only sets UV_PYTHON, it does not actually fetch the
|
||||||
|
interpreter until uv first uses it, so jobs that just activate the venv
|
||||||
|
blow up with broken symlinks on cache hit.
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
python-version:
|
||||||
|
description: The Python version uv should install and use.
|
||||||
|
required: true
|
||||||
|
uv-version:
|
||||||
|
description: The uv version setup-uv should install.
|
||||||
|
required: true
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
python-version:
|
||||||
|
description: The Python version uv reports as installed.
|
||||||
|
value: ${{ steps.uv.outputs.python-version }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
- name: Set up uv
|
||||||
|
id: uv
|
||||||
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
||||||
|
with:
|
||||||
|
version: ${{ inputs.uv-version }}
|
||||||
|
python-version: ${{ inputs.python-version }}
|
||||||
|
# Persist astral's managed Python across jobs so 'uv venv' below is
|
||||||
|
# fast on the second job onwards.
|
||||||
|
cache-python: true
|
||||||
|
# Lint-only and codegen jobs touch no Python deps, so the post-step
|
||||||
|
# cache save would otherwise abort the job.
|
||||||
|
ignore-nothing-to-cache: true
|
||||||
|
- name: Install Python interpreter
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
PYTHON_VERSION: ${{ inputs.python-version }}
|
||||||
|
run: uv python install "${PYTHON_VERSION}"
|
||||||
+45
-47
@@ -37,7 +37,7 @@ on:
|
|||||||
type: boolean
|
type: boolean
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CACHE_VERSION: 3
|
CACHE_VERSION: 4
|
||||||
MYPY_CACHE_VERSION: 1
|
MYPY_CACHE_VERSION: 1
|
||||||
HA_SHORT_VERSION: "2026.6"
|
HA_SHORT_VERSION: "2026.6"
|
||||||
ADDITIONAL_PYTHON_VERSIONS: "[]"
|
ADDITIONAL_PYTHON_VERSIONS: "[]"
|
||||||
@@ -89,6 +89,8 @@ jobs:
|
|||||||
mariadb_groups: ${{ steps.info.outputs.mariadb_groups }}
|
mariadb_groups: ${{ steps.info.outputs.mariadb_groups }}
|
||||||
postgresql_groups: ${{ steps.info.outputs.postgresql_groups }}
|
postgresql_groups: ${{ steps.info.outputs.postgresql_groups }}
|
||||||
python_versions: ${{ steps.info.outputs.python_versions }}
|
python_versions: ${{ steps.info.outputs.python_versions }}
|
||||||
|
default_python: ${{ steps.info.outputs.default_python }}
|
||||||
|
uv_version: ${{ steps.info.outputs.uv_version }}
|
||||||
test_full_suite: ${{ steps.info.outputs.test_full_suite }}
|
test_full_suite: ${{ steps.info.outputs.test_full_suite }}
|
||||||
test_group_count: ${{ steps.info.outputs.test_group_count }}
|
test_group_count: ${{ steps.info.outputs.test_group_count }}
|
||||||
test_groups: ${{ steps.info.outputs.test_groups }}
|
test_groups: ${{ steps.info.outputs.test_groups }}
|
||||||
@@ -235,6 +237,11 @@ jobs:
|
|||||||
echo "postgresql_groups=${postgresql_groups}" >> $GITHUB_OUTPUT
|
echo "postgresql_groups=${postgresql_groups}" >> $GITHUB_OUTPUT
|
||||||
echo "python_versions: ${all_python_versions}"
|
echo "python_versions: ${all_python_versions}"
|
||||||
echo "python_versions=${all_python_versions}" >> $GITHUB_OUTPUT
|
echo "python_versions=${all_python_versions}" >> $GITHUB_OUTPUT
|
||||||
|
echo "default_python: ${default_python}"
|
||||||
|
echo "default_python=${default_python}" >> $GITHUB_OUTPUT
|
||||||
|
uv_version=$(grep '^uv==' requirements.txt | cut -d'=' -f3)
|
||||||
|
echo "uv_version: ${uv_version}"
|
||||||
|
echo "uv_version=${uv_version}" >> $GITHUB_OUTPUT
|
||||||
echo "test_full_suite: ${test_full_suite}"
|
echo "test_full_suite: ${test_full_suite}"
|
||||||
echo "test_full_suite=${test_full_suite}" >> $GITHUB_OUTPUT
|
echo "test_full_suite=${test_full_suite}" >> $GITHUB_OUTPUT
|
||||||
echo "integrations_glob: ${integrations_glob}"
|
echo "integrations_glob: ${integrations_glob}"
|
||||||
@@ -344,12 +351,12 @@ jobs:
|
|||||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up uv and Python ${{ matrix.python-version }}
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
check-latest: true
|
|
||||||
- name: Restore base Python virtual environment
|
- name: Restore base Python virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -397,21 +404,13 @@ jobs:
|
|||||||
libudev-dev
|
libudev-dev
|
||||||
version: ${{ env.APT_CACHE_VERSION }}
|
version: ${{ env.APT_CACHE_VERSION }}
|
||||||
execute_install_scripts: true
|
execute_install_scripts: true
|
||||||
- name: Read uv version from requirements.txt
|
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
id: read-uv-version
|
|
||||||
run: |
|
|
||||||
echo "version=$(grep '^uv==' requirements.txt | cut -d'=' -f3)" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: Set up uv
|
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
|
||||||
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
||||||
with:
|
|
||||||
version: ${{ steps.read-uv-version.outputs.version }}
|
|
||||||
- name: Create Python virtual environment
|
- name: Create Python virtual environment
|
||||||
if: steps.cache-venv.outputs.cache-hit != 'true'
|
if: steps.cache-venv.outputs.cache-hit != 'true'
|
||||||
id: create-venv
|
id: create-venv
|
||||||
|
env:
|
||||||
|
PYTHON_VERSION: ${{ steps.python.outputs.python-version }}
|
||||||
run: |
|
run: |
|
||||||
python -m venv venv
|
uv venv venv --python "${PYTHON_VERSION}"
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
python --version
|
python --version
|
||||||
uv pip install -r requirements.txt
|
uv pip install -r requirements.txt
|
||||||
@@ -419,7 +418,6 @@ jobs:
|
|||||||
uv pip install -e . --config-settings editable_mode=compat
|
uv pip install -e . --config-settings editable_mode=compat
|
||||||
- name: Dump pip freeze
|
- name: Dump pip freeze
|
||||||
run: |
|
run: |
|
||||||
python -m venv venv
|
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
python --version
|
python --version
|
||||||
uv pip freeze >> pip_freeze.txt
|
uv pip freeze >> pip_freeze.txt
|
||||||
@@ -480,10 +478,10 @@ jobs:
|
|||||||
version: ${{ env.APT_CACHE_VERSION }}
|
version: ${{ env.APT_CACHE_VERSION }}
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
python-version-file: ".python-version"
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
check-latest: true
|
python-version: ${{ needs.info.outputs.default_python }}
|
||||||
- name: Restore full Python virtual environment
|
- name: Restore full Python virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -517,10 +515,10 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
python-version-file: ".python-version"
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
check-latest: true
|
python-version: ${{ needs.info.outputs.default_python }}
|
||||||
- name: Restore full Python virtual environment
|
- name: Restore full Python virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -553,10 +551,10 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
python-version-file: ".python-version"
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
check-latest: true
|
python-version: ${{ needs.info.outputs.default_python }}
|
||||||
- name: Run gen_copilot_instructions.py
|
- name: Run gen_copilot_instructions.py
|
||||||
run: |
|
run: |
|
||||||
python -m script.gen_copilot_instructions validate
|
python -m script.gen_copilot_instructions validate
|
||||||
@@ -608,10 +606,10 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
check-latest: true
|
|
||||||
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -659,10 +657,10 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
python-version-file: ".python-version"
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
check-latest: true
|
python-version: ${{ needs.info.outputs.default_python }}
|
||||||
- name: Restore full Python virtual environment
|
- name: Restore full Python virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -712,10 +710,10 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
python-version-file: ".python-version"
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
check-latest: true
|
python-version: ${{ needs.info.outputs.default_python }}
|
||||||
- name: Restore full Python virtual environment
|
- name: Restore full Python virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -763,10 +761,10 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
python-version-file: ".python-version"
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
check-latest: true
|
python-version: ${{ needs.info.outputs.default_python }}
|
||||||
- name: Generate partial mypy restore key
|
- name: Generate partial mypy restore key
|
||||||
id: generate-mypy-key
|
id: generate-mypy-key
|
||||||
run: |
|
run: |
|
||||||
@@ -840,10 +838,10 @@ jobs:
|
|||||||
execute_install_scripts: true
|
execute_install_scripts: true
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
python-version-file: ".python-version"
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
check-latest: true
|
python-version: ${{ needs.info.outputs.default_python }}
|
||||||
- name: Restore full Python virtual environment
|
- name: Restore full Python virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -905,10 +903,10 @@ jobs:
|
|||||||
execute_install_scripts: true
|
execute_install_scripts: true
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
check-latest: true
|
|
||||||
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -1047,10 +1045,10 @@ jobs:
|
|||||||
execute_install_scripts: true
|
execute_install_scripts: true
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
check-latest: true
|
|
||||||
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -1203,10 +1201,10 @@ jobs:
|
|||||||
version: ${{ env.APT_CACHE_VERSION }}
|
version: ${{ env.APT_CACHE_VERSION }}
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
check-latest: true
|
|
||||||
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
@@ -1371,10 +1369,10 @@ jobs:
|
|||||||
execute_install_scripts: true
|
execute_install_scripts: true
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
id: python
|
id: python
|
||||||
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
uses: ./.github/actions/setup-uv-python
|
||||||
with:
|
with:
|
||||||
|
uv-version: ${{ needs.info.outputs.uv_version }}
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
check-latest: true
|
|
||||||
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
- name: Restore full Python ${{ matrix.python-version }} virtual environment
|
||||||
id: cache-venv
|
id: cache-venv
|
||||||
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
|
||||||
|
|||||||
Reference in New Issue
Block a user