Skip to content

Commit

Permalink
Bufixes and clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
crashdump committed Jul 15, 2022
1 parent 70acfcb commit 80cdce9
Show file tree
Hide file tree
Showing 23 changed files with 1,154 additions and 427 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,32 @@ jobs:
poetry run python -m coverage report -m;
poetry run python -m coverage xml
env:
PYTHONPATH: "src/"
PYTHONPATH: "src/"
build:
name: "build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to Github Packages
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build image and push to Docker Hub and GitHub Container Registry
uses: docker/build-push-action@v2
with:
tags: ghcr.io/crashdump/selene:latest
push: false
# build on feature branches, push only on main branch
# push: ${{ github.ref == 'refs/heads/main' }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.DS_Store
.idea
.coverage
config.yaml

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#--- BUILDER

FROM python:3.10-alpine AS builder
WORKDIR /app
ADD pyproject.toml poetry.lock /app/

RUN apk add build-base libffi-dev libxml2-dev libxslt-dev
RUN pip install poetry && \
poetry config virtualenvs.in-project true && \
poetry install --no-ansi

#--- RUNNER

FROM python:3.10-alpine
WORKDIR /app

COPY --from=builder /app /app
ADD . /app

RUN apk add libxml2-dev libxslt-dev

RUN adduser app -h /app -u 1000 -g 1000 -DH
USER 1000

CMD /app/.venv/bin/python -m selene
#CMD /app/.venv/bin/python selene.py
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
build:
docker build -t selene .

run:
poetry run

test:
poetry run pytest
poetry run pytest

lint:
find . -type f -name "*.py" | xargs pylint
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ sharing it.

Turn on (or off) lights; a timer can be specified to revert after a while.

You will need a user id on the Bridge, you can follow the steps [here](https://developers.meethue.com/develop/get-started-2/#so-lets-get-started) to get it.

## Spotify

Starts a playlist; a timer can be specified to turn the music off after a while.
Expand Down Expand Up @@ -43,4 +45,12 @@ sudo udevadm control --reload-rules`

# How to run

`poetry run`
1. Configure

Tweak and copy the example configuration file from `selene/config_default.yaml` to `$XDG_CONFIG_HOME/Selene/config.yaml`

2. Start

`poetry run`

3. Press a button and enjoy!
Loading

0 comments on commit 80cdce9

Please sign in to comment.