Fix Docker setup and CI installation (#1212)

This commit is contained in:
Bas Nijholt 2025-06-15 21:31:51 -07:00 committed by GitHub
commit ded439e6f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 32 additions and 66 deletions

View file

@ -31,8 +31,11 @@ runs:
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ inputs.python-version }}
- name: Set up UV
uses: astral-sh/setup-uv@v6
- name: Install dependencies
shell: bash
run: |
uv venv --python ${{ inputs.python-version }}
./scripts/setup-dependencies
./scripts/setup-symlinks

View file

@ -14,46 +14,22 @@ jobs:
fail-fast: false
matrix:
include:
- python-version: "3.11"
core-version: "2023.7.3"
- python-version: "3.11"
core-version: "2023.8.4"
- python-version: "3.11"
core-version: "2023.9.3"
- python-version: "3.11"
core-version: "2023.10.5"
- python-version: "3.11"
core-version: "2023.11.3"
- python-version: "3.11"
core-version: "2023.12.4"
- python-version: "3.11"
core-version: "2024.1.6"
- python-version: "3.11"
core-version: "2024.2.5"
- python-version: "3.12"
core-version: "2024.3.3"
- python-version: "3.12"
core-version: "2024.4.4"
- python-version: "3.12"
core-version: "2024.5.5"
- python-version: "3.12"
core-version: "2024.6.4"
- python-version: "3.12"
core-version: "2024.7.4"
- python-version: "3.12"
core-version: "2024.8.3"
- python-version: "3.12"
core-version: "2024.9.3"
- python-version: "3.12"
core-version: "2024.10.4"
- python-version: "3.12"
core-version: "2024.11.3"
- python-version: "3.12"
core-version: "2024.12.5"
- python-version: "3.12"
core-version: "2025.1.0b5"
- python-version: "3.13"
core-version: "dev"
- core-version: "2024.12.5"
python-version: "3.12"
- core-version: "2025.1.4"
python-version: "3.12"
- core-version: "2025.2.5"
python-version: "3.13"
- core-version: "2025.3.4"
python-version: "3.13"
- core-version: "2025.4.4"
python-version: "3.13"
- core-version: "2025.5.3"
python-version: "3.13"
- core-version: "2025.6.1"
python-version: "3.13"
- core-version: "dev"
python-version: "3.13"
steps:
- name: Check out code from GitHub
uses: actions/checkout@v4

View file

@ -20,7 +20,7 @@ jobs:
- name: Install Home Assistant
uses: ./.github/workflows/install_dependencies
with:
python-version: "3.12"
python-version: "3.13"
- name: Install markdown-code-runner and README code dependencies
run: |

View file

@ -7,13 +7,7 @@
# Optionally build the image yourself with:
# docker build -t basnijholt/adaptive-lighting:latest .
FROM python:3.13-bookworm
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
git \
build-essential libssl-dev libffi-dev python3-dev \
&& rm -rf /var/lib/apt/lists/*
FROM ghcr.io/astral-sh/uv:debian
# Clone home-assistant/core
RUN git clone --depth 1 --branch dev https://github.com/home-assistant/core.git /core
@ -25,9 +19,12 @@ COPY . /app/
RUN ln -s /core /app/core && /app/scripts/setup-symlinks
# Install home-assistant/core dependencies
RUN mkdir -p /venv
ENV UV_PROJECT_ENVIRONMENT=/venv UV_PYTHON=3.13 PATH="/venv/bin:$PATH"
RUN uv venv
RUN /app/scripts/setup-dependencies
WORKDIR /core
WORKDIR /app/core
# Make 'custom_components/adaptive_lighting' imports available to tests
ENV PYTHONPATH="${PYTHONPATH}:/app"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -e
set -ex
cd "$(dirname "$0")/.."

View file

@ -2,24 +2,13 @@
set -ex
cd "$(dirname "$0")/.."
pip install uv
uv venv
source .venv/bin/activate
if grep -q 'mypy-dev==1.14.0a3' core/requirements_test.txt; then
# mypy-dev==1.14.0a3 seems to not be available anymore, HA 2024.12 is affected
sed -i 's/mypy-dev==1.14.0a3/mypy-dev==1.14.0a7/' core/requirements_test.txt
fi
uv pip install -r core/requirements.txt
if grep -q 'codecov' core/requirements_test.txt; then
# Older HA versions still have `codecov` in `requirements_test.txt`
# however it is removed from PyPI, so we cannot install it
sed -i '/codecov/d' core/requirements_test.txt
fi
if grep -q 'mypy-dev==1.10.0a3' core/requirements_test.txt; then
# mypy-dev==1.10.0a3 seems to not be available anymore, HA 2024.4 and 2024.5 are affected
sed -i 's/mypy-dev==1.10.0a3/mypy-dev==1.10.0b1/' core/requirements_test.txt
fi
uv pip install -r core/requirements_test.txt
uv pip install -e core/
uv pip install ulid-transform # this is in Adaptive-lighting's manifest.json
uv pip install $(python test_dependencies.py)

View file

@ -12,6 +12,7 @@ pip install \
pip \
ruff
uv venv --python 3.13
./scripts/setup-dependencies
./scripts/setup-symlinks
uv run pre-commit install-hooks

View file

@ -20,7 +20,7 @@ This command will download the Docker image from [the adaptive-lighting Docker H
If you prefer to build the image yourself, use the following command:
```bash
docker build -t basnijholt/adaptive-lighting:latest --no-cache .
docker build -t basnijholt/adaptive-lighting:latest --no-cache --progress=plain .
```
This might be necessary if the image on Docker Hub is outdated or if the [`test_dependencies.py`](../test_dependencies.py) file is updated.