Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v3.4.0 #2137

Merged
merged 31 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
234cc3c
Add installation checks + CI Workflow (#2119)
AlvinSchiller Dec 2, 2023
dbfd58a
Bump libzmq version to 4.3.5 for armv7
pabera Dec 3, 2023
f1558a2
Add badges to future3 (#2133)
s-martin Dec 4, 2023
cf5aa6c
allow custom username (#2132)
AlvinSchiller Dec 4, 2023
01ec0bc
Allow download of prebuild libzmq-v4.3.5 for Docker
pabera Dec 5, 2023
935a6d4
Merge branch 'future3/develop' into future3/bump-libzmq
pabera Dec 5, 2023
8ea49cf
Remove unnecessary build-essentials from apt-get in Dockerfile
pabera Dec 5, 2023
a32b771
Fix a few typos
pabera Dec 5, 2023
78eb0c4
Use wget to download pre-built libzmq from github
pabera Dec 5, 2023
5a875b8
Remove unused constants
pabera Dec 5, 2023
54681da
Make variable local to its function
pabera Dec 5, 2023
ade2894
Install webapp from release build if Node.JS download is aborted
pabera Dec 7, 2023
c3d0897
Use GH release downloads for webapp
pabera Dec 7, 2023
3ffe8a3
Bugfix: wrong variable assignment
pabera Dec 7, 2023
bdb1dd1
Static release download url
pabera Dec 8, 2023
caf4a55
Fix version funtion return value
pabera Dec 8, 2023
554c0ed
fix local libzmq build
AlvinSchiller Dec 8, 2023
435bd6f
add CI test for local libzmq build
AlvinSchiller Dec 8, 2023
23cf06c
update var names and docs
AlvinSchiller Dec 8, 2023
55b1c9e
add platform in scope and description
AlvinSchiller Dec 8, 2023
93212d0
Merge pull request #1 from AlvinSchiller/future3/bump-libzmq
pabera Dec 8, 2023
4b0860f
Merge pull request #2135 from pabera/future3/bump-libzmq
pabera Dec 8, 2023
c00cde6
Add file upload via WebUI
s-martin Dec 8, 2023
18857d7
[Bugfix] Webapp allows to assign single song to card (#2143)
pabera Dec 10, 2023
02c63ed
[Docs] Inform about Python venv (#2147)
pabera Dec 10, 2023
dd7f6e9
Add running pytest to GitHub action (#2146)
s-martin Dec 10, 2023
afc3067
[Bugfix] setup_autohotspot.sh for multiple wifi country codes, use fi…
ben0r33 Dec 11, 2023
bd34521
some documentation updates (#2151)
AlvinSchiller Dec 11, 2023
50e8446
Better logging functions for Installation script (#2152)
pabera Dec 11, 2023
7250211
Minor doc improvements (#2149)
s-martin Dec 11, 2023
b8b68c8
Add coverage badge (#2153)
s-martin Dec 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 .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
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)

[![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)
88 changes: 88 additions & 0 deletions ci/ci-debian.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# 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=bookworm
ARG BASE_TEST_IMAGE=test-code
FROM debian:${DEBIAN_CODENAME}-slim as base
ARG DEBIAN_CODENAME

ENV TERM=xterm DEBIAN_FRONTEND=noninteractive
ENV CI_RUNNING=true

# create RPi configs to test installation
RUN touch /boot/config.txt
RUN echo "logo.nologo" > /boot/cmdline.txt

RUN echo "--- install packages (1) ---" \
&& apt-get update \
&& apt-get -y install \
apt-utils \
curl \
gnupg \
&& echo "--- add sources ---" \
&& curl -fsSL http://raspbian.raspberrypi.org/raspbian.public.key | gpg --dearmor > /usr/share/keyrings/raspberrypi-raspbian-keyring.gpg \
&& curl -fsSL http://archive.raspberrypi.org/debian/raspberrypi.gpg.key | gpg --dearmor > /usr/share/keyrings/raspberrypi-archive-debian-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/raspberrypi-raspbian-keyring.gpg] http://raspbian.raspberrypi.org/raspbian/ ${DEBIAN_CODENAME} main contrib non-free rpi" > /etc/apt/sources.list.d/raspi.list \
&& echo "deb [signed-by=/usr/share/keyrings/raspberrypi-archive-debian-keyring.gpg] http://archive.raspberrypi.org/debian/ ${DEBIAN_CODENAME} main" >> /etc/apt/sources.list.d/raspi.list \
&& echo "--- install packages (2) ---" \
&& apt-get update \
&& apt-get -y upgrade \
&& apt-get -y install \
build-essential \
iproute2 \
openssh-client \
sudo \
systemd \
wireless-tools \
wget \
wpasupplicant \
&& rm -rf /var/lib/apt/lists/*

# Set NonInteractive for sudo usage in container. 'sudo' package needed
RUN echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections
# ------

# Base Target for setting up a test user. user can be selected with the docker '--user YYY' option
FROM base as test-user
ARG USER_NAME=pi
ARG USER_GROUP=$USER_NAME
ARG USER_ID=1000

ENV TEST_USER_GROUP=test
RUN groupadd --gid 1002 $TEST_USER_GROUP

RUN groupadd --gid 1000 $USER_GROUP \
&& useradd -u $USER_ID -g $USER_GROUP -G sudo,$TEST_USER_GROUP -d /home/$USER_NAME -m -s /bin/bash -p '$1$iV7TOwOe$6ojkJQXyEA9bHd/SqNLNj0' $USER_NAME \
&& echo "$USER_NAME ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$USER_NAME

ENV XDG_RUNTIME_DIR=/run/user/$USER_ID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$USER_ID/bus
# ------

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

ENV GIT_BRANCH=$GIT_BRANCH GIT_USER=$GIT_USER

COPY --chown=root:$TEST_USER_GROUP --chmod=770 packages-core.txt ./

RUN echo "--- install internal packages ---" \
&& apt-get update \
&& sed 's/#.*//g' packages-core.txt | xargs apt-get -y install \
&& rm -rf /var/lib/apt/lists/*

ENV INSTALL_SCRIPT_PATH=/code

WORKDIR ${INSTALL_SCRIPT_PATH}
COPY --chown=root:$TEST_USER_GROUP --chmod=770 installation/install-jukebox.sh ./

WORKDIR ${INSTALL_SCRIPT_PATH}/tests
COPY --chown=root:$TEST_USER_GROUP --chmod=770 ci/installation/*.sh ./
# ------


# Target for applying latest updates (should not be cached!)
FROM $BASE_TEST_IMAGE as test-update
RUN apt-get update \
&& apt-get -y upgrade \
&& rm -rf /var/lib/apt/lists/*
# ------
Loading