Skip to content
Open
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
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.coverage
.dockerignore
.env
.env.example
.git
.github
.gitignore
.pytest_cache
.vscode
compose.yml
Dockerfile
htmlcov
LICENSE
README.md
setup.cfg
tests
14 changes: 10 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
DB_DATABASE=heat-pump
DB_HOST=127.0.0.1
DB_USER=root
DB_PASSWORD=
MYSQL_DATABASE=sepicker
MYSQL_HOST=127.0.0.1
MYSQL_USER=root
MYSQL_PASSWORD=

MQTT_HOST=127.0.0.1
MQTT_PORT=1883
MQTT_TOPIC=sepicker
MQTT_USER=
MQTT_PASSWORD=
11 changes: 5 additions & 6 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
time: "04:00"
open-pull-requests-limit: 10
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
19 changes: 11 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@ name: CI

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

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
python-version: 3.13
cache: "pipenv"
- name: Install pipenv
run: curl https://raw.githubusercontent.com/pypa/pipenv/master/get-pipenv.py | python
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pipenv
pipenv install --dev
- name: Lint
run: pipenv run lint
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish

on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: ${{ github.event_name != 'pull_request' }}
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# syntax=docker/dockerfile:1

ARG PYTHON_VERSION=3.13
FROM python:${PYTHON_VERSION}-alpine

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

WORKDIR /usr/src/app

RUN pip install --no-cache-dir pipenv

COPY Pipfile Pipfile.lock .

RUN pipenv install --system --deploy

COPY . .

RUN crontab crontab

CMD ["crond", "-f", "-l", "2"]
7 changes: 5 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ flake8-bugbear = "*"
pep8-naming = "*"
pytest = "*"
pytest-cov = "*"
pytest-mock = "*"
freezegun = "*"

[packages]
python-can = "*"
pyyaml = "*"
mysql-connector = "*"
mysql-connector-python = "*"
python-dotenv = "*"
paho-mqtt = "*"

[requires]
python_version = "3.11"
python_version = "3.13"

[scripts]
lint = "flake8"
Expand Down
Loading