Add continuous integration pipeline
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

Added basic continuous integration tests to run on any push:
On main branch, the python program is built.
On tagged commit, a gitea release is created.

Fixed first detected build pipeline issues:
Fixing mypy library stubs missing for some imported libraries.
Fixed two small typing errors for Repetitions.

The steps run on basic python containers, onto which the ci steps simply
install poetry.
This takes a little more processing time during pipeline running (~16s
per step),
but also gives a lot of flexibility in container usage.

Added script which assists in creating an automatic release by
extracting the current version and newest changes from the semantic
changelog.
This is then used in the gitea release preparation as title and
content of the release message.
The files built in the dist directory by poetry will be attached.
This commit is contained in:
Marty Oehme 2022-01-18 18:08:24 +01:00
parent b0f8c48e99
commit 03dd1a485d
Signed by: Marty
GPG key ID: B7538B8F50A1C800
6 changed files with 148 additions and 4 deletions

View file

@ -4,6 +4,6 @@ import sys
try:
from importlib.metadata import version as metadata_version
except ImportError:
from importlib_metadata import version as metadata_version
from importlib_metadata import version as metadata_version # type: ignore
__version__ = str(metadata_version(__name__))

View file

@ -55,10 +55,11 @@ def habit_list_add_ids(c: sqlite3.Cursor, habitlist: list[Habit]) -> dict[int, H
:return habit_id_dict: The habit collection as a dict with the keys
consisting of the habit's sqlite database ID.
"""
with_id = {}
with_id: dict[int, Habit] = {}
for h in habitlist:
sql_id = fetch_habit_id(c, h.uuid or "")
with_id[sql_id] = h
if sql_id is not None:
with_id[sql_id] = h
return with_id
@ -74,6 +75,8 @@ def fetch_habit_id(cursor: sqlite3.Cursor, uuid: str) -> Optional[int]:
if id is not None:
return id[0]
return None
def add_to_database(
cursor: sqlite3.Cursor, habits: dict[int, Habit], repetition: Repetition