Skip to content
Draft
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
58 changes: 58 additions & 0 deletions .github/workflows/uml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: UML Diagram

on:
push:
branches:
- master
- main
- copybara_push
paths:
- "smart_control/**/*.py"
- "Makefile"
- "pyproject.toml"
- "poetry.lock"
- ".github/workflows/uml.yml"

pull_request:
branches:
- master
- main
- copybara_push
paths:
- "smart_control/**/*.py"
- "Makefile"
- "pyproject.toml"
- "poetry.lock"
- ".github/workflows/uml.yml"

permissions:
contents: read

jobs:
uml:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

Check failure on line 37 in .github/workflows/uml.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

zizmor/unpinned-uses

unpinned action reference: action is not pinned to a hash (required by blanket policy)

Check failure on line 37 in .github/workflows/uml.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

unpinned-uses

uml.yml:37: unpinned action reference: action is not pinned to a hash (required by blanket policy)

- name: Set up Python
uses: actions/setup-python@v5

Check failure on line 40 in .github/workflows/uml.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

zizmor/unpinned-uses

unpinned action reference: action is not pinned to a hash (required by blanket policy)

Check failure on line 40 in .github/workflows/uml.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

unpinned-uses

uml.yml:40: unpinned action reference: action is not pinned to a hash (required by blanket policy)
with:
python-version: "3.11"

- name: Install Poetry
run: pip install poetry==2.1.2

- name: Install dependencies
run: poetry install --with dev,docs

- name: Generate UML diagram
run: poetry run make uml

- name: Check generated diagram
run: |
if ! git diff --exit-code docs/images/class_diagram.svg; then
echo "::error::The UML diagram is outdated. Please run 'poetry run make uml' and commit the updated SVG."
exit 1
fi
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@ docs-quiet:

docs-build:
poetry run mkdocs build

#
# UML Diagram
#

uml:
@echo "--- Generating UML class diagram ---"
pyreverse -o mmd -k -p smart_control smart_control/
sed -i '/^classDiagram/a\ direction LR' classes_smart_control.mmd
mermaidx -i classes_smart_control.mmd -o docs/images/class_diagram.svg
# rm -f classes_smart_control.mmd packages_smart_control.mmd
Loading
Loading