Skip to content

Commit

Permalink
Merge pull request #2368 from MiczFlor/develop
Browse files Browse the repository at this point in the history
Release v2.8.0
  • Loading branch information
s-martin authored Nov 8, 2024
2 parents 550a258 + 91ba1aa commit 5044358
Show file tree
Hide file tree
Showing 37 changed files with 318 additions and 171 deletions.
27 changes: 24 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,12 +1,33 @@
[flake8]
max-line-length = 120
max-line-length = 127
ignore =
# continuation line over-indented for hanging indent
E126,
# continuation line over-indented for visual indent
E127,
# continuation line under-indented for visual indent
E128
E128,
# line break before binary operator
W503,
# We don't always want periods at the end of the first docstring line
D400,
# We dont rephrase to imperative mood
D401
per-file-ignores =
# Only in __init__files ignore imported but unused
# Not necessary, if __all__ is declared in __init__ file
# https://www.python.org/dev/peps/pep-0008/#id48
__init__.py:F401
__init__.py:F401,
components/smart-home-automation/MQTT-protocol/daemon_mqtt_client.py:W605,
components/controls/buttons_usb_encoder/*.py:E402
count = True
max-complexity = 12
statistics = True
show-source = True
filename = *.py,*.py.*
extend-exclude =
# Ignore dirs and files, which are from external sources
components/displays/HD44780-i2c/
scripts/Reader.py.pcsc
# Ignore helper scripts
scripts/helperscripts/
29 changes: 29 additions & 0 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Markdown Linting

on:
push:
branches-ignore:
- 'future3/**'
paths:
- '**.md'
pull_request:
branches:
- develop
- master
paths:
- '**.md'

jobs:
build:

runs-on: ubuntu-latest

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

- name: Linting markdown
uses: DavidAnson/markdownlint-cli2-action@v17
with:
config: .markdownlint-cli2.yaml
#continue-on-error: true
7 changes: 3 additions & 4 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ jobs:
pip install spidev
pip install -r requirements.txt
pip install -r requirements-GPIO.txt
- name: Setup flake8 annotations
uses: rbialon/flake8-annotations@v1
- name: Lint with flake8
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --filename=*.py,*.py.*
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --filename=*.py,*.py.*
flake8 --config .flake8
- name: Test with pytest
run: |
pytest --cov --cov-config=.coveragerc --cov-report xml
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test_docker_debian_codename_sub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ jobs:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
uses: docker/setup-qemu-action@v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.2.0
uses: docker/setup-buildx-action@v3.7.1
with:
# network=host driver-opt needed to push to local registry
driver-opts: network=host
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
# Build base image for debian version name. Layers will be cached and image pushes to local registry
- name: Build Image - Base
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
load: false
Expand All @@ -112,7 +112,7 @@ jobs:
# Build new image with updates packages based on base image. Layers will NOT be chached. Result is written to file.
- name: Build Image - Update
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
load: false
Expand Down Expand Up @@ -152,10 +152,10 @@ jobs:

steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3.0.0
uses: docker/setup-qemu-action@v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.2.0
uses: docker/setup-buildx-action@v3.7.1

- name: Artifact Download Docker Image
uses: actions/download-artifact@v4
Expand Down
56 changes: 56 additions & 0 deletions .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#
# markdownlint-cli2 configuration, see https://github.com/DavidAnson/markdownlint-cli2?tab=readme-ov-file#configuration
#

# rules, see https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md
config:
line-length: false
# ignore dollar signs
commands-show-output: false
no-trailing-punctuation: false
no-duplicate-heading:
siblings_only: true
# allow some tags we use for formatting
no-inline-html:
allowed_elements: [ "details", "summary" ]

# Include a custom rule package
#customRules:
# - markdownlint-rule-titlecase

# Fix no fixable errors
fix: false

# Define a custom front matter pattern
#frontMatter: "<head>[^]*<\/head>"

# Define glob expressions to use (only valid at root)
globs:
- "**.md"

# Define glob expressions to ignore
ignores:
- "htdocs/**"

# Use a plugin to recognize math
#markdownItPlugins:
# -
# - "@iktakahiro/markdown-it-katex"

# Additional paths to resolve module locations from
#modulePaths:
# - "./modules"

# Enable inline config comments
noInlineConfig: false

# Disable progress on stdout (only valid at root)
noProgress: true

# Use a specific formatter (only valid at root)
#outputFormatters:
# -
# - markdownlint-cli2-formatter-default

# Show found files on stdout (only valid at root)
showFound: true
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Phoniebox is a contactless jukebox for the Raspberry Pi, playing audio files, pl

Another bunch of wonderful designs!

To share your design or see all previous calendars and designs of the community visit the [Phoniebox Gallery](https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/GALLERY).
To share your design or see all previous calendars and designs of the community visit the [Phoniebox Gallery](https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/GALLERY).

![The Phoniebox Calendar](https://raw.githubusercontent.com/wiki/MiczFlor/RPi-Jukebox-RFID/img/gallery/calendar/latest-Phoniebox-Calendar.jpg "The Phoniebox Calendar")

Expand Down Expand Up @@ -141,7 +141,8 @@ There is a growing section of [troubleshooting](https://github.com/MiczFlor/RPi-

Here is a list of equipment needed. You can find a lot second hand online (save money and the planet). The links below lead to Amazon, not at all because I want to support them, but because their PartnerNet program helps to support the Phoniebox maintenance (a little bit...).

Note: depending on individual projects, the hardware requirements vary.
> [!NOTE]
> Depending on individual projects, the hardware requirements vary.
### Raspberry Pi

Expand Down Expand Up @@ -189,6 +190,8 @@ These are links to additional items, which will add an individual flavour to you
Special hardware is now organised in the folder [`components`](components/). If you have new hardware attached to your Phoniebox, please add to this library! It currently contains soundcards, displays, GPIO controls, RFID reader, smarthome integration.

## Support Phoniebox
<!-- markdownlint-disable MD033 -->
<!-- markdownlint-disable MD045 -->

<a href="https://www.buymeacoffee.com/MiczFlor" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg"></a>

Expand All @@ -211,6 +214,8 @@ See the Phoniebox code in action, watch this video and read the blog post from [

A new video screencast about

<!-- markdownlint-restore -->

**What makes this Phoniebox easy to install and use:**

* Runs on all Raspberry Pi models (1, 2, 3 and 4) and [Raspberry Zero](https://github.com/MiczFlor/RPi-Jukebox-RFID/issues/15).
Expand Down Expand Up @@ -243,7 +248,6 @@ See innovation, upcycling and creativity in the [Phoniebox Gallery](https://gith
![Caption](https://raw.githubusercontent.com/wiki/MiczFlor/RPi-Jukebox-RFID/img/gallery/KingKahn-20180101-Jukebox-01-h90.jpg)
![Caption](https://raw.githubusercontent.com/wiki/MiczFlor/RPi-Jukebox-RFID/img/gallery/hailogugo-20171222-h90-01.jpg)


## Sustainability

You might be surprised how easy and affordable you can get a RaspberryPi or an "appropriate" housing for your Phoniebox **second hand**. Think about the planet before you buy a new one.
Expand Down
12 changes: 6 additions & 6 deletions ci/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Base Target to build and install all needed base configuration and packages. Specifie the needed platform with the docker '--platform XXX' option
ARG DEBIAN_CODENAME=bullseye
ARG BASE_TEST_IMAGE=test-code
FROM debian:${DEBIAN_CODENAME}-slim as base
FROM debian:${DEBIAN_CODENAME}-slim AS base
ARG DEBIAN_CODENAME

ENV DOCKER_RUNNING=true
Expand Down Expand Up @@ -34,7 +34,7 @@ RUN export DEBIAN_FRONTEND=noninteractive \
# ------

# Base Target for setting up the default user. user can be selected with the docker '--user YYY' option
FROM base as user
FROM base AS user
ARG USER=pi
ARG USER_GROUP=$USER

Expand All @@ -50,7 +50,7 @@ RUN groupadd --gid 1000 $USER_GROUP \
####### Code Targets #######

# Target for adding code from the repo. Set Default User
FROM user as code
FROM user AS code

COPY --chown=$USER:$USER_GROUP --chmod=770 . /code
WORKDIR /code
Expand All @@ -63,7 +63,7 @@ USER $USER
####### Test Targets #######

# Target for setting up an alternativ user 'hans:wurst'. user can be selected with the docker '--user YYY' option
FROM user as test-user
FROM user AS test-user

ENV TEST_USER_GROUP=test

Expand All @@ -79,7 +79,7 @@ RUN export USER_ALT=hans \


# Target for adding envs and scripts from the repo to test installation
FROM test-user as test-code
FROM test-user AS test-code
ARG GIT_BRANCH
ARG GIT_URL

Expand All @@ -104,7 +104,7 @@ COPY --chown=root:$TEST_USER_GROUP --chmod=770 scripts/installscripts/tests/*.sh


# Target for applying latest updates (should not be cached!)
FROM $BASE_TEST_IMAGE as test-update
FROM $BASE_TEST_IMAGE AS test-update
RUN export DEBIAN_FRONTEND=noninteractive \
&& apt-get update \
&& apt-get -y upgrade \
Expand Down
33 changes: 21 additions & 12 deletions ci/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,42 @@ This is a work in progress so expect things to fail or being flaky.
* Flash its sd card with **Raspberry Pi OS lite**
* use raspi-config to resize the filesystem to the whole sd card (menu: 7 -> A1)
* install some tools and reboot:
```bash

```bash
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get -y install docker.io git
sudo gpasswd -a pi docker
sudo reboot
```
```

* login to your RPi
* clone the repo and cd into its local clone:
```bash

```bash
cd /home/pi/
# optional: change to your fork appropriately
git clone https://github.com/MiczFlor/RPi-Jukebox-RFID.git
cd RPi-Jukebox-RFID/
# optional: switch to another branch
git checkout <branch_name>
```
```

* build the docker image:

```bash
docker build -t rpi-jukebox-rfid:debian-latest -f ci/Dockerfile.debian --platform=linux/arm/v7 --target=code .
```
* additional arguments
* for builds
- on normal PCs use `--platform=linux/amd64`
- on a raspberry pi use `--platform=linux/arm/v7`
* to use a different debian version as base add parameter `--build-arg="DEBIAN_CODENAME=<code_name>"` (<code_name> = e.g. buster, bullseye, ...).

* additional arguments
* for builds
* on normal PCs use `--platform=linux/amd64`
* on a raspberry pi use `--platform=linux/arm/v7`
* to use a different debian version as base add parameter `--build-arg="DEBIAN_CODENAME=<code_name>"` (<code_name> = e.g. buster, bullseye, ...).

* get something to drink or eat
* run the freshly built docker image and start testing. For example:

```bash
docker run --rm -ti rpi-jukebox-rfid:debian-latest /bin/bash
cd /home/pi/
Expand All @@ -48,12 +55,14 @@ This is a work in progress so expect things to fail or being flaky.
bash GIT_URL=https://github.com/MiczFlor/RPi-Jukebox-RFID.git GIT_BRANCH=main install-jukebox.sh
```

NOTE: Get familiar with docker and its flags - `--rm` for example will remove the
container after you log out of it and all changes will be lost.
> [!NOTE]
> Get familiar with docker and its flags - `--rm` for
> example will remove the
> container after you log out of it and all changes will be lost.

### mount hosts code as volume

The created image now contains all the code in the directory `/code` - if you do not want to rebuild the image after each code-change you can 'mount' the RPi's code version into the container.
The created image now contains all the code in the directory `/code` - if you do not want to rebuild the image after each code-change you can 'mount' the RPi's code version into the container.
Add `-w /code -v $PWD:/code` to the `docker run` parameter.
In that way every change to the code in the container will be available on the RPi as well as vice versa.
Loading

0 comments on commit 5044358

Please sign in to comment.