Skip to content

Commit 92b4c4b

Browse files
authored
Merge pull request #2211 from MiczFlor/future3/develop
Release v3.5.0
2 parents 6088ad2 + 20389e3 commit 92b4c4b

169 files changed

Lines changed: 10528 additions & 2142 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.coveragerc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
omit = test/*

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ shared
1414
src/webapp/node_modules
1515
src/webapp/npm-debug.log
1616
src/webapp/build
17+
src/webapp/build.bak

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ indent_size = 4
1515
[*.md]
1616
trim_trailing_whitespace = false
1717

18-
[*.{js,yaml}]
18+
[*.{js,yaml,yml}]
1919
indent_size = 2

.flake8

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ extend-exclude =
2121
scratch*,
2222
# Ignore dirs and files that have not been ported yet
2323
*/jukebox/NvManager.py
24-
# ignore GitHub Codespaces
24+
# ignore Python venv's
2525
.venv/*
26+
# ignore node modules
27+
*/node_modules/*

.githooks/post-merge

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# TO ACTIVATE: cp .githooks/post-merge .git/hooks/.
66
#
77
# Checks:
8-
# - Changes to web app
8+
# - Changes to Web App
99
# - Changes to web dependency
1010
# - Changes to python requirements
1111
#
@@ -20,7 +20,7 @@ warn_npm_dependency() {
2020
echo "************************************************************"
2121
echo "ATTENTION: npm dependencies have changed since last pull!"
2222
echo ""
23-
echo "To update dependencies and rebuilt WebApp run:"
23+
echo "To update dependencies and rebuilt Web App run:"
2424
echo "$ cd src/webapp && ./run_rebuild.sh -u"
2525
echo "************************************************************"
2626
echo -e "\n"
@@ -31,7 +31,7 @@ warn_webapp() {
3131
echo "************************************************************"
3232
echo "ATTENTION: Web App sources have changed since last pull!"
3333
echo ""
34-
echo "To rebuilt the WebApp run:"
34+
echo "To rebuilt the Web App run:"
3535
echo "$ cd src/webapp && ./run_rebuild.sh"
3636
echo "************************************************************"
3737
echo -e "\n"
@@ -43,6 +43,7 @@ warn_python_requirements() {
4343
echo "ATTENTION: Python requirements have changed since last pull!"
4444
echo ""
4545
echo "To update python requirements on the RPi run"
46+
echo "$ source .venv/bin/activate"
4647
echo "$ python -m pip install --upgrade -r requirements.txt"
4748
echo "************************************************************"
4849
echo -e "\n"
@@ -57,14 +58,25 @@ warn_githooks() {
5758
echo "$ cp .githooks/* .git/hooks/."
5859
echo "************************************************************"
5960
echo -e "\n"
61+
}
6062

63+
warn_installer() {
64+
echo -e "\n"
65+
echo "************************************************************"
66+
echo "ATTENTION: Installer sources have changed since last pull!"
67+
echo ""
68+
echo "Rerun the installer to apply changes"
69+
echo "$ ./installation/install-jukebox.sh"
70+
echo "************************************************************"
71+
echo -e "\n"
6172
}
6273

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

6981
if [[ -n $python_req_changed ]]; then
7082
warn_python_requirements
@@ -80,5 +92,9 @@ if [[ -n $githooks_changed ]]; then
8092
warn_githooks
8193
fi
8294

95+
if [[ -n $installer_changed ]]; then
96+
warn_installer
97+
fi
98+
8399
echo -e "\nTo see a summary of what happened since your last pull, do:"
84-
echo -e "git show --oneline -s ORIG_HEAD..HEAD\n"
100+
echo -e "git show --oneline -s ORIG_HEAD..HEAD\n"

.githooks/pre-commit

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Checks
88
# - flake8 on staged python files
99
# Note: This only checks the modified files
10-
# - docs build of if any python file or any doc file is staged
10+
# - docs build of if any python file is staged
1111
# Note: This builds the entire documentation if a changed file goes into the documentation
1212
#
1313
# If there are problem with this script, commit may still be done with
@@ -28,6 +28,18 @@ fi
2828

2929
code=$(( flake8_code ))
3030

31+
doc_code=0
32+
if [[ -n $PY_FILES ]]; then
33+
echo -e "\n**************************************************************"
34+
echo -e "Modified Python source files. Generation markdown docs from docstring ... \n"
35+
echo -e "**************************************************************\n"
36+
./run_docgeneration.sh -c
37+
doc_code=$?
38+
echo "pydoc_markdown return code: $doc_code"
39+
fi
40+
41+
code=$(( flake8_code + doc_code ))
42+
3143
if [[ code -gt 0 ]]; then
3244
echo -e "\n**************************************************************"
3345
echo -e "ERROR(s) during pre-commit checks. Aborting commit!"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Build Web App
2+
description: 'Build Web App with Node'
3+
inputs:
4+
webapp-root-path:
5+
description: 'root path of the Web App sources'
6+
required: false
7+
default: './src/webapp'
8+
outputs:
9+
webapp-root-path:
10+
description: 'used root path of the Web App sources'
11+
value: ${{ inputs.webapp-root-path }}
12+
13+
runs:
14+
using: "composite"
15+
steps:
16+
- name: Setup Node.js 20.x
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 20.x
20+
- name: run build
21+
working-directory: ${{ inputs.webapp-root-path }}
22+
shell: bash
23+
env:
24+
CI: false
25+
run: ./run_rebuild.sh -u
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: Bundle Web App and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- 'future3/main'
7+
- 'future3/develop'
8+
9+
jobs:
10+
11+
check:
12+
if: ${{ github.repository_owner == 'MiczFlor' }}
13+
runs-on: ubuntu-latest
14+
15+
outputs:
16+
tag_name: ${{ steps.vars.outputs.tag_name }}
17+
release_type: ${{ steps.vars.outputs.release_type }}
18+
check_abort: ${{ steps.vars.outputs.check_abort }}
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set Output vars
24+
id: vars
25+
env:
26+
BRANCH_NAME: ${{ github.ref_name }}
27+
run: |
28+
# Official SemVer Regex definition
29+
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
30+
# Needed changes to the regex:
31+
# - '?:' capture command needed to be removed as it wasn't working in shell
32+
# - '\d' had to be replaced with [0-9]
33+
#
34+
# Release versions like 1.0.0, 3.5.0, 100.4.50000+metadata
35+
REGEX_VERSION_RELEASE="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$"
36+
#
37+
# Prerelease versions like 1.0.0-alpha, 3.5.0-whatsoever.12, 100.4.50000-identifier.12+metadata
38+
REGEX_VERSION_PRERELEASE="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$"
39+
40+
41+
# Get the version and calculate release type
42+
VERSION=$(python ./src/jukebox/jukebox/version.py)
43+
if echo "$VERSION" | grep -qoE "$REGEX_VERSION_RELEASE" ; then
44+
RELEASE_TYPE=release
45+
elif echo "$VERSION" | grep -qoE "$REGEX_VERSION_PRERELEASE" ; then
46+
RELEASE_TYPE=prerelease
47+
else
48+
RELEASE_TYPE=none
49+
fi
50+
51+
if [ "$BRANCH_NAME" == 'future3/main' -a "$RELEASE_TYPE" == 'release' ] || [ "$BRANCH_NAME" == 'future3/develop' -a "$RELEASE_TYPE" == 'prerelease' ] ; then
52+
CHECK_ABORT=false
53+
else
54+
echo "::notice title=Abort due to not matching ${RELEASE_TYPE} version for branch!::'${VERSION}' on '${BRANCH_NAME}'"
55+
CHECK_ABORT=true
56+
fi
57+
58+
echo "::group::Output values"
59+
echo "Version: ${VERSION}"
60+
echo "RELEASE_TYPE: ${RELEASE_TYPE}"
61+
echo "BRANCH_NAME: ${BRANCH_NAME}"
62+
echo "CHECK_ABORT: ${CHECK_ABORT}"
63+
64+
echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT
65+
echo "release_type=${RELEASE_TYPE}" >> $GITHUB_OUTPUT
66+
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
67+
echo "check_abort=${CHECK_ABORT}" >> $GITHUB_OUTPUT
68+
echo "::endgroup::"
69+
70+
build:
71+
needs: [check]
72+
if: ${{ needs.check.outputs.check_abort == 'false' }}
73+
runs-on: ubuntu-latest
74+
75+
outputs:
76+
tag_name: ${{ needs.check.outputs.tag_name }}
77+
release_type: ${{ needs.check.outputs.release_type }}
78+
commit_sha: ${{ steps.vars.outputs.commit_sha }}
79+
webapp_bundle_name: ${{ steps.vars.outputs.webapp_bundle_name }}
80+
webapp_bundle_name_latest: ${{ steps.vars.outputs.webapp_bundle_name_latest }}
81+
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Set Output vars
86+
id: vars
87+
env:
88+
COMMIT_SHA: ${{ github.sha }}
89+
run: |
90+
echo "commit_sha=${COMMIT_SHA}" >> $GITHUB_OUTPUT
91+
echo "webapp_bundle_name=webapp-build-${COMMIT_SHA:0:10}.tar.gz" >> $GITHUB_OUTPUT
92+
echo "webapp_bundle_name_latest=webapp-build-latest.tar.gz" >> $GITHUB_OUTPUT
93+
94+
- name: Build Web App
95+
id: build-webapp
96+
uses: ./.github/actions/build-webapp
97+
98+
- name: Create Bundle
99+
working-directory: ${{ steps.build-webapp.outputs.webapp-root-path }}
100+
run: |
101+
tar -czvf ${{ steps.vars.outputs.webapp_bundle_name }} build
102+
103+
- name: Artifact Upload
104+
uses: actions/upload-artifact@v3
105+
with:
106+
name: ${{ steps.vars.outputs.webapp_bundle_name }}
107+
path: ${{ steps.build-webapp.outputs.webapp-root-path }}/${{ steps.vars.outputs.webapp_bundle_name }}
108+
retention-days: 5
109+
110+
release:
111+
needs: [build]
112+
runs-on: ubuntu-latest
113+
114+
concurrency:
115+
group: ${{ needs.build.outputs.tag_name }}
116+
117+
permissions:
118+
contents: write
119+
120+
steps:
121+
- name: Artifact Download
122+
uses: actions/download-artifact@v3
123+
with:
124+
name: ${{ needs.build.outputs.webapp_bundle_name }}
125+
126+
- name: Create Release
127+
uses: ncipollo/release-action@v1
128+
with:
129+
commit: ${{ needs.build.outputs.commit_sha }}
130+
tag: ${{ needs.build.outputs.tag_name }}
131+
body: "Automated Release for ${{ needs.build.outputs.tag_name }}"
132+
makeLatest: 'false'
133+
prerelease: ${{ needs.build.outputs.release_type == 'prerelease' }}
134+
generateReleaseNotes: ${{ needs.build.outputs.release_type == 'release' }}
135+
skipIfReleaseExists: false
136+
allowUpdates: true
137+
removeArtifacts: false
138+
replacesArtifacts: false
139+
omitBodyDuringUpdate: true
140+
omitNameDuringUpdate: true
141+
token: ${{ secrets.GITHUB_TOKEN }}
142+
143+
- name: Get Release by tag
144+
id: get_release
145+
uses: joutvhu/get-release@v1
146+
env:
147+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
148+
with:
149+
tag_name: ${{ needs.build.outputs.tag_name }}
150+
151+
- name: Upload Release Asset
152+
uses: shogo82148/actions-upload-release-asset@v1
153+
env:
154+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
155+
with:
156+
upload_url: ${{ steps.get_release.outputs.upload_url }}
157+
asset_name: ${{ needs.build.outputs.webapp_bundle_name }}
158+
asset_path: ${{ needs.build.outputs.webapp_bundle_name }}
159+
asset_content_type: application/gzip
160+
overwrite: true
161+
162+
- name: Upload Release Asset as Latest
163+
uses: shogo82148/actions-upload-release-asset@v1
164+
env:
165+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166+
with:
167+
upload_url: ${{ steps.get_release.outputs.upload_url }}
168+
asset_name: ${{ needs.build.outputs.webapp_bundle_name_latest }}
169+
asset_path: ${{ needs.build.outputs.webapp_bundle_name }}
170+
asset_content_type: application/gzip
171+
overwrite: true
Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: "CodeQL"
12+
name: "CodeQL v3"
1313

1414
on:
1515
push:
16-
branches: [ develop ]
16+
branches: [ future3/develop ]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ develop ]
19+
branches: [ future3/develop ]
2020
schedule:
2121
- cron: '16 18 * * 0'
2222

@@ -35,22 +35,40 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v4
39+
40+
- name: Set up Python
41+
uses: actions/setup-python@v4
42+
with:
43+
python-version: '3.x'
44+
- name: Install dependencies
45+
run: |
46+
# Install necessary packages
47+
sudo apt-get install libasound2-dev pulseaudio
48+
python3 -m venv .venv
49+
source ".venv/bin/activate"
50+
51+
python -m pip install --upgrade pip
52+
pip install -r requirements.txt
53+
# Set the `CODEQL-PYTHON` environment variable to the Python executable
54+
# that includes the dependencies
55+
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
3956
4057
# Initializes the CodeQL tools for scanning.
4158
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v1
59+
uses: github/codeql-action/init@v2
4360
with:
4461
languages: ${{ matrix.language }}
4562
# If you wish to specify custom queries, you can do so here or in a config file.
4663
# By default, queries listed here will override any specified in a config file.
4764
# Prefix the list here with "+" to use these queries and those in the config file.
4865
# queries: ./path/to/local/query, your-org/your-repo/queries@main
66+
setup-python-dependencies: false
4967

5068
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5169
# If this step fails, then you should remove it and run the build manually (see below)
5270
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v1
71+
uses: github/codeql-action/autobuild@v2
5472

5573
# ℹ️ Command-line programs to run using the OS shell.
5674
# 📚 https://git.io/JvXDl
@@ -64,4 +82,4 @@ jobs:
6482
# make release
6583

6684
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v1
85+
uses: github/codeql-action/analyze@v2

0 commit comments

Comments
 (0)