mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
Fix devcontainer and testing Dockerfile (#962)
* Fix permissions for `scripts/setup` * Add new script * Use script * Update Dockerfile * Rename and clone * Perms * Fix * fi
This commit is contained in:
parent
9eae1501d3
commit
2f31b42cb2
6 changed files with 33 additions and 26 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "basnijholt/adaptive_lighting",
|
||||
"image": "mcr.microsoft.com/vscode/devcontainers/python:0-3.11-bullseye",
|
||||
"postCreateCommand": "scripts/setup",
|
||||
"postCreateCommand": "scripts/setup-devcontainer",
|
||||
"forwardPorts": [
|
||||
8123
|
||||
],
|
||||
|
|
|
|||
|
|
@ -34,11 +34,4 @@ runs:
|
|||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
echo "::warning::### WARNING! Deprecation warnings muted with option '--use-pep517' please address this at some point in pytest.yaml. ###"
|
||||
pip install -r core/requirements.txt --use-pep517
|
||||
# because they decided to pull codecov the package from PyPI...
|
||||
sed -i '/codecov/d' core/requirements_test.txt
|
||||
pip install -r core/requirements_test.txt --use-pep517
|
||||
pip install -e core/ --use-pep517
|
||||
pip install ulid-transform # this is in Adaptive-lighting's manifest.json
|
||||
pip install $(python test_dependencies.py) --use-pep517
|
||||
./scripts/install_ha
|
||||
|
|
|
|||
13
Dockerfile
13
Dockerfile
|
|
@ -7,7 +7,7 @@
|
|||
# Optionally build the image yourself with:
|
||||
# docker build -t basnijholt/adaptive-lighting:latest .
|
||||
|
||||
FROM python:3.11-buster
|
||||
FROM python:3.12-bookworm
|
||||
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
|
|
@ -16,12 +16,7 @@ RUN apt-get update && \
|
|||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Clone home-assistant/core
|
||||
RUN git clone --depth 1 https://github.com/home-assistant/core.git /core
|
||||
|
||||
# Install home-assistant/core dependencies
|
||||
RUN pip3 install -r /core/requirements.txt --use-pep517 && \
|
||||
pip3 install -r /core/requirements_test.txt --use-pep517 && \
|
||||
pip3 install -e /core/ --use-pep517
|
||||
RUN git clone --depth 1 --branch dev https://github.com/home-assistant/core.git /core
|
||||
|
||||
# Copy the Adaptive Lighting repository
|
||||
COPY . /app/
|
||||
|
|
@ -32,8 +27,8 @@ RUN ln -s /app/custom_components/adaptive_lighting /core/homeassistant/component
|
|||
# For test_dependencies.py
|
||||
ln -s /core /app/core
|
||||
|
||||
# Install dependencies of components that Adaptive Lighting depends on
|
||||
RUN pip3 install $(python3 /app/test_dependencies.py) --use-pep517
|
||||
# Install home-assistant/core dependencies
|
||||
RUN /app/scripts/install_ha
|
||||
|
||||
WORKDIR /core
|
||||
|
||||
|
|
|
|||
16
scripts/install_ha
Executable file
16
scripts/install_ha
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
pip install -r core/requirements.txt --use-pep517
|
||||
|
||||
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
|
||||
pip install -r core/requirements_test.txt --use-pep517
|
||||
|
||||
pip install -e core/ --use-pep517
|
||||
pip install ulid-transform # this is in Adaptive-lighting's manifest.json
|
||||
pip install $(python test_dependencies.py) --use-pep517
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
python3 -m pip install --requirement requirements.txt
|
||||
pre-commit install-hooks
|
||||
11
scripts/setup-devcontainer
Executable file
11
scripts/setup-devcontainer
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# Clone only if the folder doesn't exist
|
||||
if [[ ! -d "core" ]]; then
|
||||
git clone --depth 1 --branch dev https://github.com/home-assistant/core.git
|
||||
fi
|
||||
|
||||
./scripts/install_ha
|
||||
pre-commit install-hooks
|
||||
Loading…
Add table
Add a link
Reference in a new issue