Skip to content

Commit

Permalink
Merge pull request #3 from max-pfeiffer/feature/pre_commit_handlers
Browse files Browse the repository at this point in the history
Feature/pre commit handlers
  • Loading branch information
max-pfeiffer authored Jan 26, 2024
2 parents eba7f4f + fe4a58b commit 161b4dd
Show file tree
Hide file tree
Showing 9 changed files with 240 additions and 7 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ jobs:
run: |
poetry install --no-interaction --no-root
- name: Run ruff
working-directory: ./backend
run: |
source .venv/bin/activate
ruff check .
source backend/.venv/bin/activate
ruff check --config backend/pyproject.toml backend
run-tests:
needs: code-quality
Expand Down
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-ast
- id: check-merge-conflict
- id: detect-private-key
- id: check-added-large-files
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.14
hooks:
- id: ruff
args: ["--config", "backend/pyproject.toml", "backend"]
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![codecov](https://codecov.io/gh/max-pfeiffer/irrigation-pi/graph/badge.svg?token=Tk9STeqlPn)](https://codecov.io/gh/max-pfeiffer/irrigation-pi)
![pipeline workflow](https://github.com/max-pfeiffer/irrigation-pi/actions/workflows/pipeline.yml/badge.svg)

# Irrigation Pi
Create an irrigation system with your Raspberry Pi
This web application turns your [Raspberry Pi](https://www.raspberrypi.com/) into an irrigation system.

There are several relay HATs vom various manufactures available for the [Raspberry Pi](https://www.raspberrypi.com/).
This application support currently the following boards:
* [Waveshare RPi Relay Board](https://www.waveshare.com/wiki/RPi_Relay_Board) (3 relays)

Contributions for other boards are warmly welcome.

## Features
* Add schedules for switching the relays
* Relays are switches automatically according to the schedules

## Installation
todo

Binary file added backend/sqlite_db/sqlite.db
Binary file not shown.
1 change: 1 addition & 0 deletions backend/tests/unit/test_relay_services.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Tests for services."""
from app.adapters.waveshare import WaveshareRpiRelayBoardAdapter
from app.services.relay import switch_relay_off, switch_relay_on

from tests.fake_objects import FakeRelay


Expand Down
3 changes: 1 addition & 2 deletions backend/tests/unit/test_trigger_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
from random import randint

import pytest
from apscheduler import AsyncScheduler, Schedule

from app.scheduling import Repeat
from app.services.trigger import add_trigger, add_triggers, create_trigger_data
from apscheduler import AsyncScheduler, Schedule


@pytest.mark.parametrize("repeat", Repeat)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Tests for the Waveshare board adapter."""
import pytest

from app.adapters.waveshare import WaveshareRpiRelayBoardAdapter

from tests.fake_objects import FakeRelay


Expand Down
190 changes: 190 additions & 0 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
name = "Irrigation Pi"
version = "0.1.0"
description = ""
authors = ["Max Pfeiffer <max@maxpfeiffer.ch>"]
license = "MIT"
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"
pre-commit = "3.6.0"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

0 comments on commit 161b4dd

Please sign in to comment.