Skip to content

Commit

Permalink
Add diagrams and GitHub Action.
Browse files Browse the repository at this point in the history
  • Loading branch information
dracos committed Feb 21, 2024
1 parent 2b76ff8 commit 62b4d11
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy D2 documentation to pages

on:
push:
branches: [ diagrams ]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v4
- name: Install packages
run: curl -fsSL https://d2lang.com/install.sh | sh -s --
- name: Generate diagrams
run: |
for file in diagrams/*.d2; do
base="${file%.*}"
~/.local/bin/d2 $file _site/$base.svg -t 105 --sketch
done
- name: Generate index
run: |
echo '<ul>' > _site/diagrams/index.html
for file in _site/diagrams/*.svg; do
name="${file##*/}"
echo "<li><a href='$name'>$name</a></li>" >> _site/diagrams/index.html
done
echo '</ul>' >> _site/diagrams/index.html
- uses: actions/upload-pages-artifact@v3
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
package-lock.json

/diagrams/*.svg
24 changes: 24 additions & 0 deletions diagrams/brent-request.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Pick container: Which container do you need?
Replacement: Why do you need a\nreplacement container?
About you1: Summary\nEND { style.fill: lightgrey }
About you2: Summary\nEND { style.fill: lightgrey }
About you5: Summary\nEND { style.fill: lightgrey }
why_sacks: Why do you need\nmore sacks?
why_green: Why do you need a\nreplacement container?
Call us: Call us\nEND { style.fill: lightgrey }

Pick container -> Call us: Grey bin
Pick container -> why_sacks: Clear sack
Pick container -> why_green: Green bin
Pick container -> Replacement: Other

why_sacks -> About you1: I am a new resident\nwithout any
why_sacks -> About you1: I have used all\nthe sacks provided

why_green -> About you2: My container\nis damaged
why_green -> About you2: My container\nis missing

Replacement -> About you5: I am a new resident\nwithout a container
Replacement -> About you5: My container\nis damaged
Replacement -> About you5: My container\nis missing
Replacement -> About you5: I would like an\nextra container
28 changes: 28 additions & 0 deletions diagrams/echo-bin-day.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
shape: sequence_diagram

user: { shape: person }
user -> WasteWorks: Visit site
user <- WasteWorks: Postcode form { style.stroke-dash: 5 }
#user <- itemResponse.t: item {
# style.stroke-dash: 5
#}

user -> WasteWorks: Postcode
WasteWorks -> Echo: FindPoints
WasteWorks <- Echo: Addresses
user <- WasteWorks: Address form { style.stroke-dash: 5 }

user -> WasteWorks: Address

WasteWorks.t -> Echo: GetPointAddress
WasteWorks.t -> Echo: GetServiceUnitsForObject
WasteWorks.t -> Echo: GetEventsForObject

WasteWorks <- Echo: API results

WasteWorks.t2 -> Echo: GetEventsForObject \n (each Service Unit)
WasteWorks.t2 -> Echo: GetTasks

WasteWorks <- Echo: API results

user <- WasteWorks: Bin day page { style.stroke-dash: 5 }
42 changes: 42 additions & 0 deletions diagrams/kingston-request.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Pick container: Which container do you need?
Replacement: Why do you need a\nreplacement container?
Replacement2: Why do you need a\nreplacement container?
Recycling swap: Would you like to replace\nyour recycling box containers\nwith a wheelie bin?
Recycling swap2: Would you like to replace\nyour recycling box containers\nwith a wheelie bin?
Recycling number: How many\nboxes/\ncontainers?
Recycling number2: How many\nboxes/\ncontainers?
Notes missing: Can you give us any\ninformation about what\nhappened to your container?
Notes damaged: What happened to\nyour container?
About you1: About/\nSummary/\nEND { style.fill: lightgrey }
About you2: About/\nSummary/\nEND { style.fill: lightgrey }
About you3: Confirm\nAbout/\nSummary/\nEND { style.fill: lightgrey }
About you4: About/\nSummary/\nEND { style.fill: lightgrey }
About you5: About/\nSummary/\nEND { style.fill: lightgrey }
About you6: About/\nSummary/\nEND { style.fill: lightgrey }
About you7: Confirm\nAbout/\nSummary/\nEND { style.fill: lightgrey }

Pick container -> Replacement: Other
Pick container -> Recycling swap: Recycling bin\n(don’t have a bin)
Pick container -> About you1: Recycling blue stripe bag\nor Paper single use bag
Pick container -> Replacement2: Recycling box

Replacement2 -> Recycling number2: Damaged/\nMissing
Replacement2 -> Recycling number: New resident\nwithout\na container
Replacement2 -> Recycling swap2: I need an additional\ncontainer/bin

Replacement -> About you2: New resident\nwithout\na container
Replacement -> Notes damaged: Damaged
Replacement -> Notes missing: Missing

Recycling swap -> Replacement: No
Recycling swap -> About you3: Yes

Recycling swap2 -> Recycling number: No
Recycling swap2 -> About you7: Yes

Recycling number2 -> Notes damaged: Damaged
Recycling number2 -> Notes missing: Missing
Recycling number -> About you4

Notes missing -> About you5
Notes damaged -> About you6
20 changes: 20 additions & 0 deletions diagrams/sutton-bulky-payment.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
shape: sequence_diagram

user: { shape: person }

user -> WasteWorks: Submits\nbulky form

WasteWorks.t -> Echo: PostEvent with\nevent details

WasteWorks.t -> Payment\nprovider: Redirect user to\npayment provider

Payment\nprovider -> WasteWorks: Redirect back after\nsuccessful payment

WasteWorks."Parameters verified"

WasteWorks.t2 -> User: Payment confirmation screen

WasteWorks.t2 -> User: Email with booking details

WasteWorks.t2 -> Echo: UpdateEvent with\npayment details

8 changes: 8 additions & 0 deletions diagrams/sutton-request.d2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Pick container: Which container do you need?
Replacement: Why do you need a\nreplacement container?
About you: About/\nSummary/\nEND { style.fill: lightgrey }

Pick container -> Replacement: Other
Pick container -> About you: Recycling blue stripe bag\nor Paper single use bag

Replacement -> About you: Damaged/\nMissing

0 comments on commit 62b4d11

Please sign in to comment.