Skip to content
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
27 changes: 27 additions & 0 deletions .github/workflows/diagram.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Render Mermaid Diagrams
on:
push:
paths:
- 'docs/*.mmd' # Trigger only when mermaid files change
Comment on lines +3 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check for .mmd files in docs/ directory
fd -e mmd . docs/

Repository: dbfixtures/pytest-postgresql

Length of output: 93


🏁 Script executed:

#!/bin/bash
# Read the diagram.yml workflow file
cat -n .github/workflows/diagram.yml

Repository: dbfixtures/pytest-postgresql

Length of output: 1044


Align trigger pattern with rendering logic to prevent future inconsistency.

The workflow triggers on any .mmd file in docs/ (line 5), but the render command (line 21) only processes docs/architecture.mmd. While currently only one .mmd file exists, the trigger pattern is broader than the rendering logic. If additional .mmd files are added to docs/ in the future, they will trigger the workflow but won't be rendered.

Consider either:

  • Updating line 21 to render all .mmd files dynamically, or
  • Restricting the trigger pattern to only docs/architecture.mmd
🤖 Prompt for AI Agents
In @.github/workflows/diagram.yml around lines 3 - 5, The push trigger currently
watches 'docs/*.mmd' but the render step only targets a single file; align them
by either changing the trigger to 'docs/architecture.mmd' (narrow push.paths) or
update the render step (the command that processes docs/architecture.mmd) to
iterate over or glob all docs/*.mmd so every triggered file is actually
rendered; pick one approach and update the workflow so push.paths and the render
command use the same pattern.


jobs:
render:
runs-on: ubuntu-latest
# Grant the action permission to write to the repository
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Mermaid CLI
run: npm install -g @mermaid-js/mermaid-cli

- name: Render Diagram
run: mmdc -p docs/puppeteer-config.json -i docs/architecture.mmd -o docs/images/architecture.svg -t neutral

- name: Commit and Push
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "docs: update rendered mermaid diagram [skip ci]"
file_pattern: 'docs/images/*.svg'
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ repos:
- id: mixed-line-ending
- id: check-yaml
- id: pretty-format-json
args: [--autofix]
- id: detect-private-key
- id: debug-statements

Expand Down
19 changes: 19 additions & 0 deletions docs/architecture.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
sequenceDiagram
autonumber
participant Pytest as Pytest runner
participant ProcFactory as postgresql_proc_factory
participant PgServer as PostgreSQL process
participant TemplateDB as Template DB (seeded)
participant TestDB as Per-test DB (clone)

Pytest->>ProcFactory: request postgresql_proc with load=[load_database]
ProcFactory->>PgServer: start server
ProcFactory->>TemplateDB: invoke load_database (create metadata, seed data)
Note right of TemplateDB: Template is created and seeded once per full run
loop per test
Pytest->>PgServer: request clone of TemplateDB
PgServer->>TestDB: create cloned database for test
Pytest->>TestDB: run test using cloned DB
Pytest->>TestDB: teardown: commit transaction
Pytest->>TestDB: teardown: drop_all metadata (cleanup)
end
Empty file added docs/images/.keep
Empty file.
1 change: 1 addition & 0 deletions docs/images/architecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions docs/puppeteer-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"args": [
"--no-sandbox",
"--disable-setuid-sandbox"
]
}
1 change: 1 addition & 0 deletions newsfragments/1244.docs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add plugins' architecture diagram.
Loading