Modernized codebase with tooling configuration and CI/CD workflows.
- Replaced legacy typing (Optional, List, Type, Union, Tuple) with PEP 604/585 equivalents. - Added pyproject.toml with configurations for hatch-vcs, mypy, ruff, and codespell. - Added CI workflows for formatting, linting, type checking, and spelling. - Added CD workflow for building and uploading plugin artifacts on push to master and version tags. - Added dependency auditing workflow with pip-audit. - Added comprehensive docstrings and inline comments across all modules. - Fixed User-Agent header using hardcoded version instead of actual plugin version. - Fixed grammar and terminology in log messages and comments. - Removed unreachable error handling branch in unsubscribe command.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
name: Audit
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * 1"
|
||||
push:
|
||||
paths: [uv.lock]
|
||||
pull_request:
|
||||
paths: [uv.lock]
|
||||
|
||||
jobs:
|
||||
audit:
|
||||
name: Dependencies
|
||||
runs-on: logaldeveloper-archlinux
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Cache uv packages
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
with:
|
||||
path: ~/.cache/uv
|
||||
key: uv-${{ hashFiles('uv.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --frozen
|
||||
|
||||
- name: Audit dependencies with pip-audit
|
||||
run: uv run pip-audit --skip-editable
|
||||
@@ -0,0 +1,46 @@
|
||||
name: CD
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
tags: ["v*"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: logaldeveloper-archlinux
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache uv packages
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
with:
|
||||
path: ~/.cache/uv
|
||||
key: uv-${{ hashFiles('uv.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --frozen
|
||||
|
||||
- name: Compute version
|
||||
id: version
|
||||
run: |
|
||||
version=$(uv run hatch version)
|
||||
echo "version=$version"
|
||||
echo "version=$version" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Write version into maubot.yaml
|
||||
run: |
|
||||
sed -i "s/^version: .*/version: ${{ steps.version.outputs.version }}/" maubot.yaml
|
||||
grep "^version:" maubot.yaml
|
||||
|
||||
- name: Build plugin
|
||||
run: uv run mbc build -o owncastsentry-v${{ steps.version.outputs.version }}.mbp
|
||||
|
||||
- name: Upload plugin artifact
|
||||
uses: https://github.com/christopherhx/gitea-upload-artifact@62ac910c5d3dfa85c7cb2df15afe2e342b2407c2 # v4
|
||||
with:
|
||||
name: owncastsentry-v${{ steps.version.outputs.version }}
|
||||
path: owncastsentry-v${{ steps.version.outputs.version }}.mbp
|
||||
@@ -0,0 +1,82 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
formatting:
|
||||
name: Formatting
|
||||
runs-on: logaldeveloper-archlinux
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Cache uv packages
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
with:
|
||||
path: ~/.cache/uv
|
||||
key: uv-${{ hashFiles('uv.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --frozen
|
||||
|
||||
- name: Check formatting with Ruff
|
||||
run: uv run ruff format --check --diff .
|
||||
|
||||
linting:
|
||||
name: Linting
|
||||
runs-on: logaldeveloper-archlinux
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Cache uv packages
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
with:
|
||||
path: ~/.cache/uv
|
||||
key: uv-${{ hashFiles('uv.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --frozen
|
||||
|
||||
- name: Check linting with Ruff
|
||||
run: uv run ruff check .
|
||||
|
||||
type-checking:
|
||||
name: Type Checking
|
||||
runs-on: logaldeveloper-archlinux
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Cache uv packages
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
with:
|
||||
path: ~/.cache/uv
|
||||
key: uv-${{ hashFiles('uv.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --frozen
|
||||
|
||||
- name: Check types with Mypy
|
||||
run: uv run mypy owncastsentry/
|
||||
|
||||
spelling:
|
||||
name: Spelling
|
||||
runs-on: logaldeveloper-archlinux
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
- name: Cache uv packages
|
||||
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
|
||||
with:
|
||||
path: ~/.cache/uv
|
||||
key: uv-${{ hashFiles('uv.lock') }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: uv sync --frozen
|
||||
|
||||
- name: Check spelling with codespell
|
||||
run: uv run codespell
|
||||
Reference in New Issue
Block a user