Skip to content

Commit

Permalink
v0.7.0 (#3)
Browse files Browse the repository at this point in the history
* Fix build.yml

* Fix build.yml

* Fix build.yml

* pylint fixes & adjustments + move driver.json and adjust docker-entry for build process

* Fix moving wrong file

* Fix

* Fix build.yml

* Create test.yml action

* Fix test.yml

* Rename setup.json to driver.json

* Fix

* Update build.yml

* Update build.yml

* Update build.yml

* Trigger build.yml

* Trigger build.yml

* Update

* Update build.yml

* Update build.yml

* Update build.yml

* Update build.yml

* Various updates

* Delete config.json

* Updates

* Updates

* Fixes

* Update

* Fix

* Fix

* Fix

* Fix

* Fix

* Version update test

* Fix

* Delete manual-build+upload.sh

* Small fixes

* Update

* Updates

* Updates

* Update custom integration install infos

* Update build
  • Loading branch information
kennymc-c authored Sep 20, 2024
1 parent 074c85a commit 4d71dd1
Show file tree
Hide file tree
Showing 11 changed files with 406 additions and 259 deletions.
88 changes: 33 additions & 55 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
# GitHub Action to build a self-contained binary of the Sony SDCP Python driver
# Manual triggered GitHub action to build a distribution binary of the Python integration driver and attach it to a release draft including a hash file
---
name: "Build & Release"
name: "Build & Draft Release"

on:
workflow_dispatch:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+*

env:
INTG_NAME: sonysdcp
HASH_FILENAME: intg-sonysdcp.hash
# Python version to use in the builder image. See https://hub.docker.com/r/unfoldedcircle/r2-pyinstaller for possible versions.
PYTHON_VER: 3.11.6-0.2.0

jobs:
build:
name: Build Release
runs-on: ubuntu-latest
#Save version to env output variable to be able to use it in the following release job as a tag
outputs:
version: ${{ steps.get-version-and-id.outputs.VERSION }}
driver_id: ${{ steps.get-version-and-id.outputs.DRIVER_ID }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# History of 200 should be more than enough to calculate commit count since last release tag.
# History of 200 should be more than enough to calculate commit count since last release tag
fetch-depth: 200

- name: Fetch all tags to determine version
- name: Get version and id
#Id needed for env output variable
id: get-version-and-id
run: |
git fetch origin +refs/tags/*:refs/tags/*
echo "VERSION=$(git describe --match "v[0-9]*" --tags HEAD --always)" >> $GITHUB_ENV
- name: Verify driver.json version for release build
if: contains(github.ref, 'tags/v')
run: |
DRIVER_VERSION="v$(jq .version -r intg-sonysdcp/driver.json)"
if [ "${{ env.VERSION }}" != "$DRIVER_VERSION" ]; then
echo "Version in driver.json ($DRIVER_VERSION) doesn't match git version tag (${{ env.VERSION }})!"
exit 1
fi
echo "VERSION=$(jq .version -r driver.json)" >> $GITHUB_ENV
echo "DRIVER_ID=$(jq .driver_id -r driver.json)" >> $GITHUB_ENV
# Save to Github output to later use it in Create Release job
echo "VERSION=$(jq .version -r driver.json)" >> $GITHUB_OUTPUT
echo "DRIVER_ID=$(jq .driver_id -r driver.json)" >> $GITHUB_OUTPUT
- name: Build
run: |
Expand All @@ -51,22 +48,18 @@ jobs:
bash -c \
"cd /workspace && \
python -m pip install -r requirements.txt && \
pyinstaller --clean --onefile --name intg-sonysdcp --collect-all zeroconf intg-sonysdcp/driver.py"
- name: Add version
run: |
mkdir -p artifacts
cd artifacts
echo ${{ env.VERSION }} > version.txt
pyinstaller --clean --onedir --name intg-${DRIVER_ID} --collect-all zeroconf intg-${INTG_NAME}/driver.py"
- name: Prepare artifacts
shell: bash
run: |
cp dist/intg-sonysdcp/driver.json artifacts/
cp dist/intg-sonysdcp artifacts/
echo "ARTIFACT_NAME=uc-intg-${{ env.INTG_NAME }}-${{ env.VERSION }}-aarch64" >> $GITHUB_ENV
mkdir -p artifacts/bin
mv dist/intg-${{ env.DRIVER_ID }}/* artifacts/bin
mv artifacts/bin/intg-${{ env.DRIVER_ID }} artifacts/bin/driver
cp driver.json artifacts/
echo "ARTIFACT_NAME=uc-intg-${{ env.DRIVER_ID }}-${{ env.VERSION }}-aarch64" >> $GITHUB_ENV
- name: Create upload artifact
- name: Create upload artifact archive
shell: bash
run: |
tar czvf ${{ env.ARTIFACT_NAME }}.tar.gz -C ${GITHUB_WORKSPACE}/artifacts .
Expand All @@ -82,9 +75,10 @@ jobs:

release:
name: Create Release
if: github.ref == 'refs/heads/main' || contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write

steps:
- name: Download build artifacts
Expand All @@ -101,31 +95,15 @@ jobs:
fi
done;
# Use a common timestamp for all matrix build artifacts
- name: Get timestamp
run: |
echo "TIMESTAMP=$(date +"%Y%m%d_%H%M%S")" >> $GITHUB_ENV
# Add timestamp to development builds
- name: Create GitHub development build archives
if: "!contains(github.ref, 'tags/v')"
run: |
# append timestamp
for filename in *.tar.gz; do mv $filename "$(basename $filename .tar.gz)-${{ env.TIMESTAMP }}.tar.gz"; done;
for filename in *.tar.gz; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME }}; done;
- name: Create GitHub release archives
if: "contains(github.ref, 'tags/v')"
- name: Create hash file
run: |
for filename in *.tar.gz; do echo "sha256 `sha256sum $filename`" >> ${{ env.HASH_FILENAME }}; done;
for filename in *.tar.gz; do echo "sha256 `sha256sum $filename`" >> ${{needs.build.outputs.driver_id}}.hash; done;
- name: Create Release
uses: "marvinpinto/action-automatic-releases@latest"
if: "contains(github.ref, 'tags/v')"
- name: Create release draft
uses: ncipollo/release-action@v1
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
artifacts: "*.tar.gz,${{needs.build.outputs.driver_id}}.hash"
draft: true
files: |
*.tar.gz
${{ env.HASH_FILENAME }}
generateReleaseNotes: true
artifactErrorsFailBuild: true
tag: v${{needs.build.outputs.version}}
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,6 @@ FodyWeavers.xsd
*.sln.iml

# Test and config files
intg-sonysdcp/pysdcp_test.py
intg-sonysdcp/config.json
intg-sonysdcp/config-test.json
.venv/
config.json
.venv/
manual-build+upload.sh
29 changes: 29 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[FORMAT]

# Maximum number of characters on a single line.
max-line-length=175

[MESSAGES CONTROL]

# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then re-enable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"

disable=
global-statement,
too-many-instance-attributes,
too-many-arguments,
too-many-public-methods,
fixme # temporary

[STRING]

# This flag controls whether inconsistent-quotes generates a warning when the
# character used as a quote delimiter is used inconsistently within a module.
check-quote-consistency=yes
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

*Changes in the next release*

## [0.7.0-beta] - 2024-09-20

### Breaking changes
- **🎉 This integration can now also run on the remote as a custom integration driver. From now on each release will have a tar.gz file attached that can be installed on the remote** (see [Run on the remote](/README.md#Run-on-the-remote-as-a-custom-integration-driver))
- ⚠️ Running custom integrations on the remote is currently only available in beta firmware releases and requires version 1.9.2 or newer. Please keep in mind that due to the beta status there are missing firmware features that require workarounds (see link above) and that changes in future beta updates may temporarily or permanently break the functionality of this integration as a custom integration. Please wait until custom integrations are available in stable firmware releases if you don't want to take these risks.
- When running as an external integration driver the working directory when starting driver.py should now be the root of the repository. The path in docker-entry.sh has been adjusted. The configuration json file is therefore now created in the root of the integration directory. Existing users have to move config.json from the intg-sonysdcp directory

### Added
- Add build.yml Github action to automatically build a self-contained binary of the integration and create a release draft with the current driver version as a tag/name

### Changed
- Deactivate the attributes poller task when the integration runs on the remote as a custom integration driver.
- The reason for this is to reduce battery consumption and save cpu/memory usage. Also this function is just needed if you control the projector alternating with a second device. In a future release this setting may also be adjustable in the integration setup.
- Due to the custom integration upload feature setup.json has been renamed to driver.json and moved to the root of the repository
- Corrected the semantic version scheme in driver.json (x.x to x.x.x)



## [0.6-beta] - 2024-05-11

### Added
Expand All @@ -20,6 +38,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Replaced a variable reference log warning message with a clearer error description. This message appears if attributes of an entity should be updated that the remote has not yet subscribed to, e.g. shortly after the integration setup has been completed or if the integration configuration has been deleted just on the remote side.



## [0.5-beta] - 2024-05-05

### Changed
Expand All @@ -28,6 +48,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed attributes poller not running due to a check against an API function that has not been implemented in the remote core (get_configured_entities)



## [0.4-beta] - 2024-05-03

### Added
Expand All @@ -39,6 +61,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- The CURSOR_LEFT command has been mapped to the back command on the remote as in most cases this has the same function as a typical back command that the projector doesn't have



## [0.3-beta] - 2024-04-17

### Added
Expand All @@ -49,6 +73,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Split up setup flow and media player into separate files
- Optimize SDAP setup flow



## [0.2-beta] - 2024-04-04

### Breaking Changes
Expand All @@ -65,6 +91,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed a naming problem for picture presets
- Corrected minimum WS Core API version in setup.json to 0.24.3. Previous version was a REST API version number



## [0.1-beta] - 2024-03-24

### Added
Expand Down
Loading

0 comments on commit 4d71dd1

Please sign in to comment.