diff --git a/.github/workflows/integration_delivery.yml b/.github/workflows/integration_delivery.yml index 547011e2..ead7c0fb 100644 --- a/.github/workflows/integration_delivery.yml +++ b/.github/workflows/integration_delivery.yml @@ -55,7 +55,7 @@ jobs: - name: Extract Python Version id: get-python-version run: | - echo "PYTHON_VERSION=$(python --version | cut -d' ' -f2)" >> $GITHUB_OUTPUT + echo "PYTHON_VERSION=$(python --version | cut -d' ' -f2)" >>$GITHUB_OUTPUT echo "PYTHON_VERSION=$(python --version | cut -d' ' -f2)" - name: Install uv @@ -158,8 +158,10 @@ jobs: uv venv --system-site-packages - name: Run Tests + env: + THREADS: ${{ startsWith(matrix.runner, 'ubo-pod') && '1' || 'auto' }} run: | - uv run --frozen poe test --verbosity=2 --make-screenshots --cov-report=xml --cov-report=html --log-level=DEBUG --log-cli-level=5 -n ${{ startsWith(matrix.runner, 'ubo-pod') && '1' || 'auto' }} + uv run --frozen poe test --verbosity=2 --make-screenshots --cov-report=xml --cov-report=html --log-level=DEBUG --log-cli-level=5 -n "$THREADS" - name: Collect Window Screenshots uses: actions/upload-artifact@v4 @@ -219,46 +221,32 @@ jobs: run: | git fetch --prune --unshallow git fetch --depth=1 origin +refs/tags/*:refs/tags/* - echo "VERSION=$(uvx hatch version)" >> "$GITHUB_OUTPUT" + echo "VERSION=$(uvx hatch version)" >>"$GITHUB_OUTPUT" echo "VERSION=$(uvx hatch version)" - echo "NAME=$(uvx hatch project metadata | jq -r .name)" >> "$GITHUB_OUTPUT" + echo "NAME=$(uvx hatch project metadata | jq -r .name)" >>"$GITHUB_OUTPUT" echo "NAME=$(uvx hatch project metadata | jq -r .name)" - - name: Extract Version from CHANGELOG.md - run: | - FIRST_HEADER=$(sed -n '/## /s/## //p' CHANGELOG.md | head -n 1) - if [ "$FIRST_HEADER" == "Upcoming" ]; then - if [[ "${{ steps.extract-version.outputs.VERSION }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.dev[0-9]+ ]]; then - VERSION_CHANGELOG="This is a development version." - else - echo "Error: First header in CHANGELOG.md is 'Upcoming' but the version in pyproject.toml is not a development version." - exit 1 - fi - else - VERSION_CHANGELOG=$(echo $FIRST_HEADER | sed 's/Version //') - if [[ "${{ steps.extract-version.outputs.VERSION }}" =~ ^$VERSION_CHANGELOG\.dev[0-9]+ ]]; then - echo "Error: Version extracted from CHANGELOG.md does not match the version in pyproject.toml" - exit 1 - else - echo "Versions are consistent." - fi - fi - - name: Configure Sentry + env: + VERSION: ${{ steps.extract-version.outputs.VERSION }} + SENTRY_DSN: ${{ secrets.SENTRY_DSN }} + GITHUB_EVENT_NAME: ${{ github.event_name }} + GITHUB_REF: ${{ github.ref }} + GITHUB_SHA: ${{ github.sha }} run: | - echo "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" >> ubo_app/.env + echo "SENTRY_DSN=$SENTRY_DSN" >>ubo_app/.env # conditionally set it based on whether it's a tag or not using github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') - if [ "${{ github.event_name }}" == "push" ] && [ "$(echo ${{ github.ref }} | grep -c 'refs/tags/v')" -eq 1 ]; then - echo "SENTRY_RELEASE=ubo-app@${{ steps.extract-version.outputs.VERSION }}" >> ubo_app/.env + if [ "$GITHUB_EVENT_NAME" == "push" ] && [ "$(echo $GITHUB_REF | grep -c 'refs/tags/v')" -eq 1 ]; then + echo "SENTRY_RELEASE=ubo-app@$VERSION" >>ubo_app/.env else - echo "SENTRY_RELEASE=ubo-app@${{ github.sha }}" >> ubo_app/.env + echo "SENTRY_RELEASE=ubo-app@$GITHUB_SHA" >>ubo_app/.env fi cat ubo_app/.env - name: Build - run: - SETUPTOOLS_SCM_PRETEND_VERSION=${{ - steps.extract-version.outputs.VERSION }} uv build + env: + VERSION: ${{ steps.extract-version.outputs.VERSION }} + run: SETUPTOOLS_SCM_PRETEND_VERSION=$VERSION uv build - name: Upload wheel uses: actions/upload-artifact@v4 @@ -292,8 +280,6 @@ jobs: matrix: suffix: ['lite', ''] steps: - - run: echo Building amd64-${{ matrix.suffix }} image - - name: Checkout uses: actions/checkout@v4 @@ -309,24 +295,32 @@ jobs: - name: Generate Image URL and Checksum id: generate-image-url + env: + MATRIX_SUFFIX: ${{ matrix.suffix }} run: | SUFFIX="" - if [ -n "${{ matrix.suffix }}" ]; then - SUFFIX="_${{ matrix.suffix }}" + if [ -n "$MATRIX_SUFFIX" ]; then + SUFFIX="_$MATRIX_SUFFIX" fi DASHED_SUFFIX=$(echo $SUFFIX | sed 's/_/-/g') IMAGE_DATE='2024-11-19' IMAGE_NAME="${IMAGE_DATE}-raspios-bookworm-arm64${DASHED_SUFFIX}" IMAGE_URL="https://downloads.raspberrypi.com/raspios${SUFFIX}_arm64/images/raspios${SUFFIX}_arm64-${IMAGE_DATE}/${IMAGE_NAME}.img.xz" CHECKSUM_URL="${IMAGE_URL}.sha256" - echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT" - echo "dashed_suffix=$DASHED_SUFFIX" >> "$GITHUB_OUTPUT" - echo "image_url=$IMAGE_URL" >> "$GITHUB_OUTPUT" - echo "image_name=$IMAGE_NAME" >> "$GITHUB_OUTPUT" - echo "image_checksum_url=$CHECKSUM_URL" >> "$GITHUB_OUTPUT" - IMAGE_SIZE_GB=${{ matrix.suffix == 'lite' && '4.5' || matrix.suffix == '' && '6.75' || '13' }} + echo "suffix=$SUFFIX" >>"$GITHUB_OUTPUT" + echo "dashed_suffix=$DASHED_SUFFIX" >>"$GITHUB_OUTPUT" + echo "image_url=$IMAGE_URL" >>"$GITHUB_OUTPUT" + echo "image_name=$IMAGE_NAME" >>"$GITHUB_OUTPUT" + echo "image_checksum_url=$CHECKSUM_URL" >>"$GITHUB_OUTPUT" + if $MATRIX_SUFFIX == 'lite'; then + IMAGE_SIZE_GB=4.5 + elif $MATRIX_SUFFIX == ''; then + IMAGE_SIZE_GB=6.75 + else + IMAGE_SIZE_GB=13 + fi IMAGE_SIZE=$(awk -v IMAGE_SIZE_GB=$IMAGE_SIZE_GB 'BEGIN {printf "%.0f", IMAGE_SIZE_GB * 1024 ^ 3}') - echo "image_size=$IMAGE_SIZE" >> "$GITHUB_OUTPUT" + echo "image_size=$IMAGE_SIZE" >>"$GITHUB_OUTPUT" - name: Build Artifact env: @@ -354,8 +348,11 @@ jobs: losetup -d $LOOP_DEV - name: Compress File with Gzip + env: + VERSION: ${{ needs.build.outputs.version }} + DASHED_SUFFIX: ${{ steps.generate-image-url.outputs.dashed_suffix }} run: | - scripts/consume.sh /build/image.img | gzip -9 > /ubo_app-${{ needs.build.outputs.version }}-bookworm${{ steps.generate-image-url.outputs.dashed_suffix }}.img.gz + scripts/consume.sh /build/image.img | gzip -9 >/ubo_app-$VERSION-bookworm$DASHED_SUFFIX.img.gz - name: Upload Image uses: actions/upload-artifact@v4 @@ -371,12 +368,10 @@ jobs: publish: name: Publish if: >- - (github.event_name == 'push' && github.ref == 'refs/heads/main') || - (github.event_name == 'pull_request' && github.event.action == 'closed' && - github.event.pull_request.merged == true && - github.event.pull_request.base.ref == 'main' && - startsWith(github.event.pull_request.head.ref, 'release/')) || - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')) + github.event_name == 'pull_request' && github.event.action == 'closed' && + github.event.pull_request.merged == true && + github.event.pull_request.base.ref == 'main' && + startsWith(github.event.pull_request.head.ref, 'release/') needs: - type-check - lint @@ -407,7 +402,11 @@ jobs: packages-dir: dist release: - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + if: >- + github.event_name == 'pull_request' && github.event.action == 'closed' && + github.event.pull_request.merged == true && + github.event.pull_request.base.ref == 'main' && + startsWith(github.event.pull_request.head.ref, 'release/') name: Release needs: - type-check @@ -468,12 +467,12 @@ jobs: - name: Extract Changelog id: changelog run: | - perl -0777 -ne 'while (/## Version ${{ needs.build.outputs.version }}\n(\s*\n)*(.*?)(\s*\n)*## Version \d+\.\d+\.\d+\n/sg) {print "$2\n"}' CHANGELOG.md > CURRENT_CHANGELOG.md + perl -0777 -ne 'while (/## Version ${{ needs.build.outputs.version }}\n(\s*\n)*(.*?)(\s*\n)*## Version \d+\.\d+\.\d+\n/sg) {print "$2\n"}' CHANGELOG.md >CURRENT_CHANGELOG.md { echo "CONTENT<> "$GITHUB_OUTPUT" + } >>"$GITHUB_OUTPUT" - name: Release uses: softprops/action-gh-release@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index a651bfd4..becd7330 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Version 1.2.1 + +- fix: tenacity is now a production dependency + ## Version 1.2.0 - chore: add `log_async_process` to log the output of an async processes in a notification if they don't run successfully @@ -27,7 +31,7 @@ - feat(web-ui): add `ubo-redirect-server` service - refactor(web-ui): add notifications for when starting/stopping the hotspot fails in the system manager - refactor(web-ui): move starting/stopping of the required hotspot system services to the `ubo-hotspot` service (the more general version of the `ubo-redirect-server` service which runs the redirect server as its main process.) -- fix(core): uninstall RPi.GPIO after installing python packages in `install.sh` related: https://github.com/adafruit/Adafruit_Blinka/issues/910 - closes #231 +- fix(core): uninstall RPi.GPIO after installing python packages in `install.sh` [related](https://github.com/adafruit/Adafruit_Blinka/issues/910) - closes #231 - fix(web-ui): avoid web-ui stop procedure being triggered when qr-code input is cancelled - fix(system): run `time.sleep` for both branches of the ping loop (success and failure) to avoid high cpu usage of the system process - fix(camera): avoid values read from qrcode being overridden by `None` values of alternative patterns - closes #230 diff --git a/README.md b/README.md index 879ce49d..5a39b414 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🚀 Ubo App -[!PyPI version](https://img.shields.io/pypi/v/ubo-app.svg)](https://pypi.python.org/pypi/ubo-app) +[![PyPI version](https://img.shields.io/pypi/v/ubo-app.svg)](https://pypi.python.org/pypi/ubo-app) [![License](https://img.shields.io/pypi/l/ubo-app.svg)](https://github.com/ubopod/ubo-app/LICENSE) [![Python version](https://img.shields.io/pypi/pyversions/ubo-app.svg)](https://pypi.python.org/pypi/ubo-app) [![Actions status](https://github.com/ubopod/ubo-app/workflows/CI/CD/badge.svg)](https://github.com/ubopod/ubo-app/actions) diff --git a/pyproject.toml b/pyproject.toml index c51e7e7b..09cab40a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,12 +24,15 @@ dependencies = [ "python-fake >=0.1.3", "python-redux >=0.18.3", "python-strtobool >=1.0.0", + "pythonping >=1.1.4", "pyzbar >=0.1.9", + "quart >=0.19.6", "rpi_ws281x >=5.0.0 ; platform_machine=='aarch64'", "sdbus-networkmanager >=2.0.0 ; platform_machine=='aarch64'", "semver >=3.0.2", "sentry-sdk >=1.43.0", "simpleaudio >=1.0.4", + "tenacity >=8.2.3", "ubo-gui >=0.13.10", # Adafruit dependencies "adafruit-circuitpython-aw9523 >=1.1.7", @@ -44,9 +47,6 @@ dependencies = [ # gRPC "betterproto [compiler] >=2.0.0b7", "gpiozero >=2.0.1 ; platform_machine != 'aarch64'", - "pythonping >=1.1.4", - "quart >=0.19.6", - "ruff>=0.9.6", ] [build-system] @@ -70,21 +70,21 @@ packages = ["ubo_app"] [tool.uv] dev-dependencies = [ + "grpcio-tools >=1.66.1", "headless-kivy [test] >=0.12.1", + "ipython >=8.23.0", "poethepoet >=0.24.4", + "pyfakefs", "pyright >=1.1.389", "pytest >=8.0.0", "pytest-asyncio >=0.23.5.post1", "pytest-cov >=4.1.0", + "pytest-mock >=3.14.0", "pytest-timeout >=2.3.1", "pytest-xdist >=3.5.0", "ruff >=0.9.6", - "tenacity >=8.2.3", + "ruff >=0.9.6", "toml >=0.10.2", - "pytest-mock >=3.14.0", - "ipython >=8.23.0", - "pyfakefs", - "grpcio-tools >=1.66.1", ] diff --git a/uv.lock b/uv.lock index 85f1fcdd..12aba9bb 100644 --- a/uv.lock +++ b/uv.lock @@ -1701,7 +1701,7 @@ wheels = [ [[package]] name = "ubo-app" -version = "1.0.1.dev48+unknown" +version = "1.2.1.dev0+unknown" source = { editable = "." } dependencies = [ { name = "adafruit-circuitpython-aw9523" }, @@ -1733,11 +1733,11 @@ dependencies = [ { name = "quart" }, { name = "rpi-lgpio", marker = "platform_machine == 'aarch64'" }, { name = "rpi-ws281x", marker = "platform_machine == 'aarch64'" }, - { name = "ruff" }, { name = "sdbus-networkmanager", marker = "platform_machine == 'aarch64'" }, { name = "semver" }, { name = "sentry-sdk" }, { name = "simpleaudio" }, + { name = "tenacity" }, { name = "ubo-gui" }, ] @@ -1756,7 +1756,6 @@ dev = [ { name = "pytest-timeout" }, { name = "pytest-xdist" }, { name = "ruff" }, - { name = "tenacity" }, { name = "toml" }, ] @@ -1791,11 +1790,11 @@ requires-dist = [ { name = "quart", specifier = ">=0.19.6" }, { name = "rpi-lgpio", marker = "platform_machine == 'aarch64'", specifier = ">=0.6" }, { name = "rpi-ws281x", marker = "platform_machine == 'aarch64'", specifier = ">=5.0.0" }, - { name = "ruff", specifier = ">=0.9.6" }, { name = "sdbus-networkmanager", marker = "platform_machine == 'aarch64'", specifier = ">=2.0.0" }, { name = "semver", specifier = ">=3.0.2" }, { name = "sentry-sdk", specifier = ">=1.43.0" }, { name = "simpleaudio", specifier = ">=1.0.4" }, + { name = "tenacity", specifier = ">=8.2.3" }, { name = "ubo-gui", specifier = ">=0.13.10" }, ] @@ -1814,7 +1813,6 @@ dev = [ { name = "pytest-timeout", specifier = ">=2.3.1" }, { name = "pytest-xdist", specifier = ">=3.5.0" }, { name = "ruff", specifier = ">=0.9.6" }, - { name = "tenacity", specifier = ">=8.2.3" }, { name = "toml", specifier = ">=0.10.2" }, ]