Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/v1.2.1 #239

Merged
merged 2 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 51 additions & 52 deletions .github/workflows/integration_delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -292,8 +280,6 @@ jobs:
matrix:
suffix: ['lite', '']
steps:
- run: echo Building amd64-${{ matrix.suffix }} image

- name: Checkout
uses: actions/checkout@v4

Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<<EOF"
cat CURRENT_CHANGELOG.md
echo "EOF"
} >> "$GITHUB_OUTPUT"
} >>"$GITHUB_OUTPUT"

- name: Release
uses: softprops/action-gh-release@v2
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
16 changes: 8 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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]
Expand All @@ -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",
]


Expand Down
8 changes: 3 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading