Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1cef646
deps: migrate from poetry to uv
mik3y Aug 2, 2026
d908051
test: run the suite without a redis server via fakeredis
mik3y Aug 2, 2026
6de0cf1
fix: repair broken datetime conversion in protoutil
mik3y Aug 2, 2026
149c533
lint: adopt ruff for linting and formatting
mik3y Aug 2, 2026
0193d10
chore: modernize pre-commit (sync-with-uv + ruff)
mik3y Aug 2, 2026
330c11b
deps: upgrade to django 5.2 lts
mik3y Aug 2, 2026
0cd4aa3
django: adapt to django 5.2 removals and behavior changes
mik3y Aug 2, 2026
481593f
web: replace django-bootstrap-pagination with a paginator partial
mik3y Aug 2, 2026
e1a1a77
fix: log the new admin in at the end of the setup wizard
mik3y Aug 2, 2026
fdbb229
server: switch from gunicorn/gevent to waitress
mik3y Aug 2, 2026
72ca4f2
py3.14: drop python-gflags, modernize protobuf, fix removed stdlib
mik3y Aug 2, 2026
a2e5056
style: modernize syntax for python 3.14 (ruff pyupgrade sweep)
mik3y Aug 2, 2026
536598c
docker: build the image with uv on python 3.14
mik3y Aug 2, 2026
1fdb637
actions: modernize CI for uv and python 3.14
mik3y Aug 2, 2026
9cf5eb3
misc: update changelog
mik3y Aug 2, 2026
c7fff4f
deps: declare packaging as a runtime dependency
mik3y Aug 3, 2026
e2bbc3f
test: fix postgres-order-dependent meter/toggle api tests
mik3y Aug 3, 2026
cb82fa5
actions: bump docker actions to node 24 majors
mik3y Aug 3, 2026
4efc196
actions: tag "latest" from releases, not main
mik3y Aug 3, 2026
fa7c0ef
deps: drop unused packages, move fakeredis to dev
mik3y Aug 3, 2026
d6c291f
docs: fix the read the docs build for uv
mik3y Aug 3, 2026
34cb81f
commands: fix argument parsing in restore, create_api_key, rename_user
mik3y Aug 3, 2026
c2a72dd
backup: support restoring legacy format-1 (v1.1.x) backups
mik3y Aug 3, 2026
ef37c0b
backup: only reset sequences for restored models
mik3y Aug 3, 2026
5d2d166
backup: fix python 3 bitrot in the backup creation path
mik3y Aug 3, 2026
1786084
ci: test upgrades from a frozen v1.3 backup
mik3y Aug 3, 2026
56e6fcc
docker: install mysql and postgres client tools
mik3y Aug 3, 2026
8e35bc7
testdata: generate legacy backup fixtures with docker compose
mik3y Aug 3, 2026
8ef88ec
backup: skip mysql server cert verification in cli tools
mik3y Aug 3, 2026
29c0e8a
testdata: add frozen v1.3 backup fixtures
mik3y Aug 3, 2026
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
59 changes: 25 additions & 34 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,26 @@ jobs:
runs-on: ubuntu-latest

steps:
-
name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v6

-
name: Prepare
- name: Prepare
id: prepare
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
echo ::set-output name=tag_name::${TAG}
echo ::set-output name=version::${TAG%-*}
echo "tag_name=${TAG}" >> $GITHUB_OUTPUT
echo "version=${TAG%-*}" >> $GITHUB_OUTPUT
else
echo ::set-output name=version::snapshot
echo "version=snapshot" >> $GITHUB_OUTPUT
fi
echo ::set-output name=build_date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')

# Work around an armv7 -> qemu bug caused during rust compilation. Yeah.. See repo.
- name: Run Docker on tmpfs
uses: JonasAlfredsson/docker-on-tmpfs@v1
with:
tmpfs_size: 8
swap_size: 8
swap_location: '/mnt/swapfile'
echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v4

# Set up the tag(s) we will build/push. The `metadata-action` action has
# a bunch of rules and a little language for specifying this. This should
Expand All @@ -59,64 +49,65 @@ jobs:
# When What Example
# =================== ============================= =============
# All runs "dev" dev
# Merge to main "latest" latest
# Merge tag <tag> v1.2.3b1
# Merge semver tag <semver> 1.2.3
# Merge semver tag <major>.<minor> 1.2
-
name: Set up docker tag names
# Merge semver tag <major>.<minor> 1.2
# Merge semver tag "latest" (non-prerelease) latest
#
# Note that "latest" follows tagged releases (via `flavor: latest=auto`),
# NOT merges to main; main merges publish only "dev".
- name: Set up docker tag names
id: docker_meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=auto
tags: |
type=raw,value=dev
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Build locally
uses: docker/build-push-action@v3
uses: docker/build-push-action@v7
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
GIT_SHORT_SHA=${GITHUB_SHA::8}
VERSION=${{ steps.prepare.outputs.version }}
platforms: |
linux/amd64
linux/arm64
linux/arm/v7

- name: Log in to container registry
if: ${{ '${{ secrets.GITHUB_TOKEN }}' != '' }}
uses: docker/login-action@v2
if: ${{ github.event_name != 'pull_request' }}
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push to container registry
if: ${{ '${{ secrets.GITHUB_TOKEN }}' != '' }}
uses: docker/build-push-action@v3
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v7
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.docker_meta.outputs.labels }}
build-args: |
BUILD_DATE=${{ steps.prepare.outputs.build_date }}
GIT_SHORT_SHA=${GITHUB_SHA::8}
VERSION=${{ steps.prepare.outputs.version }}
platforms: |
linux/amd64
linux/arm64
linux/arm/v7
107 changes: 107 additions & 0 deletions .github/workflows/legacy-upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Legacy Upgrade Test

# Restores the frozen v1.3 backup zips committed under
# testdata/legacy-backups/, runs `kegbot upgrade`, and verifies the
# result. Because the committed zips are frozen, any future migration is
# tested against a database as it existed at v1.3.
#
# The zips are built locally with bin/generate-legacy-backups.sh (docker
# compose). The steps below self-skip while no zips are committed.

on:
push:
branches: [main]
pull_request:
branches: [main]

env:
REDIS_URL: redis://localhost:6379/0
KEGBOT_SECRET_KEY: changeme

jobs:
upgrade:
name: 'Upgrade from v1.3 (${{ matrix.database }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database: [mysql, postgres]
include:
- database: mysql
database_url: mysql://root:cipass@127.0.0.1/kegbot_ci
- database: postgres
database_url: postgres://postgres:cipass@127.0.0.1/kegbot_ci

services:
mysql:
image: ${{ matrix.database == 'mysql' && 'mysql:8' || '' }}
env:
MYSQL_ROOT_PASSWORD: cipass
MYSQL_DATABASE: kegbot_ci
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10

postgres:
image: ${{ matrix.database == 'postgres' && 'postgres:16' || '' }}
env:
POSTGRES_PASSWORD: cipass
POSTGRES_DB: kegbot_ci
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 10

redis:
image: redis
ports:
- 6379:6379

env:
DATABASE_URL: ${{ matrix.database_url }}
KEGBOT_DATA_DIR: ${{ github.workspace }}/kegbot-data

steps:
- uses: actions/checkout@v6

- name: Check for frozen backup
id: frozen
run: |
if [ -f "testdata/legacy-backups/kegbot-v1.3-${{ matrix.database }}.zip" ]; then
echo "present=true" >> "$GITHUB_OUTPUT"
else
echo "present=false" >> "$GITHUB_OUTPUT"
echo "No frozen backup committed yet; skipping."
fi

- name: Install uv
if: steps.frozen.outputs.present == 'true'
uses: astral-sh/setup-uv@v7

- name: Set up Python 3.14
if: steps.frozen.outputs.present == 'true'
uses: actions/setup-python@v6
with:
python-version: '3.14'

- name: Install system libraries
if: steps.frozen.outputs.present == 'true'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
default-libmysqlclient-dev libpq-dev pkg-config

- name: Install dependencies
if: steps.frozen.outputs.present == 'true'
run: uv sync --all-groups

- name: Restore v1.3 backup
if: steps.frozen.outputs.present == 'true'
run: uv run bin/kegbot restore testdata/legacy-backups/kegbot-v1.3-${{ matrix.database }}.zip

- name: Run upgrade
if: steps.frozen.outputs.present == 'true'
run: uv run bin/kegbot upgrade

- name: Verify upgraded site
if: steps.frozen.outputs.present == 'true'
run: uv run python bin/check-upgraded-site.py
87 changes: 69 additions & 18 deletions .github/workflows/pybuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,83 @@ name: Python Build & Test

on:
push:
branches:
- main
branches: [main]
pull_request:
branches:
- main
branches: [main]

jobs:
py_build_and_test:
test:
name: 'Build and test (${{ matrix.database }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
database: [sqlite, mysql, postgres]
include:
- database: sqlite
database_url: sqlite:///test-db.sqlite
- database: mysql
database_url: mysql://root:cipass@127.0.0.1/kegbot_ci
- database: postgres
database_url: postgres://postgres:cipass@127.0.0.1/kegbot_ci

services:
mysql:
image: ${{ matrix.database == 'mysql' && 'mysql:8' || '' }}
env:
MYSQL_ROOT_PASSWORD: cipass
MYSQL_DATABASE: kegbot_ci
ports:
- 3306:3306
options: --health-cmd "mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 10

postgres:
image: ${{ matrix.database == 'postgres' && 'postgres:16' || '' }}
env:
POSTGRES_PASSWORD: cipass
POSTGRES_DB: kegbot_ci
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 10

redis:
image: redis
ports:
- 6379:6379

env:
DATABASE_URL: ${{ matrix.database_url }}
REDIS_URL: redis://localhost:6379/0
KEGBOT_SECRET_KEY: changeme

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v6

- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Setup Python
uses: actions/setup-python@v1
- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: "3.10"
python-version: '3.14'

- name: Install dependencies
- name: Install system libraries
run: |
pip install poetry docker-compose
poetry install -n
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
default-libmysqlclient-dev libpq-dev pkg-config

- name: Run mysql & redis
run: |
docker-compose -f testdata/test-docker-compose.yml up -d
sleep 10 && ./bin/wait-for-container.sh testdata_mysql_1
- name: Install dependencies
run: uv sync --all-groups

- name: Run migrations
run: uv run bin/kegbot migrate --noinput

- name: Collect static files
run: uv run bin/kegbot collectstatic --noinput -v 0

- name: Run tests
run: uv run pytest

- name: pytest
run: DATABASE_URL=mysql://root:changeme@127.0.0.1:3306/kegbot_dev REDIS_URL=redis:// KEGBOT_SECRET_KEY=changeme poetry run pytest
- name: Run lint checks
run: uv run ruff check
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ docs/build
### pykeg
build
dist
test-db.sqlite
test-db.sqlite

/tmp
27 changes: 11 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
default_language_version:
python: python3.10
python: python3.14

repos:
- repo: https://github.com/floatingpurr/sync_with_poetry
rev: '0.1.0' # the revision or tag to clone at
- repo: https://github.com/tsvikas/sync-with-uv
rev: v0.4.0
hooks:
- id: sync_with_poetry
args: [] # optional args
additional_dependencies: ['poetry']
- id: sync-with-uv

- repo: https://github.com/pycqa/isort
rev: 5.10.1
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.1
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black

# Run the linter.
- id: ruff-check
args: [--fix]
# Run the formatter.
- id: ruff-format
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
Loading