Skip to content

Commit

Permalink
Merge branch 'MiczFlor:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
s-martin authored Jan 4, 2024
2 parents 8cbb269 + 430c622 commit 85a4e1b
Show file tree
Hide file tree
Showing 49 changed files with 501 additions and 862 deletions.
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
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/components/controls/buttons_usb_encoder/ @jeripeierSBB
/components/synchronisation/sync-shared @AlvinSchiller
/scripts/installscripts/buster-install-default.sh @jeripeierSBB
/scripts/installscripts/install-jukebox.sh @jeripeierSBB
/scripts/helperscripts/setup_autohotspot.sh @Groovylein
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ labels: bug, needs triage
### What I did

<!--
i.e. `I installed the raspberry pi with above mentioned buster image and ran the installer script`
i.e. `I installed the raspberry pi with below mentioned image and ran the installer script`
-->

### What happened
Expand Down Expand Up @@ -56,7 +56,7 @@ the following command will help with that
### Installscript

<!--
i.e. `scripts/installscripts/buster-install-default.sh`
i.e. `scripts/installscripts/install-jukebox.sh`
-->


Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ contact_links:
url: https://github.com/MiczFlor/RPi-Jukebox-RFID/discussions/new?category=q-a
about: This issue tracker is not for support questions. Please refer to our Discussions.
- name: 💬 Chat
url: https://gitter.im/phoniebox
url: https://matrix.to/#/#phoniebox_community:gitter.im
about: Want to discuss with others? Check out our chat.
96 changes: 96 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Release

on:
push:
branches:
- 'master'

jobs:

check:
if: ${{ github.repository_owner == 'MiczFlor' }}
runs-on: ubuntu-latest

outputs:
tag_name: ${{ steps.vars.outputs.tag_name }}
release_type: ${{ steps.vars.outputs.release_type }}
check_abort: ${{ steps.vars.outputs.check_abort }}

steps:
- uses: actions/checkout@v4

- name: Set Output vars
id: vars
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
# Official SemVer Regex definition
# https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
# Needed changes to the regex:
# - '?:' capture command needed to be removed as it wasn't working in shell
# - '\d' had to be replaced with [0-9]
#
# Release versions like 1.0.0, 3.5.0, 100.4.50000+metadata
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-]+)*))?$"
#
# Prerelease versions like 1.0.0-alpha, 3.5.0-whatsoever.12, 100.4.50000-identifier.12+metadata
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-]+)*))?$"
# Get the version and calculate release type
VERSION=$(cat ./settings/version-number)
if echo "$VERSION" | grep -qoE "$REGEX_VERSION_RELEASE" ; then
RELEASE_TYPE=release
elif echo "$VERSION" | grep -qoE "$REGEX_VERSION_PRERELEASE" ; then
RELEASE_TYPE=prerelease
else
RELEASE_TYPE=none
fi
if [ "$BRANCH_NAME" == 'master' -a "$RELEASE_TYPE" == 'release' ] ; then
CHECK_ABORT=false
else
echo "::notice title=Abort due to not matching ${RELEASE_TYPE} version for branch!::'${VERSION}' on '${BRANCH_NAME}'"
CHECK_ABORT=true
fi
echo "::group::Output values"
echo "Version: ${VERSION}"
echo "RELEASE_TYPE: ${RELEASE_TYPE}"
echo "BRANCH_NAME: ${BRANCH_NAME}"
echo "CHECK_ABORT: ${CHECK_ABORT}"
echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT
echo "release_type=${RELEASE_TYPE}" >> $GITHUB_OUTPUT
echo "branch_name=${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "check_abort=${CHECK_ABORT}" >> $GITHUB_OUTPUT
echo "::endgroup::"
release:
needs: [check]
if: ${{ needs.check.outputs.check_abort == 'false' }}
runs-on: ubuntu-latest

concurrency:
group: ${{ needs.check.outputs.tag_name }}

permissions:
contents: write

steps:
- name: Create Release
uses: ncipollo/release-action@v1
with:
commit: ${{ github.sha }}
tag: ${{ needs.check.outputs.tag_name }}
body: "Automated Release for ${{ needs.check.outputs.tag_name }}"
makeLatest: ${{ needs.check.outputs.release_type == 'release' }}
prerelease: ${{ needs.check.outputs.release_type == 'prerelease' }}
generateReleaseNotes: ${{ needs.check.outputs.release_type == 'release' }}
skipIfReleaseExists: false
allowUpdates: true
removeArtifacts: false
replacesArtifacts: false
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
token: ${{ secrets.GITHUB_TOKEN }}
30 changes: 25 additions & 5 deletions .github/workflows/test_docker_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,29 @@ on:
push:
branches-ignore:
- 'future3/**'
paths:
- '.github/workflows/test_docker_debian*.yml'
- 'ci/**'
- 'misc/sampleconfigs/**'
- 'scripts/helperscripts/setup_*'
- 'scripts/installscripts/**'
- 'settings/version-number'
- 'packages*.txt'
- 'requirements*.txt'
pull_request:
# The branches below must be a subset of the branches above
branches: [ develop ]
branches:
- develop
- main
paths:
- '.github/workflows/test_docker_debian*.yml'
- 'ci/**'
- 'misc/sampleconfigs/**'
- 'scripts/helperscripts/setup_*'
- 'scripts/installscripts/**'
- 'settings/version-number'
- 'packages*.txt'
- 'requirements*.txt'

# let only one instance run the test so cache is not corrupted.
# cancel already running instances as only the last run will be relevant
Expand All @@ -21,17 +41,17 @@ jobs:

# Build container and run tests
run:
name: ${{ matrix.debian_version_name }}
name: ${{ matrix.debian_codename }}
strategy:
fail-fast: false
matrix:
debian_version_name: ['bullseye', 'buster', 'bookworm']
uses: ./.github/workflows/test_docker_debian_versionname_sub.yml
debian_codename: ['bookworm', 'bullseye', 'buster']
uses: ./.github/workflows/test_docker_debian_codename_sub.yml
with:
runs_on: ubuntu-latest
platform: linux/arm/v7
docker_image_name: rpi-jukebox-rfid
cache_scope: ${{ github.ref }}-test-debian
matrix_usernames: "['pi', 'hans']"
matrix_test_scripts: "['run_installation_tests.sh', 'run_installation_tests2.sh', 'run_installation_tests3.sh']"
debian_version_name: ${{ matrix.debian_version_name }}
debian_codename: ${{ matrix.debian_codename }}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
platform:
required: true
type: string
debian_version_name:
debian_codename:
required: true
type: string
cache_scope:
Expand All @@ -32,7 +32,7 @@ on:
# let only one instance run the test so cache is not corrupted.
# cancel already running instances as only the last run will be relevant
concurrency:
group: ${{ inputs.cache_scope }}-${{ inputs.debian_version_name }}
group: ${{ inputs.cache_scope }}-${{ inputs.debian_codename }}
cancel-in-progress: true

jobs:
Expand All @@ -43,7 +43,7 @@ jobs:

outputs:
cache_key: ${{ steps.vars.outputs.cache_key }}
image_file_path: ${{ steps.vars.outputs.image_file_path }}
image_file_name: ${{ steps.vars.outputs.image_file_name }}
image_tag_name: ${{ steps.vars.outputs.image_tag_name }}

# create local docker registry to use locally build images
Expand All @@ -68,23 +68,23 @@ jobs:
- name: Set Output pre-vars
id: pre-vars
env:
DEBIAN_VERSION_NAME: ${{ inputs.debian_version_name }}
DEBIAN_CODENAME: ${{ inputs.debian_codename }}
DOCKER_IMAGE_NAME: ${{ inputs.docker_image_name }}
CACHE_SCOPE: ${{ inputs.cache_scope }}
run: |
echo "image_tag_name=${{ env.DOCKER_IMAGE_NAME }}:${{ env.DEBIAN_VERSION_NAME }}-test" >> $GITHUB_OUTPUT
echo "cache_scope=${{ env.CACHE_SCOPE }}-${{ env.DEBIAN_VERSION_NAME }}" >> $GITHUB_OUTPUT
echo "image_tag_name=${{ env.DOCKER_IMAGE_NAME }}:${{ env.DEBIAN_CODENAME }}-test" >> $GITHUB_OUTPUT
echo "image_file_name=${{ env.DOCKER_IMAGE_NAME }}-${{ env.DEBIAN_CODENAME }}.tar" >> $GITHUB_OUTPUT
echo "cache_scope=${{ env.CACHE_SCOPE }}-${{ env.DEBIAN_CODENAME }}" >> $GITHUB_OUTPUT
- name: Set Output vars
id: vars
env:
DEBIAN_VERSION_NAME: ${{ inputs.debian_version_name }}
DOCKER_IMAGE_NAME: ${{ inputs.docker_image_name }}
LOCAL_REGISTRY_PORT: ${{ inputs.local_registry_port }}
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_path=./${{ env.DOCKER_IMAGE_NAME }}-${{ env.DEBIAN_VERSION_NAME }}.tar" >> $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
Expand All @@ -102,7 +102,7 @@ jobs:
cache-from: type=gha,scope=${{ steps.vars.outputs.cache_scope }}
cache-to: type=gha,mode=max,scope=${{ steps.vars.outputs.cache_scope }}
build-args: |
DEBIAN_VERSION_NAME=${{ inputs.debian_version_name }}
DEBIAN_CODENAME=${{ inputs.debian_codename }}
GIT_BRANCH=${{ github.head_ref || github.ref_name }}
GIT_URL=${{ github.server_url }}/${{ github.event.pull_request.head.repo.full_name || github.repository }}
Expand All @@ -123,12 +123,12 @@ jobs:
build-args: |
BASE_TEST_IMAGE=${{ steps.vars.outputs.image_tag_name_local_base }}
# Cache image file for next jobs
- name: Cache Save Docker Image
uses: actions/cache/save@v3
- name: Artifact Upload Docker Image
uses: actions/upload-artifact@v3
with:
key: ${{ steps.vars.outputs.cache_key }}
name: ${{ steps.vars.outputs.image_file_name }}
path: ${{ steps.vars.outputs.image_file_path }}
retention-days: 2


# Run tests with build image
Expand All @@ -149,24 +149,34 @@ jobs:
- name: Set up Docker Buildx
uses: docker/[email protected]

# Load cached image file
- name: Cache Restore Docker Image
uses: actions/cache/restore@v3
- name: Artifact Download Docker Image
uses: actions/download-artifact@v3
with:
key: ${{ needs.build.outputs.cache_key }}
path: ${{ needs.build.outputs.image_file_path }}
fail-on-cache-miss: true
name: ${{ needs.build.outputs.image_file_name }}

- name: Load Docker Image
run: |
docker load --input ${{ needs.build.outputs.image_file_path }}
docker load --input ${{ needs.build.outputs.image_file_name }}
# Run test
- name: Run Test ${{ inputs.debian_version_name }}-${{ matrix.username }}-${{ matrix.test_script }}
- name: Run Test ${{ inputs.debian_codename }}-${{ matrix.username }}-${{ matrix.test_script }}
uses: tj-actions/docker-run@v2
with:
image: ${{ needs.build.outputs.image_tag_name }}
options: --platform ${{inputs.platform }} --user ${{ matrix.username }}
name: ${{ matrix.test_script }}
args: |
./${{ matrix.test_script }}
# cleanup after test execution
cleanup:
# run only if tests didn't fail: keep the artifact to make job reruns possible
if: ${{ !failure() }}
needs: [build, test]
runs-on: ${{ inputs.runs_on }}

steps:
- name: Artifact Delete Docker Image
uses: geekyeggo/delete-artifact@v2
with:
name: ${{ needs.build.outputs.image_file_name }}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ If the code change results in a test failure, we will make our best effort to co
### Guidelines
* Currently Phoniebox runs on Raspian **Buster** . Therefore all Python code should work with **Python 3.7**.
* The oldest supported Raspberry Pi OS version is currently **Buster**. Therefore all Python code should work with **Python 3.7**.
* For GPIO all code should work with **RPi.GPIO**. gpiozero is currently not intended to use.
### Additional Resources
Expand Down
Loading

0 comments on commit 85a4e1b

Please sign in to comment.