Skip to content

Commit

Permalink
Merge branch 'future3/develop' into future3/multi-player
Browse files Browse the repository at this point in the history
  • Loading branch information
Groovylein committed Apr 9, 2024
2 parents d38dc0c + 3865c5a commit d880d46
Show file tree
Hide file tree
Showing 174 changed files with 10,680 additions and 2,053 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ shared
src/webapp/node_modules
src/webapp/npm-debug.log
src/webapp/build
src/webapp/build.bak
2 changes: 2 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
[flake8]
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
Expand Down
24 changes: 20 additions & 4 deletions .githooks/post-merge
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# TO ACTIVATE: cp .githooks/post-merge .git/hooks/.
#
# Checks:
# - Changes to web app
# - Changes to Web App
# - Changes to web dependency
# - Changes to python requirements
#
Expand All @@ -20,7 +20,7 @@ warn_npm_dependency() {
echo "************************************************************"
echo "ATTENTION: npm dependencies have changed since last pull!"
echo ""
echo "To update dependencies and rebuilt WebApp run:"
echo "To update dependencies and rebuilt Web App run:"
echo "$ cd src/webapp && ./run_rebuild.sh -u"
echo "************************************************************"
echo -e "\n"
Expand All @@ -31,7 +31,7 @@ warn_webapp() {
echo "************************************************************"
echo "ATTENTION: Web App sources have changed since last pull!"
echo ""
echo "To rebuilt the WebApp run:"
echo "To rebuilt the Web App run:"
echo "$ cd src/webapp && ./run_rebuild.sh"
echo "************************************************************"
echo -e "\n"
Expand All @@ -43,6 +43,7 @@ warn_python_requirements() {
echo "ATTENTION: Python requirements have changed since last pull!"
echo ""
echo "To update python requirements on the RPi run"
echo "$ source .venv/bin/activate"
echo "$ python -m pip install --upgrade -r requirements.txt"
echo "************************************************************"
echo -e "\n"
Expand All @@ -57,14 +58,25 @@ warn_githooks() {
echo "$ cp .githooks/* .git/hooks/."
echo "************************************************************"
echo -e "\n"
}

warn_installer() {
echo -e "\n"
echo "************************************************************"
echo "ATTENTION: Installer sources have changed since last pull!"
echo ""
echo "Rerun the installer to apply changes"
echo "$ ./installation/install-jukebox.sh"
echo "************************************************************"
echo -e "\n"
}

# files_changed="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
webapp_changed="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD src/webapp)"
webapp_dep_changed="$(git diff --name-only --no-commit-id ORIG_HEAD HEAD src/webapp/package.json)"
python_req_changed="$(git diff --name-only --no-commit-id ORIG_HEAD HEAD requirements.txt)"
githooks_changed="$(git diff --name-only --no-commit-id ORIG_HEAD HEAD .githooks)"
installer_changed="$(git diff --name-only --no-commit-id ORIG_HEAD HEAD installation)"

if [[ -n $python_req_changed ]]; then
warn_python_requirements
Expand All @@ -80,5 +92,9 @@ if [[ -n $githooks_changed ]]; then
warn_githooks
fi

if [[ -n $installer_changed ]]; then
warn_installer
fi

echo -e "\nTo see a summary of what happened since your last pull, do:"
echo -e "git show --oneline -s ORIG_HEAD..HEAD\n"
echo -e "git show --oneline -s ORIG_HEAD..HEAD\n"
31 changes: 30 additions & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
# Checks
# - flake8 on staged python files
# Note: This only checks the modified files
# - docs build of if any python file or any doc file is staged
# - docs build of if any python file is staged
# Note: This builds the entire documentation if a changed file goes into the documentation
# - Markdownlint if any markdown file is staged
# Note: This checks all markdown files as configured in .markdownlint-cli2.yaml

#
# If there are problem with this script, commit may still be done with
# git commit --no-verify
Expand All @@ -28,6 +31,32 @@ fi

code=$(( flake8_code ))

doc_code=0
if [[ -n $PY_FILES ]]; then
echo -e "\n**************************************************************"
echo -e "Modified Python source files. Generation markdown docs from docstring ... \n"
echo -e "**************************************************************\n"
./run_docgeneration.sh -c
doc_code=$?
echo "pydoc_markdown return code: $doc_code"
fi

code=$(( flake8_code + doc_code ))

# Pass all staged markdown files through markdownlint-cli2
MD_FILES="$(git diff --diff-filter=d --staged --name-only -- **/*.md)"
markdownlint_code=0
if [[ -n $MD_FILES ]]; then
echo -e "\n**************************************************************"
echo "Modified Markdown files. Running markdownlint-cli2 ... "
echo -e "**************************************************************\n"
./run_markdownlint.sh
markdownlint_code=$?
echo "Markdownlint-cli2 return code: $markdownlint_code"
fi

code=$(( flake8_code + doc_code + markdownlint_code))

if [[ code -gt 0 ]]; then
echo -e "\n**************************************************************"
echo -e "ERROR(s) during pre-commit checks. Aborting commit!"
Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Please post here the output of 'tail -n 500 /var/log/syslog' or 'journalctl -u m
i.e. `find logfiles at https://paste.ubuntu.com/p/cRS7qM8ZmP/`
-->


## Software

### Base image and version
Expand All @@ -59,7 +58,6 @@ the following command will help with that
i.e. `scripts/installscripts/buster-install-default.sh`
-->


## Hardware

### RaspberryPi version
Expand Down
25 changes: 25 additions & 0 deletions .github/actions/build-webapp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build Web App
description: 'Build Web App with Node'
inputs:
webapp-root-path:
description: 'root path of the Web App sources'
required: false
default: './src/webapp'
outputs:
webapp-root-path:
description: 'used root path of the Web App sources'
value: ${{ inputs.webapp-root-path }}

runs:
using: "composite"
steps:
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: run build
working-directory: ${{ inputs.webapp-root-path }}
shell: bash
env:
CI: false
run: ./run_rebuild.sh -u
32 changes: 10 additions & 22 deletions .github/workflows/bundle_webapp_and_release_v3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Bundle Webapp and Release
name: Bundle Web App and Release

on:
push:
Expand All @@ -18,7 +18,7 @@ jobs:
check_abort: ${{ steps.vars.outputs.check_abort }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Output vars
id: vars
Expand Down Expand Up @@ -72,9 +72,6 @@ jobs:
if: ${{ needs.check.outputs.check_abort == 'false' }}
runs-on: ubuntu-latest

env:
WEBAPP_ROOT_PATH: ./src/webapp

outputs:
tag_name: ${{ needs.check.outputs.tag_name }}
release_type: ${{ needs.check.outputs.release_type }}
Expand All @@ -83,7 +80,7 @@ jobs:
webapp_bundle_name_latest: ${{ steps.vars.outputs.webapp_bundle_name_latest }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set Output vars
id: vars
Expand All @@ -94,29 +91,20 @@ jobs:
echo "webapp_bundle_name=webapp-build-${COMMIT_SHA:0:10}.tar.gz" >> $GITHUB_OUTPUT
echo "webapp_bundle_name_latest=webapp-build-latest.tar.gz" >> $GITHUB_OUTPUT
- name: Setup Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: npm install
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
run: npm install
- name: npm build
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
env:
CI: false
run: npm run build
- name: Build Web App
id: build-webapp
uses: ./.github/actions/build-webapp

- name: Create Bundle
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
working-directory: ${{ steps.build-webapp.outputs.webapp-root-path }}
run: |
tar -czvf ${{ steps.vars.outputs.webapp_bundle_name }} build
- name: Artifact Upload
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ steps.vars.outputs.webapp_bundle_name }}
path: ${{ env.WEBAPP_ROOT_PATH }}/${{ steps.vars.outputs.webapp_bundle_name }}
path: ${{ steps.build-webapp.outputs.webapp-root-path }}/${{ steps.vars.outputs.webapp_bundle_name }}
retention-days: 5

release:
Expand All @@ -131,7 +119,7 @@ jobs:

steps:
- name: Artifact Download
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ needs.build.outputs.webapp_bundle_name }}

Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/codeql-analysis_v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ jobs:
- name: Install dependencies
run: |
# Install necessary packages
sudo apt-get update
sudo apt-get install libasound2-dev pulseaudio
python3 -m venv .venv
source ".venv/bin/activate"
python -m pip install --upgrade pip
pip install -r requirements.txt
# Set the `CODEQL-PYTHON` environment variable to the Python executable
Expand All @@ -53,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -65,7 +69,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -79,4 +83,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
28 changes: 28 additions & 0 deletions .github/workflows/markdown_v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Markdown Linting

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

jobs:
build:

runs-on: ubuntu-latest

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

- name: Linting markdown
uses: DavidAnson/markdownlint-cli2-action@v15
with:
config: .markdownlint-cli2.yaml
#continue-on-error: true
6 changes: 4 additions & 2 deletions .github/workflows/pythonpackage_future3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand All @@ -31,6 +31,9 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y libasound2-dev pulseaudio
python3 -m venv .venv
source ".venv/bin/activate"
python3 -m pip install --upgrade pip
pip3 install -r requirements.txt
# For operation of the Jukebox, ZMQ must be compiled from sources due to Websocket support
Expand All @@ -51,7 +54,6 @@ jobs:
parallel: true
- name: Lint with flake8
run: |
pip3 install flake8
# Stop the build if linting fails
./run_flake8.sh
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/test_build_webapp_v3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Test Build Web App v3

on:
schedule:
# run at 18:00 every sunday
- cron: '0 18 * * 0'
push:
branches:
- 'future3/**'
paths:
- '.github/workflows/test_build_webapp_v3.yml'
- '.github/actions/build-webapp/**'
- 'src/webapp/**'
pull_request:
# The branches below must be a subset of the branches above
branches:
- future3/develop
- future3/main
paths:
- '.github/workflows/test_build_webapp_v3.yml'
- '.github/actions/build-webapp/**'
- 'src/webapp/**'

jobs:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Build Web App
uses: ./.github/actions/build-webapp
Loading

0 comments on commit d880d46

Please sign in to comment.