Skip to content

Commit

Permalink
Merge branch 'future3/develop' into future3/fix-docker-windows
Browse files Browse the repository at this point in the history
  • Loading branch information
s-martin committed Feb 19, 2024
2 parents 8722544 + 75743da commit b2bdf2b
Show file tree
Hide file tree
Showing 153 changed files with 9,478 additions and 1,481 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
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"
14 changes: 13 additions & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# 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
#
# If there are problem with this script, commit may still be done with
Expand All @@ -28,6 +28,18 @@ 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 ))

if [[ code -gt 0 ]]; then
echo -e "\n**************************************************************"
echo -e "ERROR(s) during pre-commit checks. Aborting commit!"
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
28 changes: 8 additions & 20 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
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 Down
3 changes: 3 additions & 0 deletions .github/workflows/codeql-analysis_v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
run: |
# Install necessary packages
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 Down
4 changes: 3 additions & 1 deletion .github/workflows/pythonpackage_future3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 7 additions & 2 deletions .github/workflows/test_docker_debian_codename_sub_v3.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Subworkflow Test Install Scripts Debian V3
name: Subworkflow Test Install Scripts Debian v3

on:
workflow_call:
Expand Down Expand Up @@ -46,6 +46,7 @@ jobs:
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 }}
docker_run_options: ${{ steps.vars.outputs.docker_run_options }}

# create local docker registry to use locally build images
services:
Expand Down Expand Up @@ -83,13 +84,17 @@ jobs:
id: vars
env:
LOCAL_REGISTRY_PORT: ${{ inputs.local_registry_port }}
PLATFORM: ${{ inputs.platform }}
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
if [ "${{ env.PLATFORM }}" == "linux/arm/v6" ] ; then
echo "docker_run_options=-e QEMU_CPU=arm1176" >> $GITHUB_OUTPUT
fi
# Build base image for debian version name. Layers will be cached and image pushes to local registry
- name: Build Image - Base
Expand Down Expand Up @@ -167,7 +172,7 @@ jobs:
uses: tj-actions/docker-run@v2
with:
image: ${{ needs.build.outputs.image_tag_name }}
options: --platform ${{ inputs.platform }} --user ${{ env.TEST_USER_NAME }} --init
options: ${{ needs.build.outputs.docker_run_options }} --platform ${{ inputs.platform }} --user ${{ env.TEST_USER_NAME }} --init
name: ${{ matrix.test_script }}
args: |
./${{ matrix.test_script }}
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/test_docker_debian_v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches:
- 'future3/**'
paths:
- '.github/workflows/test_docker_debian*.yml'
- 'installation/**'
- 'ci/**'
- 'resources/**'
Expand All @@ -20,6 +21,7 @@ on:
- future3/develop
- future3/main
paths:
- '.github/workflows/test_docker_debian*.yml'
- 'installation/**'
- 'ci/**'
- 'resources/**'
Expand All @@ -43,9 +45,25 @@ jobs:
debian_codename: 'bookworm'
platform: linux/arm/v7

# # can be activate on test branches, currently failing
# run_bookworm_armv6:
# name: 'bookworm armv6'
# uses: ./.github/workflows/test_docker_debian_codename_sub_v3.yml
# with:
# debian_codename: 'bookworm'
# platform: linux/arm/v6

run_bullseye_armv7:
name: 'bullseye armv7'
uses: ./.github/workflows/test_docker_debian_codename_sub_v3.yml
with:
debian_codename: 'bullseye'
platform: linux/arm/v7

# # can be activate on test branches, currently failing
# run_bullseye_armv6:
# name: 'bullseye armv6'
# uses: ./.github/workflows/test_docker_debian_codename_sub_v3.yml
# with:
# debian_codename: 'bullseye'
# platform: linux/arm/v6
Loading

0 comments on commit b2bdf2b

Please sign in to comment.