Skip to content

Commit

Permalink
Merge branch 'future3/feature/resume' of github.com:votti/RPi-Jukebox…
Browse files Browse the repository at this point in the history
…-RFID into future3/vz
  • Loading branch information
Vito Zanotelli committed Aug 2, 2024
2 parents 7a48f7d + b8939b4 commit 707a942
Show file tree
Hide file tree
Showing 304 changed files with 18,892 additions and 9,235 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[run]
omit = test/*
5 changes: 3 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
.git
.githooks
.github
.dockerignore
.DS_Store

# Application
docker
docs
installation
src
shared

# webapp
!src/webapp
src/webapp/node_modules
src/webapp/npm-debug.log
src/webapp/build
src/webapp/build.bak
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ indent_size = 4
[*.md]
trim_trailing_whitespace = false

[*.{js,yaml}]
[*.{js,yaml,yml}]
indent_size = 2
10 changes: 6 additions & 4 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 All @@ -15,13 +17,13 @@ per-file-ignores =
count = True
max-complexity = 12
statistics = True
filename = *.py,*.py.*
filename = *.py
extend-exclude =
# Ignore all scratch development directories
scratch*,
# The conf file is mostly autogenerated, ignore it
docs/sphinx/conf.py,
# Ignore dirs and files that have not been ported yet
*/jukebox/NvManager.py
# ignore GitHub Codespaces
# ignore Python venv's
.venv/*
# ignore node modules
*/node_modules/*
26 changes: 21 additions & 5 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,7 +43,8 @@ warn_python_requirements() {
echo "ATTENTION: Python requirements have changed since last pull!"
echo ""
echo "To update python requirements on the RPi run"
echo "$ sudo python3 -m pip install --upgrade -r requirements.txt"
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"
36 changes: 27 additions & 9 deletions .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 @@ -26,18 +29,33 @@ if [[ -n $PY_FILES ]]; then
echo "Flake8 return code: $flake8_code"
fi

DOC_FILES="$(git diff --diff-filter=d --staged --name-only -- docs/sphinx/*)"
sphinx_code=0
if [[ -n $DOC_FILES || -n $PY_FILES ]]; then
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 -e "Files for documentation modified. Testing re-build of docs ... \n"
echo "Modified Markdown files. Running markdownlint-cli2 ... "
echo -e "**************************************************************\n"
./run_sphinx.sh -c
sphinx_code=$?
echo "Sphinx return code: $sphinx_code"
./run_markdownlint.sh
markdownlint_code=$?
echo "Markdownlint-cli2 return code: $markdownlint_code"
fi

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

if [[ code -gt 0 ]]; then
echo -e "\n**************************************************************"
Expand Down
4 changes: 1 addition & 3 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 @@ -50,7 +49,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 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
26 changes: 26 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
Loading

0 comments on commit 707a942

Please sign in to comment.