Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ghcr.io/astral-sh/uv:0.13.5@sha256:32a7bb39b496babbd997b0a39a4d66c126bdaf5661b302bf6f06abda8deca6ff AS uv

FROM mcr.microsoft.com/devcontainers/python:3.13@sha256:5ea7e72d3c1beb6aefdfea8001483345c39af4898e22f2c543deb6a00802ede4

COPY --from=uv /uv /uvx /usr/local/bin/

# Pre-create the cache mount point so the named volume is owned by vscode.
RUN install -d -o vscode -g vscode /home/vscode/.cache /home/vscode/.cache/uv
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "python-thermia-genesis",
"build": {
"dockerfile": "Dockerfile"
},
"containerEnv": {
"UV_LINK_MODE": "copy",
"UV_PROJECT_ENVIRONMENT": "/home/vscode/.venv"
},
"mounts": [
"source=thermia-genesis-uv-cache,target=/home/vscode/.cache/uv,type=volume"
],
"postCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder} && uv sync && uv run prek install --overwrite",
"customizations": {
"vscode": {
"extensions": [
"charliermarsh.ruff",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.mypy-type-checker",
"ryanluker.vscode-coverage-gutters",
"tamasfe.even-better-toml",
"github.vscode-github-actions",
"github.vscode-pull-request-github"
],
"settings": {
"python.defaultInterpreterPath": "/home/vscode/.venv/bin/python",
"python.testing.pytestEnabled": true,
"editor.formatOnSave": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.organizeImports": "explicit"
}
}
}
}
}
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @kristoflemmens
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Bug report
description: Something does not work as expected
labels: [bug]
body:
- type: textarea
id: what
attributes:
label: What happened?
description: What did you expect, and what happened instead?
validations:
required: true
- type: input
id: model
attributes:
label: Heat pump model
placeholder: Calibra 7
validations:
required: true
- type: input
id: firmware
attributes:
label: Genesis firmware version
description: Shown on the display, or read from input registers 311–313.
placeholder: 17.1.11
validations:
required: true
- type: input
id: version
attributes:
label: thermia-genesis version
validations:
required: true
- type: textarea
id: dump
attributes:
label: Register dump or logs
description: Output of `thermia-genesis dump`, a traceback, or debug logs.
render: text
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Home Assistant integration
url: https://github.com/klconsultancy/ha-thermia-genesis/issues
about: Problems with entities or the config flow belong in the integration repository.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Feature request
description: Suggest a new capability
labels: [enhancement]
body:
- type: textarea
id: problem
attributes:
label: What problem would this solve?
validations:
required: true
- type: textarea
id: proposal
attributes:
label: Proposed solution
30 changes: 30 additions & 0 deletions .github/ISSUE_TEMPLATE/register.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Register or firmware support
description: A register is wrong or missing, or a firmware version is not supported
labels: [registers]
body:
- type: input
id: firmware
attributes:
label: Genesis firmware version
placeholder: 17.1.11
validations:
required: true
- type: input
id: model
attributes:
label: Heat pump model
validations:
required: true
- type: textarea
id: registers
attributes:
label: Affected registers
description: Register space, address, and what the documentation says versus what the pump reports.
validations:
required: true
- type: textarea
id: dump
attributes:
label: Register dump
description: Output of `thermia-genesis dump`.
render: json
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 2
updates:
- package-ecosystem: uv
directory: /
schedule:
interval: weekly
commit-message:
prefix: "build(deps)"
groups:
dev-dependencies:
dependency-type: development
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
commit-message:
prefix: "ci(deps)"
groups:
actions:
patterns: ["*"]
- package-ecosystem: docker
directory: /.devcontainer
schedule:
interval: weekly
commit-message:
prefix: "build(deps)"
10 changes: 10 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## What and why

<!-- What does this change, and why? Link the issue: "Closes #123". -->

## Checklist

- [ ] The test was written first and failed for the right reason before the implementation
- [ ] Coverage stays at 100%
- [ ] `docs/design.md` / `CONTEXT.md` updated if a design choice or domain term changed
- [ ] PR title follows Conventional Commits (`feat:`, `fix:`, `docs:`, ...)
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: CI

on:
push:
branches: [main]
pull_request:
merge_group:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Superseded PR runs are cancelled; every push to main is checked.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
lint:
name: Lint & type-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Dependabot bumps these separately; fail until they are aligned in the same PR.
- name: uv version is pinned consistently
run: |
docker=$(sed -nE 's|^FROM ghcr.io/astral-sh/uv:([0-9.]+)@.*|\1|p' .devcontainer/Dockerfile)
pyproject=$(sed -nE 's|^required-version = "==([0-9.]+)"$|\1|p' pyproject.toml)
hook=$(grep -A1 'astral-sh/uv-pre-commit' .pre-commit-config.yaml | sed -nE 's|^ *rev: ([0-9.]+)$|\1|p')
echo "Dockerfile: $docker, pyproject.toml: $pyproject, .pre-commit-config.yaml: $hook"
if [ -z "$docker" ] || [ "$docker" != "$pyproject" ] || [ "$docker" != "$hook" ]; then
echo "::error::uv versions differ: Dockerfile '$docker', pyproject.toml '$pyproject', .pre-commit-config.yaml '$hook'"
exit 1
fi
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
python-version: "3.13"
- run: uv sync --locked
- run: uv run ruff format --check
- run: uv run ruff check --output-format=github
- run: uv run mypy

test:
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
with:
python-version: ${{ matrix.python-version }}
- run: uv sync --locked
- run: uv run pytest

build:
name: Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
- run: uv build

dependency-review:
name: Dependency review
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
with:
fail-on-severity: moderate

# Single required status check for the branch ruleset.
ci-success:
name: CI success
if: always()
needs: [lint, test, build, dependency-review]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
17 changes: 17 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: PR title

on:
pull_request_target:
types: [opened, edited, synchronize, reopened]

permissions:
pull-requests: read

jobs:
conventional-commit:
name: Conventional commit title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79 changes: 79 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Release

on:
push:
branches: [main]

permissions:
contents: read

jobs:
release-please:
name: Release PR
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
# A GitHub App token instead of GITHUB_TOKEN, so CI runs on the release PR.
- uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
id: app-token
with:
client-id: ${{ vars.RELEASE_APP_CLIENT_ID }}
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
id: release
with:
token: ${{ steps.app-token.outputs.token }}

build:
name: Build distribution
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ needs.release-please.outputs.tag_name }}
persist-credentials: false
- uses: astral-sh/setup-uv@07a047e608db84b3d8c06cd9a7c7dcc9c355c18e # v10.3.2
- run: uv build
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dist
path: dist/

publish-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/thermia-genesis
permissions:
id-token: write
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true

publish-pypi:
name: Publish to PyPI
needs: publish-testpypi
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/thermia-genesis
permissions:
id-token: write
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
Loading
Loading