Skip to content

Commit

Permalink
Merge pull request #2137 from MiczFlor/future3/develop
Browse files Browse the repository at this point in the history
Release v3.4.0
  • Loading branch information
pabera authored Dec 11, 2023
2 parents c0d5a20 + b8b68c8 commit 468b61d
Show file tree
Hide file tree
Showing 75 changed files with 1,886 additions and 662 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# Application
docker
docs
installation
shared

# webapp
Expand Down
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ per-file-ignores =
count = True
max-complexity = 12
statistics = True
filename = *.py,*.py.*
filename = *.py
extend-exclude =
# Ignore all scratch development directories
scratch*,
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Otherwise the output of `cat /etc/os-release`
i.e. `master`
the following command will help with that
`cd /home/pi/RPi-Jukebox-RFID/ && git status | head -2`
`cd ~/RPi-Jukebox-RFID/ && git status | head -2`
-->

### Installscript
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/pythonpackage_future3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ on:
- 'future3/**'
paths:
- '**.py'
- '**.py.*'
pull_request:
branches:
- 'future3/**'
paths:
- '**.py'
- '**.py.*'

jobs:
build:
Expand All @@ -21,7 +19,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
Expand All @@ -41,8 +39,27 @@ jobs:
pip3 install -r src/jukebox/components/rfid/hardware/pn532_i2c_py532/requirements.txt
pip3 install -r src/jukebox/components/rfid/hardware/rdm6300_serial/requirements.txt
pip3 install -r src/jukebox/components/rfid/hardware/rc522_spi/requirements.txt
- name: Run pytest
run: |
./run_pytest.sh --cov --cov-report xml
- name: Report to Coveralls (parallel)
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: coverage.xml
format: cobertura
parallel: true
- name: Lint with flake8
run: |
pip3 install flake8
# Stop the build if linting fails
./run_flake8.sh
finish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Close parallel build
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
186 changes: 186 additions & 0 deletions .github/workflows/test_docker_debian_codename_sub_v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
name: Subworkflow Test Install Scripts Debian V3

on:
workflow_call:
inputs:
debian_codename:
required: true
type: string
platform:
required: true
type: string
docker_image_name:
required: false
type: string
default: rpi-jukebox-rfid-v3
cache_scope:
required: false
type: string
default: ${{ github.ref }}-test-debian-v3
local_registry_port:
required: false
type: number
default: 5000
runs_on:
required: false
type: string
default: ubuntu-latest

env:
TEST_USER_NAME: testuser
TEST_USER_GROUP: testusergroup

# let only one instance run the test so cache is not corrupted.
# cancel already running instances as only the last run will be relevant
concurrency:
group: ${{ inputs.cache_scope }}-${{ inputs.debian_codename }}-${{ inputs.platform }}
cancel-in-progress: true

jobs:

# Build container for test execution
build:
runs-on: ${{ inputs.runs_on }}

outputs:
cache_key: ${{ steps.vars.outputs.cache_key }}
image_file_name: ${{ steps.vars.outputs.image_file_name }}
image_tag_name: ${{ steps.vars.outputs.image_tag_name }}

# create local docker registry to use locally build images
services:
registry:
image: registry:2
ports:
- ${{ inputs.local_registry_port }}:5000

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]
with:
# network=host driver-opt needed to push to local registry
driver-opts: network=host

- name: Set Output pre-vars
id: pre-vars
env:
DEBIAN_CODENAME: ${{ inputs.debian_codename }}
DOCKER_IMAGE_NAME: ${{ inputs.docker_image_name }}
CACHE_SCOPE: ${{ inputs.cache_scope }}
PLATFORM: ${{ inputs.platform }}
run: |
PLATFORM=${PLATFORM////_}
echo "image_tag_name=${{ env.DOCKER_IMAGE_NAME }}:${{ env.DEBIAN_CODENAME }}-${PLATFORM}-test" >> $GITHUB_OUTPUT
echo "image_file_name=${{ env.DOCKER_IMAGE_NAME }}-${{ env.DEBIAN_CODENAME }}-${PLATFORM}.tar" >> $GITHUB_OUTPUT
echo "cache_scope=${{ env.CACHE_SCOPE }}-${{ env.DEBIAN_CODENAME }}-${PLATFORM}" >> $GITHUB_OUTPUT
- name: Set Output vars
id: vars
env:
LOCAL_REGISTRY_PORT: ${{ inputs.local_registry_port }}
run: |
echo "image_tag_name=${{ steps.pre-vars.outputs.image_tag_name }}" >> $GITHUB_OUTPUT
echo "image_tag_name_local_base=localhost:${{ env.LOCAL_REGISTRY_PORT }}/${{ steps.pre-vars.outputs.image_tag_name }}-base" >> $GITHUB_OUTPUT
echo "image_file_name=${{ steps.pre-vars.outputs.image_file_name }}" >> $GITHUB_OUTPUT
echo "image_file_path=./${{ steps.pre-vars.outputs.image_file_name }}" >> $GITHUB_OUTPUT
echo "cache_scope=${{ steps.pre-vars.outputs.cache_scope }}" >> $GITHUB_OUTPUT
echo "cache_key=${{ steps.pre-vars.outputs.cache_scope }}-${{ github.sha }}#${{ github.run_attempt }}" >> $GITHUB_OUTPUT
# 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
with:
context: .
load: false
push: true
file: ./ci/ci-debian.Dockerfile
target: test-code
platforms: ${{ inputs.platform }}
tags: ${{ steps.vars.outputs.image_tag_name_local_base }}
cache-from: type=gha,scope=${{ steps.vars.outputs.cache_scope }}
cache-to: type=gha,mode=max,scope=${{ steps.vars.outputs.cache_scope }}
build-args: |
DEBIAN_CODENAME=${{ inputs.debian_codename }}
USER_NAME=${{ env.TEST_USER_NAME }}
USER_GROUP=${{ env.TEST_USER_GROUP }}
GIT_BRANCH=${{ github.head_ref || github.ref_name }}
GIT_USER=${{ github.event.pull_request.head.user.login || github.repository_owner }}
# 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
with:
context: .
load: false
push: false
file: ./ci/ci-debian.Dockerfile
target: test-update
platforms: ${{ inputs.platform }}
tags: ${{ steps.vars.outputs.image_tag_name }}
cache-from: type=gha,scope=${{ steps.vars.outputs.cache_scope }}
# DON'T use 'cache-to' here as the layer is then cached and this build would be useless
outputs: type=docker,dest=${{ steps.vars.outputs.image_file_path }}
build-args: |
BASE_TEST_IMAGE=${{ steps.vars.outputs.image_tag_name_local_base }}
- name: Artifact Upload Docker Image
uses: actions/upload-artifact@v3
with:
name: ${{ steps.vars.outputs.image_file_name }}
path: ${{ steps.vars.outputs.image_file_path }}
retention-days: 1


# Run tests with build image
test:
needs: [build]
runs-on: ${{ inputs.runs_on }}

strategy:
fail-fast: false
matrix:
test_script: ['run_install_common.sh', 'run_install_faststartup.sh', 'run_install_webapp_local.sh', 'run_install_webapp_download.sh', 'run_install_libzmq_local.sh']

steps:
- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Artifact Download Docker Image
uses: actions/download-artifact@v3
with:
name: ${{ needs.build.outputs.image_file_name }}

- name: Load Docker Image
run: |
docker load --input ${{ needs.build.outputs.image_file_name }}
# Run test
- name: Run Test ${{ inputs.debian_codename }}-${{ env.TEST_USER_NAME }}-${{ matrix.test_script }}
uses: tj-actions/docker-run@v2
with:
image: ${{ needs.build.outputs.image_tag_name }}
options: --platform ${{ inputs.platform }} --user ${{ env.TEST_USER_NAME }} --init
name: ${{ matrix.test_script }}
args: |
./${{ matrix.test_script }}
# cleanup after test execution
cleanup:
# run only if tests didn't fail: keep the artifact to make job reruns possible
if: ${{ !failure() }}
needs: [build, test]
runs-on: ${{ inputs.runs_on }}

steps:
- name: Artifact Delete Docker Image
uses: geekyeggo/delete-artifact@v2
with:
name: ${{ needs.build.outputs.image_file_name }}
33 changes: 33 additions & 0 deletions .github/workflows/test_docker_debian_v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test Install Scripts Debian v3

on:
schedule:
# run at 17:00 every sunday
- cron: '0 17 * * 0'
push:
pull_request:
# The branches below must be a subset of the branches above
branches: [ future3/develop ]

# let only one instance run the test so cache is not corrupted.
# cancel already running instances as only the last run will be relevant
concurrency:
group: ${{ github.ref }}-test-debian-v3
cancel-in-progress: true

jobs:

# Build container and run tests. Duplication of job intended for better visualization.
run_bookworm_armv7:
name: 'bookworm armv7'
uses: ./.github/workflows/test_docker_debian_codename_sub_v3.yml
with:
debian_codename: 'bookworm'
platform: linux/arm/v7

run_bullseye_armv7:
name: 'bullseye armv7'
uses: ./.github/workflows/test_docker_debian_codename_sub_v3.yml
with:
debian_codename: 'bullseye'
platform: linux/arm/v7
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ For bug fixes and improvements just open an issue or PR as described below. If y
* By default this will get you to the `future3/main` branch. You will move to the `future3/develop` branch, do this:

~~~bash
cd /home/pi/RPi-Jukebox-RFID
cd ~/RPi-Jukebox-RFID
git checkout future3/develop
git fetch origin
git reset --hard origin/future3/develop
Expand Down Expand Up @@ -122,7 +122,7 @@ If you touched *any* Python file (even if only for fixing spelling errors), run
It contains out setup file.
~~~bash
cd /home/pi/RPi-Jukebox-RFID
cd ~/RPi-Jukebox-RFID
./run_flake8.sh
~~~
Expand All @@ -135,7 +135,7 @@ Tests are very few at the moment, but it cannot hurt to run them. If you have te
them.
~~~bash
cd /home/pi/RPi-Jukebox-RFID/
cd ~/RPi-Jukebox-RFID/
./run_pytest.sh
~~~
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# RFID Jukebox Version 3 (aka future3)

![GitHub last commit (branch)](https://img.shields.io/github/last-commit/MiczFlor/RPi-Jukebox-RFID/future3/develop)

[![Test Install Scripts Debian v3](https://github.com/MiczFlor/RPi-Jukebox-RFID/actions/workflows/test_docker_debian_v3.yml/badge.svg?branch=future3%2Fdevelop)](https://github.com/MiczFlor/RPi-Jukebox-RFID/actions/workflows/test_docker_debian_v3.yml) [![Python + Docs Checks and Tests](https://github.com/MiczFlor/RPi-Jukebox-RFID/actions/workflows/pythonpackage_future3.yml/badge.svg?branch=future3%2Fdevelop)](https://github.com/MiczFlor/RPi-Jukebox-RFID/actions/workflows/pythonpackage_future3.yml) [![Coverage Status](https://coveralls.io/repos/github/MiczFlor/RPi-Jukebox-RFID/badge.svg?branch=future3/develop)](https://coveralls.io/github/MiczFlor/RPi-Jukebox-RFID?branch=future3/develop)

[![Matrix chat](https://matrix.to/img/matrix-badge.svg)](https://matrix.to/#/#phoniebox_community:gitter.im)

## What is this?

The exiting, new **Version 3** of the RPi Jukebox RFID. A complete re-write of the Jukebox.
Expand All @@ -13,8 +19,4 @@ The documentation can be found [here](./documentation/README.md)

## Installation?

Run the following one-liner in a shell and follow the instructions

~~~bash
cd; bash <(wget -qO- https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID/future3/develop/installation/install-jukebox.sh)
~~~
[Install Phoniebox software](documentation/builders/installation.md#install-phoniebox-software)
Loading

0 comments on commit 468b61d

Please sign in to comment.