Skip to content

Commit e8a835a

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/future3/develop' into future3/check-docstrings
2 parents 3c861a0 + 480ce20 commit e8a835a

Some content is hidden

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

67 files changed

+907
-573
lines changed

.coveragerc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[run]
2+
omit = test/*

.editorconfig

+1-1
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

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ per-file-ignores =
1515
count = True
1616
max-complexity = 12
1717
statistics = True
18-
filename = *.py,*.py.*
18+
filename = *.py
1919
extend-exclude =
2020
# Ignore all scratch development directories
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/*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: Bundle Webapp 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@v3
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+
env:
76+
WEBAPP_ROOT_PATH: ./src/webapp
77+
78+
outputs:
79+
tag_name: ${{ needs.check.outputs.tag_name }}
80+
release_type: ${{ needs.check.outputs.release_type }}
81+
commit_sha: ${{ steps.vars.outputs.commit_sha }}
82+
webapp_bundle_name: ${{ steps.vars.outputs.webapp_bundle_name }}
83+
webapp_bundle_name_latest: ${{ steps.vars.outputs.webapp_bundle_name_latest }}
84+
85+
steps:
86+
- uses: actions/checkout@v3
87+
88+
- name: Set Output vars
89+
id: vars
90+
env:
91+
COMMIT_SHA: ${{ github.sha }}
92+
run: |
93+
echo "commit_sha=${COMMIT_SHA}" >> $GITHUB_OUTPUT
94+
echo "webapp_bundle_name=webapp-build-${COMMIT_SHA:0:10}.tar.gz" >> $GITHUB_OUTPUT
95+
echo "webapp_bundle_name_latest=webapp-build-latest.tar.gz" >> $GITHUB_OUTPUT
96+
97+
- name: Setup Node.js 20.x
98+
uses: actions/setup-node@v3
99+
with:
100+
node-version: 20.x
101+
- name: npm install
102+
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
103+
run: npm install
104+
- name: npm build
105+
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
106+
env:
107+
CI: false
108+
run: npm run build
109+
110+
- name: Create Bundle
111+
working-directory: ${{ env.WEBAPP_ROOT_PATH }}
112+
run: |
113+
tar -czvf ${{ steps.vars.outputs.webapp_bundle_name }} build
114+
115+
- name: Artifact Upload
116+
uses: actions/upload-artifact@v3
117+
with:
118+
name: ${{ steps.vars.outputs.webapp_bundle_name }}
119+
path: ${{ env.WEBAPP_ROOT_PATH }}/${{ steps.vars.outputs.webapp_bundle_name }}
120+
retention-days: 5
121+
122+
release:
123+
needs: [build]
124+
runs-on: ubuntu-latest
125+
126+
concurrency:
127+
group: ${{ needs.build.outputs.tag_name }}
128+
129+
permissions:
130+
contents: write
131+
132+
steps:
133+
- name: Artifact Download
134+
uses: actions/download-artifact@v3
135+
with:
136+
name: ${{ needs.build.outputs.webapp_bundle_name }}
137+
138+
- name: Create Release
139+
uses: ncipollo/release-action@v1
140+
with:
141+
commit: ${{ needs.build.outputs.commit_sha }}
142+
tag: ${{ needs.build.outputs.tag_name }}
143+
body: "Automated Release for ${{ needs.build.outputs.tag_name }}"
144+
makeLatest: 'false'
145+
prerelease: ${{ needs.build.outputs.release_type == 'prerelease' }}
146+
generateReleaseNotes: ${{ needs.build.outputs.release_type == 'release' }}
147+
skipIfReleaseExists: false
148+
allowUpdates: true
149+
removeArtifacts: false
150+
replacesArtifacts: false
151+
omitBodyDuringUpdate: true
152+
omitNameDuringUpdate: true
153+
token: ${{ secrets.GITHUB_TOKEN }}
154+
155+
- name: Get Release by tag
156+
id: get_release
157+
uses: joutvhu/get-release@v1
158+
env:
159+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160+
with:
161+
tag_name: ${{ needs.build.outputs.tag_name }}
162+
163+
- name: Upload Release Asset
164+
uses: shogo82148/actions-upload-release-asset@v1
165+
env:
166+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
167+
with:
168+
upload_url: ${{ steps.get_release.outputs.upload_url }}
169+
asset_name: ${{ needs.build.outputs.webapp_bundle_name }}
170+
asset_path: ${{ needs.build.outputs.webapp_bundle_name }}
171+
asset_content_type: application/gzip
172+
overwrite: true
173+
174+
- name: Upload Release Asset as Latest
175+
uses: shogo82148/actions-upload-release-asset@v1
176+
env:
177+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
178+
with:
179+
upload_url: ${{ steps.get_release.outputs.upload_url }}
180+
asset_name: ${{ needs.build.outputs.webapp_bundle_name_latest }}
181+
asset_path: ${{ needs.build.outputs.webapp_bundle_name }}
182+
asset_content_type: application/gzip
183+
overwrite: true

.github/workflows/pythonpackage_future3.yml

+20-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@ on:
66
- 'future3/**'
77
paths:
88
- '**.py'
9-
- '**.py.*'
109
pull_request:
1110
branches:
1211
- 'future3/**'
1312
paths:
1413
- '**.py'
15-
- '**.py.*'
1614

1715
jobs:
1816
build:
@@ -21,7 +19,7 @@ jobs:
2119
strategy:
2220
max-parallel: 4
2321
matrix:
24-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
22+
python-version: ['3.9', '3.10', '3.11']
2523

2624
steps:
2725
- uses: actions/checkout@v3
@@ -41,7 +39,26 @@ jobs:
4139
pip3 install -r src/jukebox/components/rfid/hardware/pn532_i2c_py532/requirements.txt
4240
pip3 install -r src/jukebox/components/rfid/hardware/rdm6300_serial/requirements.txt
4341
pip3 install -r src/jukebox/components/rfid/hardware/rc522_spi/requirements.txt
42+
- name: Run pytest with coverage
43+
run: |
44+
./run_pytest.sh --cov --cov-report xml --cov-config=.coveragerc
45+
- name: Report to Coveralls (parallel)
46+
uses: coverallsapp/github-action@v2
47+
with:
48+
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
file: coverage.xml
50+
format: cobertura
51+
parallel: true
4452
- name: Lint with flake8
4553
run: |
4654
# Stop the build if linting fails
4755
./run_flake8.sh
56+
57+
finish:
58+
needs: build
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Close parallel build
62+
uses: coverallsapp/github-action@v2
63+
with:
64+
parallel-finished: true

.github/workflows/test_docker_debian_v3.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,27 @@ on:
55
# run at 17:00 every sunday
66
- cron: '0 17 * * 0'
77
push:
8+
branches:
9+
- 'future3/**'
10+
paths:
11+
- 'installation/**'
12+
- 'ci/**'
13+
- 'resources/**'
14+
- 'src/jukebox/jukebox/version.py'
15+
- 'packages*.txt'
16+
- 'requirements*.txt'
817
pull_request:
918
# The branches below must be a subset of the branches above
10-
branches: [ future3/develop ]
19+
branches:
20+
- future3/develop
21+
- future3/main
22+
paths:
23+
- 'installation/**'
24+
- 'ci/**'
25+
- 'resources/**'
26+
- 'src/jukebox/jukebox/version.py'
27+
- 'packages*.txt'
28+
- 'requirements*.txt'
1129

1230
# let only one instance run the test so cache is not corrupted.
1331
# cancel already running instances as only the last run will be relevant

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/MiczFlor/RPi-Jukebox-RFID/future3/develop)
44

5-
[![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)
5+
[![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) [![Coverage Status](https://coveralls.io/repos/github/MiczFlor/RPi-Jukebox-RFID/badge.svg?branch=future3/develop)](https://coveralls.io/github/MiczFlor/RPi-Jukebox-RFID?branch=future3/develop)
66

77
[![Matrix chat](https://matrix.to/img/matrix-badge.svg)](https://matrix.to/#/#phoniebox_community:gitter.im)
88

ci/installation/run_install_common.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=true
2424
# n - setup rfid reader
2525
# y - setup samba
2626
# y - setup webapp
27-
# n - setup kiosk mode
2827
# - - install node (forced WebApp Download)
28+
# n - setup kiosk mode
2929
# n - reboot
3030

3131
"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" <<< 'y

ci/installation/run_install_faststartup.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}"
2222
# n - setup rfid reader
2323
# n - setup samba
2424
# n - setup webapp
25-
# - - setup kiosk mode (only with webapp = y)
2625
# - - install node (only with webapp = y)
26+
# - - setup kiosk mode (only with webapp = y)
2727
# n - reboot
2828

2929
"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" <<< 'y

ci/installation/run_install_libzmq_local.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export BUILD_LIBZMQ_WITH_DRAFTS_ON_DEVICE=true
2323
# n - setup rfid reader
2424
# n - setup samba
2525
# n - setup webapp
26-
# - - setup kiosk mode (only with webapp = y)
2726
# - - install node (only with webapp = y)
27+
# - - setup kiosk mode (only with webapp = y)
2828
# n - reboot
2929

3030
"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" <<< 'y

ci/installation/run_install_webapp_download.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ SCRIPT_DIR="$(dirname "$SOURCE")"
1111
LOCAL_INSTALL_SCRIPT_PATH="${INSTALL_SCRIPT_PATH:-${SCRIPT_DIR}/../../installation}"
1212
LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}"
1313

14-
export ENABLE_WEBAPP_PROD_DOWNLOAD=true
1514
# Run installation (in interactive mode)
1615
# y - start setup
1716
# n - use static ip
@@ -23,8 +22,8 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=true
2322
# n - setup rfid reader
2423
# n - setup samba
2524
# y - setup webapp
25+
# n - install node
2626
# y - setup kiosk mode
27-
# - - install node (forced webapp download)
2827
# n - reboot
2928

3029
"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" <<< 'y
@@ -36,6 +35,7 @@ n
3635
n
3736
n
3837
y
38+
n
3939
y
4040
n
4141
'

ci/installation/run_install_webapp_local.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export ENABLE_WEBAPP_PROD_DOWNLOAD=false
2323
# n - setup rfid reader
2424
# n - setup samba
2525
# y - setup webapp
26-
# y - setup kiosk mode
2726
# y - install node
27+
# y - setup kiosk mode
2828
# n - reboot
2929

3030
"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" <<< 'y

docker/docker-compose.yml

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ services:
4040
restart: unless-stopped
4141
tty: true
4242
volumes:
43+
- ../src/jukebox:/root/RPi-Jukebox-RFID/src/jukebox
4344
- ../shared:/root/RPi-Jukebox-RFID/shared
4445
- ./config/docker.pulse.mpd.conf:/root/.config/mpd/mpd.conf
4546
command: python run_jukebox.py

documentation/builders/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
* [Audio](./audio.md)
1212
* [RFID](./rfid.md)
13+
* [GPIO Recipes](./gpio.md)
1314
* [Card Database](./card-database.md)
1415
* [Troubleshooting](./troubleshooting.md)
1516

@@ -19,6 +20,8 @@
1920
* [Auto Hotspot](./autohotspot.md)
2021
* [Concepts](./concepts.md)
2122
* [System](./system.md)
23+
* [RPC Commands](./rpc-commands.md)
24+
* [CLI Client for RPC](./cli-client.md)
2225
* [Feature Status](../developers/status.md)
2326
* [Known Issues](../developers/known-issues.md)
2427
* [Developer Reference](../developers/README.md)

0 commit comments

Comments
 (0)