Add woodpecker ci pipeline
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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 build pipeline issues: Ignored the typeless library imports nox and metadata_version since they are for development testing and too old of a python version respectively. Fixed two small typing errors for repetitions.
This commit is contained in:
parent
b0f8c48e99
commit
860bb1b01c
4 changed files with 67 additions and 4 deletions
60
.woodpecker.yml
Normal file
60
.woodpecker.yml
Normal file
|
@ -0,0 +1,60 @@
|
|||
# branches: main
|
||||
|
||||
pipeline:
|
||||
unit_tests:
|
||||
image: mquade/poetry:3.9-1.1.11
|
||||
commands:
|
||||
- poetry config virtualenvs.create false
|
||||
- poetry install
|
||||
- pytest
|
||||
|
||||
code_lint:
|
||||
image: mquade/poetry:3.9-1.1.11
|
||||
commands:
|
||||
- poetry config virtualenvs.create false
|
||||
- poetry install
|
||||
- pip install black
|
||||
- black .
|
||||
|
||||
static_analysis:
|
||||
image: mquade/poetry:3.9-1.1.11
|
||||
commands:
|
||||
- poetry config virtualenvs.create false
|
||||
- poetry install
|
||||
- pip install mypy
|
||||
- mypy .
|
||||
|
||||
build_dist:
|
||||
image: mquade/poetry:3.9-1.1.11
|
||||
commands:
|
||||
- poetry config virtualenvs.create false
|
||||
- poetry install
|
||||
- poetry build
|
||||
when:
|
||||
branch: main
|
||||
|
||||
gitea_release:
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_release_token
|
||||
base_url: https://git.martyoeh.me
|
||||
files: dist/*
|
||||
when:
|
||||
branch: main
|
||||
event: tag
|
||||
tag: v*
|
||||
|
||||
notify_matrix:
|
||||
image: plugins/matrix
|
||||
settings:
|
||||
homeserver: https://matrix.org
|
||||
roomid:
|
||||
from_secret: matrix_roomid
|
||||
userid:
|
||||
from_secret: matrix_userid
|
||||
accesstoken:
|
||||
from_secret: matrix_token
|
||||
when:
|
||||
status: [ success, failure ]
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import nox
|
||||
import nox # type: ignore
|
||||
|
||||
|
||||
@nox.session(python=["3.7", "3.8", "3.9"])
|
||||
|
|
|
@ -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__))
|
||||
|
|
|
@ -55,9 +55,10 @@ 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 "")
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue